Various small C++ changes.
[gcc.git] / gcc / cp / ChangeLog
index 585420a62c3c188c557e462c8903d2bd16519f1f..f6abb8445903947db5265a2a4816a43f3fa3c09d 100644 (file)
@@ -1,3 +1,172 @@
+2019-11-04  Jason Merrill  <jason@redhat.com>
+
+       * constexpr.c (explain_invalid_constexpr_fn): Show location of fn.
+
+       * pt.c (maybe_instantiate_noexcept): Only update clones if we
+       instantiated.
+
+       * typeck.c (contextual_conv_bool): New.
+
+       * name-lookup.c (lookup_qualified_name): Add wrapper overload taking
+       C string rather than identifier.
+       * parser.c (cp_parser_userdef_numeric_literal): Use it.
+       * rtti.c (emit_support_tinfos): Use it.
+       * cp-tree.h (ovl_op_identifier): Change to inline functions.
+       (build_x_binary_op): Add wrapper with fewer parms.
+
+2019-11-05  Jason Merrill  <jason@redhat.com>
+
+       * decl2.c (mark_used): Diagnose use of a function with unsatisfied
+       constraints here.
+       * typeck.c (cp_build_function_call_vec): Not here.
+
+2019-11-05  Nathan Sidwell  <nathan@acm.org>
+
+       PR c++/92370
+       * parser.c (cp_parser_error_1): Check EOF and UNKNOWN_LOCATION
+       when skipping over version control marker.
+
+2019-11-05  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/92343
+       * constexpr.c (potential_constant_expression_1): Return true rather
+       than false for PREDICT_EXPR.
+
+       * decl.c (omp_declare_variant_finalize_one): Call
+       declare_simd_adjust_this not just on the context, but also on the
+       variant-id expression for methods.  Don't call
+       cp_get_callee_fndecl_nofold, call cp_get_callee and only if it is
+       safe cp_get_fndecl_from_callee.  Don't try to print as %qD
+       NULL in diagnostics.
+       * pt.c (tsubst_attribute): Handle "omp declare variant base"
+       attribute.
+       (tsubst_function_decl): Call omp_declare_variant_finalize
+       if there are any "omp declare variant base" attributes left.
+
+2019-11-04  Kamlesh Kumar  <kamleshbhalui@gmail.com>
+
+       PR c++/91979 - mangling nullptr expression
+       * mangle.c (write_template_arg_literal): Handle nullptr
+       mangling.
+
+2019-11-04  Jason Merrill  <jason@redhat.com>
+
+       * typeck.c (check_return_expr): Avoid redundant error.
+
+2019-11-02  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * typeck.c (composite_pointer_type): Add a const op_location_t&
+       parameter and use it in diagnostics.
+       (composite_pointer_error): Likewise.
+       (composite_pointer_type_r): Add a const op_location_t&
+       parameter and forward it.
+       (cp_build_binary_op): Adjust calls.
+       (common_pointer_type): Likewise.
+       * call.c (add_builtin_candidate): Likewise.
+       (build_conditional_expr_1): Likewise.
+       * cp-tree.h (composite_pointer_type): Update declaration.
+
+       * typeck.c (cxx_sizeof_expr): Use cp_expr_loc_or_input_loc
+       in permerror.
+       (cxx_alignof_expr): Likewise.
+       (lvalue_or_else): Likewise.
+
+2019-11-02  Jakub Jelinek  <jakub@redhat.com>
+
+       * decl.c (omp_declare_variant_finalize_one): Use
+       omp_get_context_selector instead of c_omp_get_context_selector.
+
+       PR c++/89640
+       * parser.c (cp_parser_decl_specifier_seq): Don't parse attributes
+       if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
+
+       PR c++/88335 - Implement P1073R3: Immediate functions
+       * cp-tree.h (struct lang_decl_fn): Add immediate_fn_p bit.
+       (DECL_IMMEDIATE_FUNCTION_P, SET_DECL_IMMEDIATE_FUNCTION_P): Define.
+       (enum cp_decl_spec): Add ds_consteval.
+       (fold_non_dependent_expr): Add another tree argument defaulted to
+       NULL_TREE.
+       * name-lookup.h (struct cp_binding_level): Add immediate_fn_ctx_p
+       member.
+       * parser.c (cp_keyword_starts_decl_specifier_p): Adjust comments
+       for C++11 and C++20 specifiers.  Handle RID_CONSTEVAL.
+       (CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR): Adjust comment.
+       (CP_PARSER_FLAGS_CONSTEVAL): New.
+       (cp_parser_skip_balanced_tokens): New forward declaration.
+       (cp_parser_lambda_declarator_opt): Handle ds_consteval.  Set
+       current_binding_level->immediate_fn_ctx_p before parsing parameter
+       list if decl-specifier-seq contains consteval specifier.
+       (cp_parser_decl_specifier_seq): Handle RID_CONSTEVAL.
+       (cp_parser_explicit_instantiation): Diagnose explicit instantiation
+       with consteval specifier.
+       (cp_parser_init_declarator): For consteval or into flags
+       CP_PARSER_FLAGS_CONSTEVAL.
+       (cp_parser_direct_declarator): If CP_PARSER_FLAGS_CONSTEVAL, set
+       current_binding_level->immediate_fn_ctx_p in the sk_function_parms
+       scope.
+       (set_and_check_decl_spec_loc): Add consteval entry, formatting fix.
+       * call.c (build_addr_func): For direct calls to immediate functions
+       use build_address rather than decay_conversion.
+       (build_over_call): Evaluate immediate function invocations.
+       * error.c (dump_function_decl): Handle DECL_IMMEDIATE_FUNCTION_P.
+       * semantics.c (expand_or_defer_fn_1): Use tentative linkage and don't
+       call mark_needed for immediate functions.
+       * typeck.c (cxx_sizeof_or_alignof_expr): Likewise.  Formatting fix.
+       (cp_build_addr_expr_1): Reject taking address of immediate function
+       outside of immediate function.
+       * decl.c (validate_constexpr_redeclaration): Diagnose consteval
+       vs. non-consteval or vice versa redeclaration.  Use
+       SET_DECL_IMMEDIATE_FUNCTION_P if new_decl is immediate function.
+       (check_tag_decl): Use %qs with keyword string to simplify translation.
+       Handle ds_consteval.
+       (start_decl): Adjust diagnostics for static or thread_local variables
+       in immediate functions.
+       (grokfndecl): Call sorry_at on virtual consteval.  Use %qs with keyword
+       to string to simplify translation.  Diagnose consteval main.  Use
+       SET_DECL_IMMEDIATE_FUNCTION_P for consteval.
+       (grokdeclarator): Handle consteval.  Use %qs with keyword strings to
+       simplify translation.  Use separate ifs instead of chained else if
+       for invalid specifiers.  For constinit clear constinit_p rather than
+       constexpr_p.
+       * constexpr.c (find_immediate_fndecl): New function.
+       (cxx_eval_outermost_constant_expr): Allow consteval calls returning
+       void.  Diagnose returning address of immediate function from consteval
+       evaluation.
+       (fold_non_dependent_expr_template): Add OBJECT argument, pass it
+       through to cxx_eval_outermost_constant_expr.
+       (fold_non_dependent_expr): Add OBJECT argument, pass it through to
+       fold_non_dependent_expr_template.
+       (fold_non_dependent_init): Adjust fold_non_dependent_expr_template
+       caller.
+       * method.c (defaulted_late_check): Adjust diagnostics for consteval.
+       * lambda.c (maybe_add_lambda_conv_op): Copy over
+       DECL_DECLARED_CONSTEXPR_P and DECL_IMMEDIATE_FUNCTION_P bits from
+       callop to both artificial functions.
+       * init.c (build_value_init): Don't do further processing if
+       build_special_member_call returned a TREE_CONSTANT.  Formatting fix.
+
+       PR c++/91369 - Implement P0784R7: constexpr new
+       * cp-tree.h (CALL_FROM_NEW_OR_DELETE_P): Define.
+       * init.c (build_new_1, build_vec_delete_1, build_delete): Set
+       CALL_FROM_NEW_OR_DELETE_P on the CALL_EXPR to allocator functions.
+       * constexpr.c (is_std_allocator_allocate): Only allow
+       global replaceable allocator functions if CALL_FROM_NEW_OR_DELETE_P
+       or in std::allocate<T>::{,de}allocate.
+       (potential_constant_expression_1): Likewise.
+
+2019-11-01  Nathan Sidwell  <nathan@acm.org>
+
+       * class.c (check_field_decls): Refactor.
+
+2019-10-31  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/90947
+       * cp-tree.h (type_initializer_zero_p): Declare.
+       * decl.c (reshape_init_array_1): Formatting fix.
+       * tree.c (type_initializer_zero_p): New function.  Moved from
+       ../tree.c, use next_initializable_field, formatting fix.  Return
+       false for TYPE_NON_AGGREGATE_CLASS types.
+
 2019-10-30  Jason Merrill  <jason@redhat.com>
 
        PR c++/92268 - hard error satisfying return-type-requirement