PR c++/88337 - P1327R1: Allow polymorphic typeid in constexpr.
[gcc.git] / gcc / cp / ChangeLog
index 7b178e5cef852dd9dccb00207707b72f1c5786ea..444b339fe57618acd5d94127a329b7dfce496a8c 100644 (file)
@@ -1,3 +1,442 @@
+2019-11-22  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/88337 - P1327R1: Allow polymorphic typeid in constexpr.
+       * constexpr.c (potential_constant_expression_1): Allow a typeid
+       expression whose operand is of polymorphic type in constexpr in
+       C++20.
+       * rtti.c (build_typeid): Remove obsolete FIXME comment.
+
+2019-11-22  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/90677
+       * cp-objcp-common.c (identifier_global_tag): Define.
+
+       PR c++/92458
+       * init.c (nsdmi_inst): Change type to
+       decl_tree_cache_map * from tree_cache_map *.
+       * constraint.cc (decl_constraints): Likewise.
+       * decl.c (get_tuple_decomp_init): Likewise.
+       * pt.c (defarg_inst, explicit_specifier_map): Likewise.
+       (tsubst_default_argument, store_explicit_specifier): Use
+       decl_tree_cache_map::create_ggc rather than
+       tree_cache_map::create_ggc.
+       * cp-objcp-common.c (debug_type_map): Change type to
+       type_tree_cache_map * from tree_cache_map *.
+
+2019-11-21  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/92450 - ICE with invalid nested name specifier.
+       * parser.c (cp_parser_member_declaration): Don't attempt to print
+       erroneous bit-field diagnostic if grokdeclarator returns
+       error_mark_node.
+
+2019-11-21  Jakub Jelinek  <jakub@redhat.com>
+           Jason Merrill  <jason@redhat.com>
+
+       PR c++/90842
+       * parser.c (cp_parser_decl_specifier_seq): For concept or typedef
+       break early if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR.
+       For type specifiers, set CP_PARSER_FLAGS_NO_TYPE_DEFINITIONS
+       if CP_PARSER_FLAGS_ONLY_MUTABLE_OR_CONSTEXPR is set.
+
+2019-11-20  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * typeck2.c (build_x_arrow): Early return if decay_conversion
+       returns error_mark_node.
+
+2019-11-20  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/90767
+       * call.c (complain_about_no_candidates_for_method_call): If
+       conv->from is not a type, pass to complain_about_bad_argument
+       lvalue_type of conv->from.
+
+2019-11-20  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * cvt.c (ocp_convert): Use additional warning sentinel.
+
+2019-11-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/92414
+       * constexpr.c (cxx_eval_outermost_constant_expr): If DECL_INITIAL
+       on object is erroneous, return t without trying to evaluate
+       a constexpr dtor.
+
+2019-11-12  Jason Merrill  <jason@redhat.com>
+
+       * call.c (same_fn_or_template): Change to cand_parms_match.
+       (joust): Adjust.
+       (print_z_candidate): Mark rewritten/reversed candidates.
+       (build_new_op_1): Warn about recursive call with reversed arguments.
+
+2019-11-15  Andrew Sutton  <asutton@lock3software.com>
+
+       PR c++/89913
+       * pt.c (get_underlying_template): Exit loop if the original type
+       of the alias is null.
+
+2019-11-19  Andrew Sutton  <asutton@lock3software.com>
+
+       PR c++/92078
+       * pt.c (maybe_new_partial_specialization): Apply access to newly
+       created partial specializations. Update comment style.
+
+2019-11-19  Andrew Sutton  <asutton@lock3software.com>
+
+       PR c++/92078
+       * pt.c (maybe_new_partial_specialization): Apply access to newly
+       created partial specializations. Update comment style.
+
+2019-11-19  Andrew Sutton  <asutton@lock3software.com>
+
+       PR c++/92403
+       Suppress diagnostics substituting into a requires-expression.
+       * pt.c (tsubst_copy_and_build): Perform the first substitution without
+       diagnostics and a second only if tsubst_requries_expr returns an error.
+
+2019-11-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/92504
+       * semantics.c (handle_omp_for_class_iterator): Don't call
+       cp_fully_fold on cond.
+
+2019-11-18  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * typeck.c (cp_build_addr_expr_1): Use cp_expr_loc_or_input_loc
+       in three places.
+       (cxx_sizeof_expr): Use it in one additional place.
+       (cxx_alignof_expr): Likewise.
+       (lvalue_or_else): Likewise.
+
+2019-11-18  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/91962 - ICE with reference binding and qualification conversion.
+       * call.c (convert_like_real) <case ck_ref_bind>: Check need_temporary_p.
+
+2019-11-17  Jakub Jelinek  <jakub@redhat.com>
+
+       * method.c (lookup_comparison_result): Use %qD instead of %<%T::%D%>
+       to print the decl.
+       (lookup_comparison_category): Use %qD instead of %<std::%D%> to print
+       the decl.
+
+2019-11-15  Paolo Carlini  <paolo.carlini@oracle.com>
+
+       * typeck.c (cp_truthvalue_conversion): Add tsubst_flags_t parameter
+       and use it in calls; also pass the location_t of the expression to
+       cp_build_binary_op and c_common_truthvalue_conversion.
+       * rtti.c (build_dynamic_cast_1): Adjust call.
+       * cvt.c (ocp_convert): Likewise.
+       * cp-gimplify.c (cp_fold): Likewise.
+       * cp-tree.h (cp_truthvalue_conversion): Update declaration.
+
+2019-11-14  Jason Merrill  <jason@redhat.com>
+
+       Implement P1816R0, class template argument deduction for aggregates.
+       * pt.c (maybe_aggr_guide, collect_ctor_idx_types): New.
+       (is_spec_or_derived): Split out from do_class_deduction.
+       (build_deduction_guide): Handle aggregate guide.
+       * class.c (finish_struct): Set CLASSTYPE_NON_AGGREGATE in a
+       template.
+       * cp-tree.h (CP_AGGREGATE_TYPE_P): An incomplete class is not an
+       aggregate.
+
+2019-11-14  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * call.c (build_conditional_expr_1): Use truth_type_for instead
+       of build_same_sized_truth_vector_type.
+       * typeck.c (build_vec_cmp): Likewise.
+
+2019-11-14  Jakub Jelinek  <jakub@redhat.com>
+
+       * parser.c (cp_parser_omp_context_selector): Don't require score
+       argument to fit into shwi, just to be INTEGER_CST.  Diagnose
+       negative score.
+       * pt.c (tsubst_attribute): Likewise.
+
+       * parser.c (cp_parser_omp_context_selector): Rename
+       CTX_PROPERTY_IDLIST to CTX_PROPERTY_NAME_LIST, add CTX_PROPERTY_ID.
+       Use CTX_PROPERTY_ID for atomic_default_mem_order, only allow a single
+       identifier in that.  For CTX_PROPERTY_NAME_LIST, allow identifiers
+       and string literals.
+       * pt.c (tsubst_attribute): Fix up STRING_CST handling if allow_string.
+
+2019-11-13  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/89070 - bogus [[nodiscard]] warning in SFINAE.
+       * cvt.c (convert_to_void): Guard maybe_warn_nodiscard calls with
+       tf_warning.
+
+2019-11-13  Richard Sandiford  <richard.sandiford@arm.com>
+
+       PR c++/92206
+       * cp-tree.h (STF_STRIP_DEPENDENT): New constant.
+       * tree.c (strip_typedefs): Add STF_STRIP_DEPENDENT to the flags
+       when calling strip_typedefs recursively on a DECL_ORIGINAL_TYPE.
+       Don't apply the fix for DR1558 in that case; allow aliases with
+       dependent template parameters to be stripped instead.
+
+2019-11-12  Nathan Sidwell  <nathan@acm.org>
+
+       * name-lookup.c (lookup_using_decl): New function, merged from ...
+       (do_class_using_decl): ... here.  Call it.  And ...
+       (finish_nonmember_using_decl): ... here.  Call it.
+
+2019-11-12  Martin Liska  <mliska@suse.cz>
+
+       * name-lookup.c: Do not include params.h.
+       * typeck.c: Likewise.
+
+2019-11-12  Martin Liska  <mliska@suse.cz>
+
+       * name-lookup.c (namespace_hints::namespace_hints): Replace old
+       parameter syntax with the new one, include opts.h if needed.  Use
+       SET_OPTION_IF_UNSET macro.
+       * typeck.c (comptypes): Likewise.
+
+2019-11-12  Maciej W. Rozycki  <macro@codesourcery.com>
+           Frederik Harwath  <frederik@codesourcery.com>
+
+       gcc/cp/
+       * constexpr.c (potential_constant_expression_1): Handle
+       OACC_SERIAL.
+       * parser.c (OACC_SERIAL_CLAUSE_MASK): New macro.
+       (cp_parser_oacc_kernels_parallel): Rename function to...
+       (cp_parser_oacc_compute): ... this.  Handle PRAGMA_OACC_SERIAL.
+       (cp_parser_omp_construct): Update accordingly.
+       (cp_parser_pragma): Handle PRAGMA_OACC_SERIAL.  Fix alphabetic
+       order.
+       * pt.c (tsubst_expr): Handle OACC_SERIAL.
+
+2019-11-11  Jason Merrill  <jason@redhat.com>
+
+       Implement P1946R0, Allow defaulting comparisons by value.
+       * method.c (early_check_defaulted_comparison): Accept by-value,
+       reject mixed by-value and by-reference parms.
+       * decl.c (grokdeclarator): Set funcdef_flag for defaulted friend.
+       * decl2.c (grokfield): Don't SET_DECL_FRIEND_CONTEXT.
+
+       * typeck.c (cp_build_binary_op): Sorry about <=> on VECTOR_TYPE.
+
+2019-11-11  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/92447
+       * decl.c (finish_function): Move ctype initialization before
+       DECL_DELETED_FN handling.
+
+       * semantics.c (finish_translation_unit): Diagnose declare target
+       without corresponding end declare target.
+
+2019-11-10  Jason Merrill  <jason@redhat.com>
+
+       Implement D1957R0, T* to bool should be considered narrowing.
+       * typeck2.c (check_narrowing): Treat pointer->bool as a narrowing
+       conversion with -std=c++2a.
+
+2019-11-08  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/92215 - flawed diagnostic for bit-field with non-integral type.
+       * parser.c (cp_parser_member_declaration): Add a diagnostic for
+       bit-fields with non-integral types.
+
+2019-11-08  Jakub Jelinek  <jakub@redhat.com>
+
+       * init.c (build_vec_delete_1): Fix a comment typo - mist -> must.
+
+2019-11-07  Jason Merrill  <jason@redhat.com>
+
+       Implement D1959R0, remove weak_equality and strong_equality.
+       * method.c (enum comp_cat_tag, comp_cat_info): Remove *_equality.
+       (genericize_spaceship, common_comparison_type): Likewise.
+       * typeck.c (cp_build_binary_op): Move SPACESHIP_EXPR to be with the
+       relational operators, exclude other types no longer supported.
+
+2019-11-06  Jason Merrill  <jason@redhat.com>
+
+       Implement D1907R1 "structural type".
+       * tree.c (structural_type_p): New.
+       * pt.c (invalid_nontype_parm_type_p): Use it.
+       * class.c (build_base_field_1): Take binfo.  Copy TREE_PRIVATE.
+       (build_base_field): Pass binfo.
+
+       PR c++/92150 - partial specialization with class NTTP.
+       * pt.c (unify): Handle VIEW_CONVERT_EXPR.
+
+       * pt.c (use_pack_expansion_extra_args_p): Still do substitution if
+       all packs are simple pack expansions.
+       (add_extra_args): Check that the extra args aren't dependent.
+
+2019-11-06  Andrew Sutton  <asutton@lock3software.com>
+
+       Use satisfaction with nested requirements.
+       * constraint.cc (build_parameter_mapping): Use
+       current_template_parms when the declaration is not available.
+       (norm_info::norm_info) Make explicit.
+       (normalize_constraint_expression): Factor into a separate overload
+       that takes arguments, and use that in the original function.
+       (tsubst_nested_requirement): Use satisfy_constraint instead of
+       trying to evaluate this as a constant expression.
+       (finish_nested_requirement): Keep the normalized constraint and the
+       original normalization arguments with the requirement.
+       (diagnose_nested_requirement): Use satisfy_constraint. Tentatively
+       implement more comprehensive diagnostics, but do not enable.
+       * parser.c (cp_parser_requires_expression): Relax requirement that
+       requires-expressions can live only inside templates.
+       * pt.c (any_template_parm_r): Look into type of PARM_DECL.
+
+2019-11-06  Jason Merrill  <jason@redhat.com>
+
+       C++20 NB CA378 - Remove constrained non-template functions.
+       * decl.c (grokfndecl): Reject constraints on non-templated function.
+
+2019-11-06  Matthias Kretz  <m.kretz@gsi.de>
+
+       * parser.c (cp_parser_operator): Parse operator?: as an
+       attempt to overload the conditional operator.
+
+2019-11-05  Jason Merrill  <jason@redhat.com>
+
+       Implement C++20 operator<=>.
+       * cp-tree.h (struct lang_decl_fn): Add maybe_deleted bitfield.
+       (DECL_MAYBE_DELETED): New.
+       (enum special_function_kind): Add sfk_comparison.
+       (LOOKUP_REWRITTEN, LOOKUP_REVERSED): New.
+       * call.c (struct z_candidate): Add rewritten and reversed methods.
+       (add_builtin_candidate): Handle SPACESHIP_EXPR.
+       (add_builtin_candidates): Likewise.
+       (add_candidates): Don't add a reversed candidate if the parms are
+       the same.
+       (add_operator_candidates): Split out from build_new_op_1.  Handle
+       rewritten and reversed candidates.
+       (add_candidate): Swap conversions of reversed candidate.
+       (build_new_op_1): Swap them back.  Build a second operation for
+       rewritten candidates.
+       (extract_call_expr): Handle rewritten calls.
+       (same_fn_or_template): New.
+       (joust): Handle rewritten and reversed candidates.
+       * class.c (add_implicitly_declared_members): Add implicit op==.
+       (classtype_has_op, classtype_has_defaulted_op): New.
+       * constexpr.c (cxx_eval_binary_expression): Handle SPACESHIP_EXPR.
+       (cxx_eval_constant_expression, potential_constant_expression_1):
+       Likewise.
+       * cp-gimplify.c (genericize_spaceship): New.
+       (cp_genericize_r): Use it.
+       * cp-objcp-common.c (cp_common_init_ts): Handle SPACESHIP_EXPR.
+       * decl.c (finish_function): Handle deleted function.
+       * decl2.c (grokfield): SET_DECL_FRIEND_CONTEXT on defaulted friend.
+       (mark_used): Check DECL_MAYBE_DELETED.  Remove assumption that
+       defaulted functions are non-static members.
+       * error.c (dump_expr): Handle SPACESHIP_EXPR.
+       * method.c (type_has_trivial_fn): False for sfk_comparison.
+       (enum comp_cat_tag, struct comp_cat_info_t): New types.
+       (comp_cat_cache): New array variable.
+       (lookup_comparison_result, lookup_comparison_category)
+       (is_cat, cat_tag_for, spaceship_comp_cat)
+       (spaceship_type, genericize_spaceship)
+       (common_comparison_type, early_check_defaulted_comparison)
+       (comp_info, build_comparison_op): New.
+       (synthesize_method): Handle sfk_comparison.  Handle deleted.
+       (get_defaulted_eh_spec, maybe_explain_implicit_delete)
+       (explain_implicit_non_constexpr, implicitly_declare_fn)
+       (defaulted_late_check, defaultable_fn_check): Handle sfk_comparison.
+       * name-lookup.c (get_std_name_hint): Add comparison categories.
+       * tree.c (special_function_p): Add sfk_comparison.
+       * typeck.c (cp_build_binary_op): Handle SPACESHIP_EXPR.
+
+2019-11-05  Tim van Deurzen  <tim@kompiler.org>
+
+       Add new tree code for the spaceship operator.
+       * cp-tree.def: Add new tree code.
+       * operators.def: New binary operator.
+       * parser.c: Add new token and tree code.
+
+2019-09-15  Jason Merrill  <jason@redhat.com>
+
+       * call.c (build_new_op_1): Don't apply any standard conversions to
+       the operands of a built-in operator.  Don't suppress conversions in
+       cp_build_unary_op.
+       * typeck.c (cp_build_unary_op): Do integral promotions for enums.
+
+2019-11-04  Jason Merrill  <jason@redhat.com>
+
+       Use vec instead of raw array for built-in candidates.
+       * call.c (build_builtin_candidate): Take args in a vec.
+       (add_builtin_candidate, add_builtin_candidates): Likewise.
+       (build_conditional_expr_1, build_new_op_1): Adjust.
+
+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