Various small C++ changes.
[gcc.git] / gcc / cp / ChangeLog
index 02cb6f3bf5b873bd03d5d4dad69b77eca3f1c21e..f6abb8445903947db5265a2a4816a43f3fa3c09d 100644 (file)
@@ -1,9 +1,265 @@
+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
+       * constraint.cc (type_deducible_p): Check for substitution failure.
+       (diagnose_compound_requirement): Adjust diagnostic.
+       * pt.c (do_auto_deduction): Don't pass cargs to
+       constraints_satisfied_p.
+
+2019-10-30  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/91369 - Implement P0784R7: constexpr new
+       * constexpr.c (cxx_replaceable_global_alloc_fn): Don't return true
+       for placement new.
+       (cxx_placement_new_fn, is_std_construct_at): New functions.
+       (cxx_eval_call_expression): Allow placement new in std::construct_at.
+       (potential_constant_expression_1): Likewise.
+
+       * typeck.c (decl_in_std_namespace_p): Return true also for decls
+       in inline namespaces inside of std namespace.
+
+2019-10-30  Bernd Edlinger  <bernd.edlinger@hotmail.de>
+
+       PR c++/92024
+       * name-lookup.c (check_local_shadow): Shadowing TYPE_DECLs
+       is always a -Wshadow=compatible-local warning, unless
+       -Wshadow is used.
+
+2019-10-30  Jason Merrill  <jason@redhat.com>
+
+       * cxx-pretty-print.c (get_fold_operator): Use OVL_OP_INFO.
+
+2019-10-30  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/92134 - constinit malfunction in static data member.
+       * decl2.c (grokfield): Set LOOKUP_CONSTINIT.
+
+2019-10-30  Jakub Jelinek  <jakub@redhat.com>
+
+       * cp-tree.h (omp_declare_variant_finalize, build_local_temp): Declare.
+       * decl.c: Include omp-general.h.
+       (declare_simd_adjust_this): Add forward declaration.
+       (omp_declare_variant_finalize_one, omp_declare_variant_finalize): New
+       function.
+       (cp_finish_decl, finish_function): Call omp_declare_variant_finalize.
+       * parser.c (cp_finish_omp_declare_variant): Adjust parsing of the
+       variant id-expression and propagate enough information to
+       omp_declare_variant_finalize_one in the attribute so that it can
+       finalize it.
+       * class.c (finish_struct): Call omp_declare_variant_finalize.
+       * tree.c (build_local_temp): No longer static, remove forward
+       declaration.
+
+2019-10-30  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * typeck.c (cp_build_modify_expr): Prefer error + inform to
+       error + error in one place.
+       (get_delta_difference_1): Likewise.
+       (get_delta_difference): Likewise, in two places.
+
+2019-10-29  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * typeck.c (build_x_unary_op): Use the location_t argument in
+       three error_at.
+
+2019-10-29  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/90998 - ICE with copy elision in init by ctor and -Wconversion.
+       * call.c (joust): Don't attempt to warn if ->second_conv is null.
+
+2019-10-29  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/92201
+       * cp-gimplify.c (cp_gimplify_expr): If gimplify_to_rvalue changes the
+       function pointer type, re-add cast to the original one.
+
+2019-10-29  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/91548 - fix detecting modifying const objects for ARRAY_REF.
+       * constexpr.c (cxx_eval_store_expression): Don't call
+       modifying_const_object_p for ARRAY_REF.
+
+2019-10-29  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * cp-objcp-common.h (cxx_simulate_enum_decl): Declare.
+       (LANG_HOOKS_SIMULATE_ENUM_DECL): Define to the above.
+       * decl.c (cxx_simulate_enum_decl): New function.
+
 2019-10-29  Richard Sandiford  <richard.sandiford@arm.com>
 
        * cp-tree.h (cxx_simulate_builtin_function_decl): Declare.
        * decl.c (cxx_simulate_builtin_function_decl): New function.
-       * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL): Define
-       to the above.
+       * cp-objcp-common.h (LANG_HOOKS_SIMULATE_BUILTIN_FUNCTION_DECL):
+       Define to the above.
 
 2019-10-28  Martin Sebor  <msebor@redhat.com>