1 2023-07-26 Patrick Palka <ppalka@redhat.com>
5 * pt.cc (reduce_template_parm_level): Set DECL_TEMPLATE_INFO
6 on the DECL_TEMPLATE_RESULT of the new ttp.
7 (add_defaults_to_ttp): Make a copy of the original ttp's
8 DECL_TEMPLATE_RESULT, and update this copy's DECL_TEMPLATE_INFO
10 (coerce_template_template_parms): Make sure 'scope_args' has
11 the right amount of levels for the ttp argument.
12 (most_general_template): Handle template template parameters.
13 (rewrite_template_parm): Set DECL_TEMPLATE_RESULT on the
14 DECL_TEMPLATE_RESULT of the new ttp.
16 2023-07-26 Patrick Palka <ppalka@redhat.com>
20 * pt.cc (coerce_template_template_parms): Simplify by using
21 DECL_INNERMOST_TEMPLATE_PARMS and removing redundant asserts.
22 Always pass the parameters of the most general template to
23 coerce_template_parms.
25 2023-07-26 Patrick Palka <ppalka@redhat.com>
28 * pt.cc (unify) <case INTEGER_CST>: Generalize to handle
31 2023-07-26 Marek Polacek <polacek@redhat.com>
33 * parser.cc (cp_parser_constant_expression): Allow non_constant_p to be
34 nullptr even when allow_non_constant_p is true. Don't call
35 _rvalue_constant_expression when not necessary. Move local variable
36 declarations closer to their first use.
37 (cp_parser_static_assert): Don't pass a dummy down to
38 cp_parser_constant_expression.
40 2023-07-26 Jason Merrill <jason@redhat.com>
43 * parser.cc (cp_parser_template_name): Skip non-member
44 lookup after the template keyword.
45 (cp_parser_lookup_name): Pass down template_keyword_p.
47 2023-07-26 Nathaniel Shead <nathanieloshead@gmail.com>
52 * constexpr.cc (constexpr_global_ctx::is_outside_lifetime): New
54 (constexpr_global_ctx::get_value): Don't return expired values.
55 (constexpr_global_ctx::get_value_ptr): Likewise.
56 (constexpr_global_ctx::remove_value): Mark value outside
58 (outside_lifetime_error): New function.
59 (cxx_eval_call_expression): No longer track save_exprs.
60 (cxx_eval_loop_expr): Likewise.
61 (cxx_eval_constant_expression): Add checks for outside lifetime
62 values. Remove local variables at end of bind exprs, and
63 temporaries after cleanup points.
65 2023-07-26 Nathaniel Shead <nathanieloshead@gmail.com>
68 * cp-gimplify.cc (cp_genericize_r): Transform RETURN_EXPRs to
69 not return dangling pointers.
70 * cp-tree.h (RETURN_EXPR_LOCAL_ADDR_P): New flag.
71 (check_return_expr): Add a new parameter.
72 * semantics.cc (finish_return_stmt): Set flag on RETURN_EXPR
73 when referring to dangling pointer.
74 * typeck.cc (check_return_expr): Disable transformation of
75 dangling pointers, instead pass this information to caller.
77 2023-07-26 Nathaniel Shead <nathanieloshead@gmail.com>
79 * constexpr.cc (modifying_const_object_error): Find the source
80 location of the const object's declaration.
81 (cxx_eval_constant_expression): Update input_location to the
82 location of the currently evaluated expression, if possible.
84 2023-07-25 Marek Polacek <polacek@redhat.com>
87 * pt.cc (lookup_and_finish_template_variable): Don't clear tf_partial
89 (instantiate_template): Reset all complain flags except
92 2023-07-25 Marek Polacek <polacek@redhat.com>
95 * constexpr.cc (cxx_eval_array_reference): Create a new constructor
96 only when we don't already have a matching one. Clear the object
97 when the type is non-scalar.
99 2023-07-21 Marek Polacek <polacek@redhat.com>
102 * constexpr.cc (potential_constant_expression_1): Try to complete the
103 type when !processing_template_decl.
105 2023-07-20 Marek Polacek <polacek@redhat.com>
108 * call.cc (implicit_conversion_1): Return early if the type isn't
111 2023-07-19 Marek Polacek <polacek@redhat.com>
114 * error.cc (dump_simple_decl): Print base class name.
116 2023-07-19 Marek Polacek <polacek@redhat.com>
119 * typeck2.cc (process_init_constructor_record): Don't emit
120 -Wmissing-field-initializers for empty classes.
122 2023-07-19 Patrick Palka <ppalka@redhat.com>
124 * pt.cc (type_unification_real): Test for PARM_DECL instead
125 of TEMPLATE_PARM_INDEX to distinguish a type vs non-type
126 template parameter pack.
127 (type_targs_deducible_from): Likewise.
129 2023-07-19 Patrick Palka <ppalka@redhat.com>
131 * pt.cc (tsubst_function_decl): Add defaulted 'use_spec_table'
132 flag parameter. Don't look up or insert into the specializations
133 table if 'use_spec_table' is false.
134 (tsubst_decl): Add defaulted 'use_spec_table' flag parameter.
135 Check for error_mark_node.
136 <case FUNCTION_DECL>: Pass 'use_spec_table' to
137 tsubst_function_decl.
138 <case TYPE/VAR_DECL>: Don't call coerce_template_parms.
139 Don't look up or insert into the specializations table if
140 'use_spec_table' is false. Exit earlier if the substituted
141 type is erroneous and we're not complaining, and do so for
142 alias specializations as well.
143 (instantiate_template): Pass false as 'use_spec_table'
144 to tsubst_decl. Call register_specialization afterwards.
146 2023-07-18 Jason Merrill <jason@redhat.com>
148 * constexpr.cc (cxx_eval_bit_cast): Check that the result of
149 native_interpret_aggregate doesn't need more evaluation.
151 2023-07-18 Patrick Palka <ppalka@redhat.com>
153 * call.cc (add_template_conv_candidate): Don't check for
154 non-empty 'candidates' here.
155 (build_op_call): Check it here, before we've considered any
156 conversion functions.
158 2023-07-18 Patrick Palka <ppalka@redhat.com>
161 * call.cc (add_conv_candidate): Check constraints.
163 2023-07-17 Jason Merrill <jason@redhat.com>
165 * constexpr.cc (cxx_eval_call_expression): Only cache
166 reduced_constant_expression_p results.
167 (reduced_constant_expression_p): Handle CONSTRUCTOR of scalar type.
168 (cxx_eval_constant_expression): Fold vectors here.
169 (cxx_eval_bare_aggregate): Not here.
171 2023-07-15 Patrick Palka <ppalka@redhat.com>
174 * call.cc (keep_unused_object_arg): Use cp_build_compound_expr
175 instead of building a COMPOUND_EXPR directly.
177 2023-07-15 Patrick Palka <ppalka@redhat.com>
180 * mangle.cc (write_expression): Handle TEMPLATE_ID_EXPR
181 whose template is already an IDENTIFIER_NODE.
183 2023-07-14 Nathaniel Shead <nathanieloshead@gmail.com>
185 * constexpr.cc (cxx_eval_constant_expression): Pass t to get_value.
187 2023-07-14 Jason Merrill <jason@redhat.com>
190 * constexpr.cc (cxx_eval_constant_expression): Move P2738 handling
192 * name-lookup.cc (get_cxx_dialect_name): Add C++26.
194 2023-07-14 Marek Polacek <polacek@redhat.com>
195 Jason Merrill <jason@redhat.com>
198 * decl.cc (cp_finish_decl): Set TREE_CONSTANT when initializing
199 an object of empty class type.
200 * pt.cc (value_dependent_expression_p) <case VAR_DECL>: Treat a
201 constexpr-declared non-constant variable as value-dependent.
203 2023-07-11 Patrick Palka <ppalka@redhat.com>
206 * pt.cc (lookup_template_variable): Pass all levels of arguments
207 to coerce_template_parms, and use the parameters from the most
210 2023-07-10 Patrick Palka <ppalka@redhat.com>
213 * pt.cc (redeclare_class_template): Relax the ttp DECL_CONTEXT
214 assert, and downgrade it to a checking assert.
216 2023-06-30 Patrick Palka <ppalka@redhat.com>
218 * cp-tree.h (TEMPLATE_PARM_DESCENDANTS): Harden.
219 (TEMPLATE_TYPE_DESCENDANTS): Define.
220 (TEMPLATE_TEMPLATE_PARM_SIMPLE_P): Define.
221 * pt.cc (reduce_template_parm_level): Revert
222 r14-418-g0bc2a1dc327af9 change.
223 (process_template_parm): Set TEMPLATE_TEMPLATE_PARM_SIMPLE_P
225 (uses_outer_template_parms): Determine the outer depth of
226 a template template parm without relying on DECL_CONTEXT.
227 (tsubst) <case TEMPLATE_TEMPLATE_PARM>: Cache lowering a
228 simple template template parm. Consistently use 'code'.
230 2023-06-29 Patrick Palka <ppalka@redhat.com>
233 * init.cc (maybe_instantiate_nsdmi_init): Mask out all
234 tsubst flags except for tf_warning_or_error.
236 2023-06-29 Patrick Palka <ppalka@redhat.com>
239 * cp-gimplify.cc (cp_fold) <case CONSTRUCTOR>: Propagate
240 CONSTRUCTOR_MUTABLE_POISON.
242 2023-06-29 Patrick Palka <ppalka@redhat.com>
244 * cp-tree.h (tree_template_info::partial): New data member.
245 (TI_PARTIAL_INFO): New tree accessor.
246 (most_specialized_partial_spec): Add defaulted bool parameter.
247 * module.cc (trees_out::core_vals) <case TEMPLATE_INFO>: Stream
249 (trees_in::core_vals) <case TEMPLATE_INFO>: Likewise.
250 * parser.cc (specialization_of): Adjust after making
251 most_specialized_partial_spec return TEMPLATE_INFO instead
253 * pt.cc (process_partial_specialization): Set TI_PARTIAL_INFO
254 of 'decl' to point back to the partial TEMPLATE_DECL. Likewise
255 (and pass rechecking=true to most_specialization_partial_spec).
256 (instantiate_class_template): Likewise.
257 (instantiate_template): Set TI_PARTIAL_INFO to the result of
258 most_specialization_partial_spec after forming a variable
259 template specialization.
260 (most_specialized_partial_spec): Add 'rechecking' parameter.
261 Exit early if the template is not primary. Use the TI_PARTIAL_INFO
262 of the corresponding TEMPLATE_INFO as a cache unless 'rechecking'
263 is true. Don't bother setting TREE_TYPE of each TREE_LIST.
264 (instantiate_decl): Adjust after making
265 most_specialized_partial_spec return TEMPLATE_INFO instead of
267 * ptree.cc (cxx_print_xnode) <case TEMPLATE_INFO>: Dump
270 2023-06-29 Eugene Rozenfeld <erozen@microsoft.com>
272 * Make-lang.in: Pass correct stage cc1plus when processing
273 profile data collected while building target libraries
275 2023-06-28 Patrick Palka <ppalka@redhat.com>
279 * cp-tree.h (lookup_template_variable): Add complain parameter.
280 * parser.cc (cp_parser_template_id): Pass tf_warning_or_error
281 to lookup_template_variable.
282 * pt.cc (lookup_template_variable): Add complain parameter.
283 Coerce template arguments here ...
284 (finish_template_variable): ... instead of here.
285 (lookup_and_finish_template_variable): Check for error_mark_node
286 result from lookup_template_variable.
287 (tsubst_copy) <case TEMPLATE_ID_EXPR>: Pass complain to
288 lookup_template_variable.
289 (instantiate_template): Use build2 instead of
290 lookup_template_variable to build a TEMPLATE_ID_EXPR
291 for most_specialized_partial_spec.
293 2023-06-28 Marek Polacek <polacek@redhat.com>
296 * typeck.cc (cp_build_unary_op): Check tf_warning before warning.
298 2023-06-28 Jason Merrill <jason@redhat.com>
301 * cp-tree.h (clone_attrs): Declare.
302 * method.cc (implicitly_declare_fn): Use it for inherited
304 * optimize.cc (clone_attrs): New.
305 (maybe_clone_body): Use it.
307 2023-06-28 Jason Merrill <jason@redhat.com>
310 * constexpr.cc (cxx_eval_constant_expression): In C++26, allow cast
311 from void* to the type of a pointed-to object.
313 2023-06-23 David Malcolm <dmalcolm@redhat.com>
316 * cp-name-hint.h (maybe_suggest_missing_header): New decl.
317 * decl.cc: Define INCLUDE_MEMORY. Add include of
319 (start_decl_1): Call maybe_suggest_missing_header.
320 * name-lookup.cc (maybe_suggest_missing_header): Remove "static".
322 2023-06-16 Alex Coplan <alex.coplan@arm.com>
324 * parser.cc (cp_parser_enum_specifier): Don't reject
325 elaborated-type-specifier with enum-base, instead emit new
326 Welaborated-enum-base warning.
328 2023-06-14 Jason Merrill <jason@redhat.com>
332 * call.cc (joust_maybe_elide_copy): Don't change cand.
333 (joust): Move the elided tiebreaker later.
335 2023-06-13 David Malcolm <dmalcolm@redhat.com>
338 * name-lookup.cc (missing_std_header::~missing_std_header): Reword
339 note to avoid negative tone of "forgetting".
341 2023-06-13 Jason Merrill <jason@redhat.com>
343 * tree.cc (build_target_expr): Check TYPE_HAS_MUTABLE_P.
345 2023-06-12 Tobias Burnus <tobias@codesourcery.com>
347 * parser.cc (cp_parser_omp_clause_map): Reword error message for
348 clearness especially with 'omp target (enter/exit) data.'
349 * semantics.cc (handle_omp_array_sections): Handle
350 GOMP_MAP_{ALWAYS_,}PRESENT_{TO,TOFROM,FROM,ALLOC} enum values.
352 2023-06-12 Jason Merrill <jason@redhat.com>
355 * call.cc (convert_like_internal) [ck_list]: Use
356 maybe_init_list_as_array.
357 * constexpr.cc (cxx_eval_vec_init_1): Init might have
359 * tree.cc (build_vec_init_elt): Likewise.
360 * init.cc (build_vec_init): Handle from_array from a
361 TARGET_EXPR. Retain TARGET_EXPR of a different type.
363 2023-06-11 Patrick Palka <ppalka@redhat.com>
366 * constexpr.cc (cxx_eval_call_expression): Synthesize defaulted
367 functions needed for constant evaluation.
368 (instantiate_cx_fn_r): Likewise.
370 2023-06-11 Patrick Palka <ppalka@redhat.com>
373 * pt.cc (lookup_template_class): Extend shortcut for looking up the
374 current class scope to consider outer class scopes too, and use
375 current_nonlambda_class_type instead of current_class_type. Only
376 call coerce_template_parms when specializing a primary template.
378 2023-06-10 Nathan Sidwell <nathan@acm.org>
381 * pt.cc (maybe_adjust_types_for_deduction): Implement DR976.
383 2023-06-09 Jason Merrill <jason@redhat.com>
387 * method.cc (build_comparison_op): Give retval a name.
388 * typeck.cc (check_return_expr): Fix for nameless variables.
390 2023-06-09 Jason Merrill <jason@redhat.com>
392 * parser.cc (cp_parser_simple_type_specifier): Check for auto
393 in template argument.
394 (cp_parser_template_type_arg): Remove auto checking.
396 2023-06-09 Jason Merrill <jason@redhat.com>
399 * call.cc (maybe_init_list_as_array): Check that the element type is
402 2023-06-07 Jason Merrill <jason@redhat.com>
406 * cp-tree.h (INIT_EXPR_NRV_P): New.
407 * semantics.cc (finalize_nrv_r): Check it.
408 * name-lookup.h (decl_in_scope_p): Declare.
409 * name-lookup.cc (decl_in_scope_p): New.
410 * typeck.cc (check_return_expr): Allow non-NRV
411 returns if the NRV is no longer in scope.
413 2023-06-07 Jason Merrill <jason@redhat.com>
416 * typeck.cc (want_nrvo_p): New.
417 (check_return_expr): Handle -Wnrvo.
419 2023-06-07 Jason Merrill <jason@redhat.com>
423 * decl.cc (finish_function): Simplify NRV handling.
424 * except.cc (maybe_set_retval_sentinel): Also set if NRV.
425 (maybe_splice_retval_cleanup): Don't add the cleanup region
427 * semantics.cc (nrv_data): Add simple field.
428 (finalize_nrv): Set it.
429 (finalize_nrv_r): Check it and retval sentinel.
430 * cp-tree.h (finalize_nrv): Adjust declaration.
431 * typeck.cc (check_return_expr): Remove named_labels check.
433 2023-06-07 Jason Merrill <jason@redhat.com>
436 * typeck.cc (check_return_expr): Prevent NRV in the presence of
439 2023-06-07 Jason Merrill <jason@redhat.com>
442 * except.cc (maybe_splice_retval_cleanup): Change
443 recognition of function body and try scopes.
444 * semantics.cc (do_poplevel): Call it after poplevel.
446 * cp-tree.h (maybe_splice_retval_cleanup): Adjust.
448 2023-06-07 Jason Merrill <jason@redhat.com>
450 * semantics.cc (finalize_nrv_r): [RETURN_EXPR]: Only replace the
453 2023-06-06 Kwok Cheung Yeung <kcy@codesourcery.com>
454 Tobias Burnus <tobias@codesourcery.com>
456 * parser.cc (cp_parser_omp_clause_defaultmap,
457 cp_parser_omp_clause_map): Parse 'present'.
458 (cp_parser_omp_clause_from_to): New; parse to/from
459 clauses with optional 'present' modifier.
460 (cp_parser_omp_all_clauses): Update call.
461 (cp_parser_omp_target_data, cp_parser_omp_target_enter_data,
462 cp_parser_omp_target_exit_data): Handle new enum value for
464 * semantics.cc (finish_omp_target): Likewise.
466 2023-06-04 Jason Merrill <jason@redhat.com>
469 * cp-tree.h (enum cp_tree_index): Add CPTI_CALL_TERMINATE_FN.
470 (call_terminate_fn): New macro.
471 * cp-gimplify.cc (gimplify_must_not_throw_expr): Use it.
472 * except.cc (init_exception_processing): Set it.
473 (cp_protect_cleanup_actions): Return it.
475 2023-06-03 Patrick Palka <ppalka@redhat.com>
478 * pt.cc (is_specialization_of_friend): Fix overbroad check for
479 a non-template member function of a class template.
481 2023-06-03 Patrick Palka <ppalka@redhat.com>
483 * pt.cc (iterative_hash_template_arg): Don't hash
484 TEMPLATE_TEMPLATE_PARM specially.
486 2023-06-03 Patrick Palka <ppalka@redhat.com>
488 * class.cc (build_base_path): Check in_template_context instead
489 of in_template_function.
490 (resolves_to_fixed_type_p): Likewise.
491 * cp-tree.h (in_template_context): Define.
492 (in_template_function): Remove.
493 * decl.cc (cp_make_fname_decl): Check current_function_decl
494 and in_template_context instead of in_template_function.
495 * decl2.cc (mark_used): Check in_template_context instead of
496 in_template_function.
497 * pt.cc (in_template_function): Remove.
498 * semantics.cc (enforce_access): Check in_template_context
499 instead of current_template_parms directly.
501 2023-06-03 Patrick Palka <ppalka@redhat.com>
504 * mangle.cc (write_expression): Handle NOEXCEPT_EXPR.
506 2023-06-02 Jason Merrill <jason@redhat.com>
510 * call.cc (sfk_copy_or_move): New.
511 (joust): Add tiebreaker for explicit conv and copy ctor.
513 2023-06-02 Jason Merrill <jason@redhat.com>
517 * call.cc (maybe_init_list_as_array): Set DECL_MERGEABLE.
518 (convert_like_internal) [ck_list]: Set it.
519 (set_up_extended_ref_temp): Copy it.
520 * tree.cc (handle_no_unique_addr_attribute): Set it.
522 2023-06-01 Jason Merrill <jason@redhat.com>
524 * typeck2.cc (check_narrowing): Check flag_permissive.
526 2023-05-30 Tobias Burnus <tobias@codesourcery.com>
529 * parser.cc (cp_parser_oacc_all_clauses,
530 cp_parser_omp_all_clauses): Improve error wording.
532 2023-05-19 Andrew Pinski <apinski@marvell.com>
535 * lang-specs.h ("@c++-header"): Add %w after
537 ("@c++-system-header"): Likewise.
538 ("@c++-user-header"): Likewise.
540 2023-05-19 Patrick Palka <ppalka@redhat.com>
542 * constraint.cc (normalize_concept_check): Avoid having to do
543 two norm_cache lookups. Remove unnecessary early exit for an
544 ill-formed concept definition.
546 2023-05-19 Patrick Palka <ppalka@redhat.com>
549 * pt.cc (lookup_and_finish_template_variable): Don't call
550 convert_from_reference.
551 (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Call
552 convert_from_reference on the result of
553 lookup_and_finish_template_variable.
555 2023-05-18 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
557 * call.cc (promoted_arithmetic_type_p): Use _P defines from tree.h.
558 (build_conditional_expr): Ditto.
559 (convert_like_internal): Ditto.
560 (convert_arg_to_ellipsis): Ditto.
561 (build_over_call): Ditto.
562 (compare_ics): Ditto.
563 * class.cc (is_empty_base_ref): Ditto.
564 * coroutines.cc (rewrite_param_uses): Ditto.
565 * cp-tree.h (DECL_DISCRIMINATOR_P): Ditto.
566 (ARITHMETIC_TYPE_P): Ditto.
567 * cvt.cc (ocp_convert): Ditto.
568 * cxx-pretty-print.cc (pp_cxx_template_argument_list): Ditto.
569 * decl.cc (layout_var_decl): Ditto.
570 (get_tuple_size): Ditto.
571 * error.cc (dump_simple_decl): Ditto.
572 * lambda.cc (start_lambda_scope): Ditto.
573 * mangle.cc (write_template_arg): Ditto.
574 * method.cc (spaceship_comp_cat): Ditto.
575 * module.cc (node_template_info): Ditto.
576 (trees_out::start): Ditto.
577 (trees_out::decl_node): Ditto.
578 (trees_in::read_var_def): Ditto.
579 (set_instantiating_module): Ditto.
580 * name-lookup.cc (maybe_record_mergeable_decl): Ditto.
581 (consider_decl): Ditto.
582 (maybe_add_fuzzy_decl): Ditto.
583 * pt.cc (convert_nontype_argument): Ditto.
584 * semantics.cc (handle_omp_array_sections_1): Ditto.
585 (finish_omp_clauses): Ditto.
586 (finish_omp_target_clauses_r): Ditto.
587 (is_this_parameter): Ditto.
588 * tree.cc (build_cplus_array_type): Ditto.
589 (is_this_expression): Ditto.
590 * typeck.cc (do_warn_enum_conversions): Ditto.
591 * typeck2.cc (store_init_value): Ditto.
592 (check_narrowing): Ditto.
594 2023-05-17 Jakub Jelinek <jakub@redhat.com>
597 * init.cc (build_zero_init_1): Don't initialize zero-width bitfields.
598 For unions only initialize the first FIELD_DECL.
600 2023-05-16 Marek Polacek <polacek@redhat.com>
603 * typeck.cc (check_return_expr): In a template, return only after
604 suppressing -Wdangling-reference.
606 2023-05-16 Patrick Palka <ppalka@redhat.com>
609 * call.cc (add_list_candidates): Check for invalid designated
610 initialization sooner and even for types that have a list
613 2023-05-11 Patrick Palka <ppalka@redhat.com>
616 * typeck2.cc (poison_mutable_constructors): Define.
617 (store_init_value): Use it instead of setting
618 CONSTRUCTOR_MUTABLE_POISON directly.
620 2023-05-11 Patrick Palka <ppalka@redhat.com>
621 Jonathan Wakely <jwakely@redhat.com>
626 * pt.cc (convert_nontype_argument_function): Remove linkage
627 requirement for C++17 and later.
628 (invalid_tparm_referent_p) <case ADDR_EXPR>: Restrict
629 DECL_ARTIFICIAL rejection test to VAR_DECL.
631 2023-05-10 Marek Polacek <polacek@redhat.com>
634 * method.cc (build_trait_object): New.
635 (assignable_expr): Use it.
636 (ref_xes_from_temporary): Likewise.
637 (is_convertible_helper): Likewise. Check FUNC_OR_METHOD_TYPE_P.
639 2023-05-10 Jason Merrill <jason@redhat.com>
641 * call.cc (convert_like_internal): Share ck_ref_bind handling
642 between all bad conversions.
644 2023-05-10 Jason Merrill <jason@redhat.com>
647 * constexpr.cc (cxx_eval_outermost_constant_expr): Preserve
649 (potential_constant_expression_1): Check TARGET_EXPR_ELIDING_P.
650 * typeck2.cc (store_init_value): Diagnose constinit sooner.
652 2023-05-10 Jason Merrill <jason@redhat.com>
654 * constexpr.cc (cxx_eval_outermost_constant_expr): Always check
655 for address of immediate fn.
656 (maybe_constant_init_1): Evaluate PTRMEM_CST.
658 2023-05-10 Jakub Jelinek <jakub@redhat.com>
661 * parser.cc (cp_parser_std_attribute): For unknown attributes with
662 arguments set TREE_VALUE (attribute) to error_mark_node after skipping
664 (cp_parser_std_attribute_list): If ... is used after attribute without
665 arguments, diagnose it and return error_mark_node. If
666 TREE_VALUE (attribute) is error_mark_node, don't call
667 make_pack_expansion nor return early error_mark_node.
669 2023-05-09 Patrick Palka <ppalka@redhat.com>
672 * constraint.cc (satisfaction_cache::satisfaction_cache): In the
673 unexpected case of evaluating an atom for the first time noisily,
674 remove the cache slot that we inserted.
676 2023-05-09 Patrick Palka <ppalka@redhat.com>
679 * parser.cc (cp_parser_class_specifier): Don't pass a class
680 context to noexcept_override_late_checks.
681 (noexcept_override_late_checks): Remove 'type' parameter
682 and use DECL_CONTEXT of 'fndecl' instead.
684 2023-05-09 Jakub Jelinek <jakub@redhat.com>
687 * cp-gimplify.cc (process_stmt_assume_attribute): Diagnose pack
688 expansion of assume attribute.
690 2023-05-08 Patrick Palka <ppalka@redhat.com>
694 * pt.cc (do_auto_deduction): Move up resolve_nondeduced_context
695 calls to happen before do_class_deduction. Add some
696 error_mark_node tests.
698 2023-05-07 Patrick Palka <ppalka@redhat.com>
701 * cxx-pretty-print.cc (cxx_pretty_printer::unary_expression)
702 <case ALIGNOF_EXPR>: Consider ALIGNOF_EXPR_STD_P.
703 * error.cc (dump_expr) <case ALIGNOF_EXPR>: Likewise.
705 2023-05-07 Patrick Palka <ppalka@redhat.com>
709 * decl.cc (decl_jump_unsafe): Return bool instead of int.
710 Don't consider TYPE_HAS_NONTRIVIAL_DESTRUCTOR.
711 (check_previous_goto_1): Simplify now that decl_jump_unsafe
712 returns bool instead of int.
713 (check_goto): Likewise.
715 2023-05-07 Patrick Palka <ppalka@redhat.com>
717 * pt.cc (instantiate_alias_template): Exit early upon
718 error from coerce_template_parms. Remove dependence test
719 guarding constraints_satisfied_p.
721 2023-05-07 Patrick Palka <ppalka@redhat.com>
723 * cp-tree.h (PLACEHOLDER_TYPE_CONSTRAINTS_INFO): Harden via
724 TEMPLATE_TYPE_PARM_CHECK.
725 (TPARMS_PRIMARY_TEMPLATE): Harden via TREE_VEC_CHECK.
726 (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL): Harden via
727 TEMPLATE_TEMPLATE_PARM_CHECK.
728 * cxx-pretty-print.cc (cxx_pretty_printer::simple_type_specifier):
729 Guard PLACEHOLDER_TYPE_CONSTRAINTS access.
730 * error.cc (dump_type) <case TEMPLATE_TYPE_PARM>: Use separate
731 variable to store CLASS_PLACEHOLDER_TEMPLATE result.
732 * pt.cc (outer_template_args): Use strip_innermost_template_args.
733 (any_type_dependent_arguments_p): Exit early if
734 !processing_template_decl. Use range-based for.
735 (any_dependent_template_arguments_p): Likewise.
737 2023-05-07 Patrick Palka <ppalka@redhat.com>
740 * pt.cc (tsubst_copy_and_build) <case COMPONENT_REF>: Propagate
741 REF_PARENTHESIZED_P more generally via force_paren_expr.
742 * semantics.cc (force_paren_expr): Document default argument.
744 2023-05-07 Patrick Palka <ppalka@redhat.com>
747 * pt.cc (coerce_template_args_for_ttp): Mention we can hit the
748 current_template_parms fallback when level-lowering a bound ttp.
749 (tsubst_template_decl): Add lambda_tparms parameter. Prefer to
750 use lambda_tparms instead of substituting DECL_TEMPLATE_PARMS.
751 (tsubst_decl) <case TEMPLATE_DECL>: Pass NULL_TREE as lambda_tparms
752 to tsubst_template_decl.
753 (tsubst_lambda_expr): For a generic lambda, substitute
754 DECL_TEMPLATE_PARMS and set current_template_parms to it
755 before substituting the function type. Pass the substituted
756 DECL_TEMPLATE_PARMS as lambda_tparms to tsubst_template_decl.
758 2023-05-07 Patrick Palka <ppalka@redhat.com>
761 * semantics.cc (enforce_access): Check current_template_parms
762 instead of processing_template_decl when deciding whether to
763 defer the access check.
765 2023-05-07 Patrick Palka <ppalka@redhat.com>
768 * constexpr.cc (potential_constant_expression_1) <case CALL_EXPR>:
769 Reorganize to call get_fns sooner. Remove special handling of
770 the object argument of a non-static member function call. Remove
773 2023-05-05 Jason Merrill <jason@redhat.com>
776 2023-04-27 Jason Merrill <jason@redhat.com>
779 * pt.cc (instantiate_decl): Assert !defer_ok for local
782 2023-05-03 Jason Merrill <jason@redhat.com>
786 * friend.cc (do_friend): Don't call check_explicit_specialization if
787 DECL_TEMPLATE_INFO is already set.
788 * decl2.cc (check_classfn): Set DECL_TEMPLATE_INFO.
789 * name-lookup.cc (set_decl_namespace): Likewise.
791 2023-05-03 Jakub Jelinek <jakub@redhat.com>
793 * cp-gimplify.cc (cp_fold_data): Move definition earlier.
794 (cp_gimplify_expr): Pass address of ff_genericize | ff_mce_false
795 constructed data rather than &pset to cp_walk_tree with cp_fold_r.
797 2023-05-03 Jason Merrill <jason@redhat.com>
799 * pt.cc (reduce_template_parm_level): Fix comparison of
800 template template parm to cached version.
802 2023-05-02 Jason Merrill <jason@redhat.com>
804 * pt.cc (instantiate_class_template): Skip the RECORD_TYPE
806 (tsubst_template_decl): Clear CLASSTYPE_USE_TEMPLATE.
808 2023-05-02 Jason Merrill <jason@redhat.com>
810 * name-lookup.cc (pop_from_top_level): Don't
811 invalidate_class_lookup_cache.
813 2023-05-02 Jason Merrill <jason@redhat.com>
816 * cp-tree.h (lookup_base): Add offset parm.
817 * constexpr.cc (cxx_fold_indirect_ref_1): Pass it.
818 * search.cc (struct lookup_base_data_s): Add offset.
819 (dfs_lookup_base): Handle it.
820 (lookup_base): Pass it.
822 2023-05-02 Jason Merrill <jason@redhat.com>
825 * constexpr.cc (cxx_fold_indirect_ref_1): Handle empty base first.
827 2023-05-01 Jason Merrill <jason@redhat.com>
830 * name-lookup.cc (maybe_push_to_top_level)
831 (maybe_pop_from_top_level): Split out...
832 * pt.cc (instantiate_body): ...from here.
833 * init.cc (maybe_instantiate_nsdmi_init): Use them.
834 * name-lookup.h: Declare them..
836 2023-04-28 Eugene Rozenfeld <erozen@microsoft.com>
838 * Make-lang.in: Merge perf data collected when compiling cc1plus and runtime libraries
840 2023-04-27 Jason Merrill <jason@redhat.com>
842 * call.cc (print_conversion_rejection): Use iloc_sentinel.
844 2023-04-27 Jason Merrill <jason@redhat.com>
847 * pt.cc (instantiate_decl): Assert !defer_ok for local
850 2023-04-26 Jason Merrill <jason@redhat.com>
852 * init.cc (nsdmi_inst): Remove.
853 (maybe_instantiate_nsdmi_init): Use DECL_INITIAL instead.
855 2023-04-26 Jason Merrill <jason@redhat.com>
858 * pt.cc (instantiate_class_template): Do partially instantiate.
859 (tsubst_expr): Do call complete_type for partial instantiations.
861 2023-04-26 Jason Merrill <jason@redhat.com>
864 * pt.cc (regenerate_decl_from_template): Skip unique friends.
866 2023-04-26 Patrick Palka <ppalka@redhat.com>
868 * pt.cc (most_specialized_partial_spec): Exit early when
869 DECL_TEMPLATE_SPECIALIZATIONS is empty. Move local variable
870 declarations closer to their first use. Remove redundant
871 flag_concepts test. Remove redundant forward declaration.
873 2023-04-25 Patrick Palka <ppalka@redhat.com>
876 * pt.cc (value_dependent_expression_p) <case VAR_DECL>:
877 Suppress conservative early exit for reference variables
878 when DECL_HAS_VALUE_EXPR_P.
880 2023-04-25 Tobias Burnus <tobias@codesourcery.com>
882 * parser.cc (cp_parser_omp_scan_loop_body): Handle
883 zero exec statements before/after 'omp scan'.
885 2023-04-24 Patrick Palka <ppalka@redhat.com>
887 * cp-tree.h (cp_expr_location): Define here.
888 * tree.cc (cp_expr_location): Don't define here.
890 2023-04-21 Jason Merrill <jason@redhat.com>
893 * decl.cc (grokdeclarator): Don't clear typedef_decl after 'unsigned
894 typedef' pedwarn. Use c_common_signed_or_unsigned_type. Also
895 handle 'signed typedef'.
897 2023-04-21 Patrick Palka <ppalka@redhat.com>
899 * tree.cc (cp_walk_subtrees): Avoid repeatedly dereferencing tp.
900 <case DECLTYPE_TYPE>: Use cp_unevaluated and WALK_SUBTREE.
901 <case ALIGNOF_EXPR etc>: Likewise.
903 2023-04-20 Patrick Palka <ppalka@redhat.com>
905 * pt.cc (tsubst) <case TEMPLATE_TYPE_PARM>: Don't recurse when
906 level lowering a cv-qualified type template parameter. Remove
907 recursive loop breaker in the level lowering case for constrained
908 autos. Use the TEMPLATE_PARM_DESCENDANTS cache in this case as
911 2023-04-20 Patrick Palka <ppalka@redhat.com>
913 * constraint.cc (diagnose_trait_expr): Convert a TREE_VEC
914 of arguments into a TREE_LIST for sake of pretty printing.
915 * cxx-pretty-print.cc (pp_cxx_trait): Handle TREE_VEC
916 instead of TREE_LIST of trailing variadic trait arguments.
917 * method.cc (constructible_expr): Likewise.
918 (is_xible_helper): Likewise.
919 * parser.cc (cp_parser_trait): Represent trailing variadic trait
920 arguments as a TREE_VEC instead of TREE_LIST.
921 * pt.cc (value_dependent_expression_p): Handle TREE_VEC
922 instead of TREE_LIST of trailing variadic trait arguments.
923 * semantics.cc (finish_type_pack_element): Likewise.
924 (check_trait_type): Likewise.
926 2023-04-20 Patrick Palka <ppalka@redhat.com>
928 * tree.cc (strip_typedefs): Move TREE_LIST handling to
929 strip_typedefs_expr. Dispatch to strip_typedefs_expr for
931 <case TYPENAME_TYPE>: Remove manual dispatching to
933 <case TRAIT_TYPE>: Likewise.
934 (strip_typedefs_expr): Replaces calls to strip_typedefs_expr
935 with strip_typedefs throughout. Don't dispatch to strip_typedefs
937 <case TREE_LIST>: Replace this with the better version from
940 2023-04-19 Patrick Palka <ppalka@redhat.com>
941 Jonathan Wakely <jwakely@redhat.com>
944 * cp-trait.def (TYPE_PACK_ELEMENT): Define.
945 * cp-tree.h (finish_trait_type): Add complain parameter.
946 * cxx-pretty-print.cc (pp_cxx_trait): Handle
947 CPTK_TYPE_PACK_ELEMENT.
948 * parser.cc (cp_parser_constant_expression): Document default
950 (cp_parser_trait): Handle CPTK_TYPE_PACK_ELEMENT. Pass
951 tf_warning_or_error to finish_trait_type.
952 * pt.cc (tsubst) <case TRAIT_TYPE>: Handle non-type first
953 argument. Pass complain to finish_trait_type.
954 * semantics.cc (finish_type_pack_element): Define.
955 (finish_trait_type): Add complain parameter. Handle
956 CPTK_TYPE_PACK_ELEMENT.
957 * tree.cc (strip_typedefs): Handle non-type first argument.
958 Pass tf_warning_or_error to finish_trait_type.
959 * typeck.cc (structural_comptypes) <case TRAIT_TYPE>: Use
960 cp_tree_equal instead of same_type_p for the first argument.
962 2023-04-19 Patrick Palka <ppalka@redhat.com>
965 * pt.cc (try_class_unification): Don't ggc_free the copy of
968 2023-04-19 Jason Merrill <jason@redhat.com>
971 * decl.cc (grokdeclarator): Keep typedef_decl for __int128_t.
973 2023-04-17 Patrick Palka <ppalka@redhat.com>
976 * pt.cc (tsubst) <case BOUND_TEMPLATE_TEMPLATE_PARM>:
977 In the level-lowering case just use lookup_template_class
978 to rebuild the bound ttp.
980 2023-04-15 Jason Merrill <jason@redhat.com>
983 * constexpr.cc (cxx_eval_constant_expression) [TARGET_EXPR]:
984 Check for complex initializer.
986 2023-04-13 Patrick Palka <ppalka@redhat.com>
989 * decl.cc (make_typename_type): Also ignore non-types during the
990 lookup if tag_type corresponds to an elaborated-type-specifier.
991 * pt.cc (tsubst) <case TYPENAME_TYPE>: Pass class_type or
992 enum_type as tag_type to make_typename_type accordingly instead
993 of always passing typename_type.
995 2023-04-13 Jason Merrill <jason@redhat.com>
998 * semantics.cc (check_trait_type): Handle incomplete type directly.
999 * typeck2.cc (cxx_incomplete_type_diagnostic): Remove assert.
1001 2023-04-13 Jason Merrill <jason@redhat.com>
1003 * typeck2.cc (cxx_incomplete_type_diagnostic): Return bool.
1004 * cp-tree.h (cxx_incomplete_type_diagnostic): Adjust.
1006 2023-04-12 Jakub Jelinek <jakub@redhat.com>
1008 * Make-lang.in (s-cp-module-version): New target.
1009 (cp/module.o): Depend on it.
1010 (MODULE_VERSION): Remove variable.
1011 (CFLAGS-cp/module.o): For -DMODULE_VERSION= argument just
1012 cat s-cp-module-version.
1014 2023-04-09 Iain Sandoe <iain@sandoe.co.uk>
1016 * coroutines.cc (coro_rewrite_function_body): Ensure that added
1017 bind expressions have scope blocks.
1019 2023-04-04 Jason Merrill <jason@redhat.com>
1022 * decl2.cc (find_last_decl): Return early if DECL_USE_TEMPLATE.
1024 2023-04-03 Patrick Palka <ppalka@redhat.com>
1027 * decl.cc (cp_finish_decl): Diagnose ordinary auto deduction
1028 with no initializer, instead of asserting.
1030 2023-04-01 Patrick Palka <ppalka@redhat.com>
1033 * cp-tree.h (do_auto_deduction): Add defaulted tmpl parameter.
1034 * pt.cc (convert_template_argument): Pass 'in_decl' as 'tmpl' to
1036 (tsubst_decl) <case VAR_/TYPE_DECL>: Pass 'tmpl' instead of 't' as
1037 'in_decl' to coerce_template_parms.
1038 (unify) <case TEMPLATE_PARM_INDEX>: Pass TPARMS_PRIMARY_TEMPLATE
1039 as 'tmpl' to do_auto_deduction.
1040 (do_auto_deduction): Document default arguments. Rename local
1041 variable 'tmpl' to 'ctmpl'. Use 'tmpl' to obtain a full set of
1042 template arguments for satisfaction in the adc_unify case.
1044 2023-04-01 Patrick Palka <ppalka@redhat.com>
1048 * pt.cc (invalid_tparm_referent_p): Accept ADDR_EXPR of
1050 (instantiate_class_template): Call mark_template_arguments_used.
1051 (tsubst_copy_and_build) <case CALL_EXPR>: Revert r13-995 change.
1052 (mark_template_arguments_used): Define.
1053 (instantiate_body): Call mark_template_arguments_used.
1055 2023-04-01 Iain Sandoe <iain@sandoe.co.uk>
1058 * coroutines.cc (flatten_await_stmt): Use the current count of
1059 promoted temporaries to build a unique name for the frame entries.
1061 2023-03-30 Jason Merrill <jason@redhat.com>
1064 * search.cc (type_context_for_name_lookup): New.
1065 (accessible_p): Handle anonymous union.
1066 * init.cc (maybe_instantiate_nsdmi_init): Use
1067 type_context_for_name_lookup.
1068 * parser.cc (cp_parser_class_specifier): Likewise.
1069 * cp-tree.h (type_context_for_name_lookup): Declare.
1071 2023-03-30 Jason Merrill <jason@redhat.com>
1074 * pt.cc (unify) [FUNCTION_TYPE]: Handle function pointer
1077 2023-03-30 Jakub Jelinek <jakub@redhat.com>
1080 * decl2.cc (grok_array_decl): After emitting a pedwarn for
1081 -Wcomma-subscript, if processing_template_decl set orig_index_exp
1082 to compound expr from orig_index_exp_list.
1084 2023-03-30 Jason Merrill <jason@redhat.com>
1088 * decl2.cc (record_mangling): Use symtab_node::reset.
1090 2023-03-30 Jakub Jelinek <jakub@redhat.com>
1093 * call.cc (convert_like_internal): If pedwarn for extended float
1094 type conversions doesn't report anything, avoid calling
1095 maybe_inform_about_fndecl_for_bogus_argument_init.
1097 2023-03-29 Jason Merrill <jason@redhat.com>
1101 * pt.cc (alias_ctad_tweaks): Rewrite deduced args.
1102 (type_targs_deducible_from): Handle null pack deduction.
1104 2023-03-28 David Malcolm <dmalcolm@redhat.com>
1107 * parser.cc (cp_parser_binary_expression): Update for new param of
1108 check_for_xor_used_as_pow.
1110 2023-03-28 Jakub Jelinek <jakub@redhat.com>
1113 * contracts.cc: Include intl.h.
1114 (check_postcondition_result): Don't form diagnostics from two halves
1115 of an English message to allow translations.
1117 2023-03-24 Patrick Palka <ppalka@redhat.com>
1120 * parser.cc (cp_parser_class_specifier): Clear current_class_ptr
1121 and current_class_ref sooner, before parsing a class definition.
1123 2023-03-24 Jason Merrill <jason@redhat.com>
1126 * pt.cc (type_unification_real): Adjust for partial ordering.
1128 2023-03-23 Jason Merrill <jason@redhat.com>
1131 * typeck.cc (build_ptrmemfunc): Drop 0-offset optimization
1132 and location wrappers.
1134 2023-03-23 Marek Polacek <polacek@redhat.com>
1137 * call.cc (class_has_reference_member_p): New.
1138 (class_has_reference_member_p_r): New.
1139 (reference_like_class_p): Don't look for a specific constructor.
1140 Use a DFS walk with class_has_reference_member_p_r.
1142 2023-03-23 Jason Merrill <jason@redhat.com>
1145 * pt.cc (find_parameter_packs_r): Handle null TREE_BINFO.
1147 2023-03-22 Jason Merrill <jason@redhat.com>
1150 * pt.cc (unify): Use fold of build_nop instead of fold_convert.
1152 2023-03-22 Jason Merrill <jason@redhat.com>
1155 * semantics.cc (finish_id_expression_1): Check scope before
1156 returning id_expression.
1158 2023-03-22 Alex Coplan <alex.coplan@arm.com>
1161 * call.cc (build_over_call): Use make_temp_override to suppress
1162 both unavailable and deprecated warnings when calling
1165 2023-03-21 Jason Merrill <jason@redhat.com>
1168 * init.cc (maybe_instantiate_nsdmi_init): Don't leave
1169 current_function_decl set to a constructor.
1171 2023-03-20 Marek Polacek <polacek@redhat.com>
1174 * call.cc (add_template_candidate_real): Add explicit decls to the
1175 set of candidates when the initializer is a braced-init-list.
1177 2023-03-20 Jakub Jelinek <jakub@redhat.com>
1180 * cp-tree.h (var_needs_tls_wrapper): Declare.
1181 * decl2.cc (var_needs_tls_wrapper): No longer static.
1182 * decl.cc (cp_finish_decl): Clear TREE_READONLY on TLS variables
1183 for which a TLS wrapper will be needed.
1185 2023-03-17 Jason Merrill <jason@redhat.com>
1188 * lambda.cc (prune_lambda_captures): Don't bother in a template.
1190 2023-03-17 Jason Merrill <jason@redhat.com>
1193 * except.cc (build_throw): Check dtor access.
1195 2023-03-17 Jason Merrill <jason@redhat.com>
1198 * friend.cc (do_friend): Handle namespace as scope argument.
1199 * decl.cc (grokdeclarator): Pass down in_namespace.
1201 2023-03-16 Jason Merrill <jason@redhat.com>
1204 * init.cc (get_nsdmi): Split out...
1205 (maybe_instantiate_nsdmi_init): ...this function.
1206 * cp-tree.h: Declare it.
1207 * pt.cc (tsubst_expr): Use it.
1209 2023-03-16 Jason Merrill <jason@redhat.com>
1212 * pt.cc (tsubst_expr) [TAG_DEFN]: Handle partial instantiation.
1214 2023-03-16 Jason Merrill <jason@redhat.com>
1217 * semantics.cc (finish_qualified_id_expr): Don't try to build a
1218 pointer-to-member if the scope is an enumeration.
1220 2023-03-16 Patrick Palka <ppalka@redhat.com>
1223 * constexpr.cc (maybe_constant_init_1): For an unevaluated
1224 non-manifestly-constant operand, don't constant evaluate
1225 and instead call fold_to_constant as in maybe_constant_value.
1227 2023-03-16 Patrick Palka <ppalka@redhat.com>
1230 * constraint.cc (satisfaction_cache::get): Relax overly strict
1231 checking assert in the constraint recursion case.
1233 2023-03-16 Jason Merrill <jason@redhat.com>
1236 * coroutines.cc (build_co_await): Handle lvalue 'o'.
1238 2023-03-15 Jason Merrill <jason@redhat.com>
1242 * typeck.cc (cp_build_modify_expr): Allow array initialization of
1243 DECL_ARTIFICIAL variable.
1245 2023-03-15 Marek Polacek <polacek@redhat.com>
1248 * constexpr.cc (cxx_eval_store_expression): Strip location wrappers.
1250 2023-03-15 Jason Merrill <jason@redhat.com>
1253 * semantics.cc (check_template_template_default_arg): Check
1254 maybe_get_template_decl_from_type_decl.
1256 2023-03-15 Jason Merrill <jason@redhat.com>
1261 * pt.cc (coerce_template_template_parms): Use args from
1262 DECL_CONTEXT (arg_tmpl) instead of outer_args.
1264 2023-03-15 Jason Merrill <jason@redhat.com>
1267 * pt.cc (coerce_template_template_parms): Take the arg and parm
1269 (coerce_template_template_parm): Adjust.
1270 (template_template_parm_bindings_ok_p): Adjust.
1271 (convert_template_argument): Adjust.
1273 2023-03-14 Patrick Palka <ppalka@redhat.com>
1276 * pt.cc (push_inline_template_parms_recursive): Set
1277 TEMPLATE_PARMS_CONSTRAINTS.
1278 (push_template_decl): For an out-of-line declaration, verify
1279 constraints for each enclosing template scope match those of the
1280 original template declaratation.
1282 2023-03-14 Patrick Palka <ppalka@redhat.com>
1285 * pt.cc (redeclare_class_template): Add missing "of" in
1286 constraint mismatch diagnostic.
1287 (tsubst_friend_class): For an already declared class template,
1288 substitute and pass the friend declaration's constraints to
1289 redeclare_class_template instead of passing the existing
1290 template's constraints.
1292 2023-03-14 Jason Merrill <jason@redhat.com>
1295 * pt.cc (unify_pack_expansion): Check that TPARMS_PRIMARY_TEMPLATE
1298 2023-03-14 Jason Merrill <jason@redhat.com>
1301 * cp-gimplify.cc (genericize_if_stmt): Restore folding
1302 of constant conditions.
1304 2023-03-14 Jakub Jelinek <jakub@redhat.com>
1307 * tree.cc (record_has_unique_obj_representations): Ignore unnamed
1310 2023-03-13 Jason Merrill <jason@redhat.com>
1313 * parser.cc (cp_parser_set_decl_spec_type): Use
1314 redefined_builtin_type for extended_float_type_p.
1316 2023-03-13 Marek Polacek <polacek@redhat.com>
1319 * call.cc (reference_like_class_p): Check for std::span.
1321 2023-03-10 Jakub Jelinek <jakub@redhat.com>
1324 * decl.cc (cp_finish_decl): Don't clear TREE_READONLY on
1325 automatic non-aggregate variables just because of
1326 -fmerge-all-constants.
1328 2023-03-10 Jakub Jelinek <jakub@redhat.com>
1331 * class.cc (end_of_class): For bit-fields, instead of computing
1332 offset as sum of byte_position (field) and DECL_SIZE_UNIT (field),
1333 compute it as sum of bit_position (field) and DECL_SIZE (field)
1334 divided by BITS_PER_UNIT rounded up.
1336 2023-03-10 Jason Merrill <jason@redhat.com>
1339 * lambda.cc (compare_lambda_template_head): Check more
1340 for error_mark_node.
1342 2023-03-10 Jason Merrill <jason@redhat.com>
1345 * mangle.cc (anon_aggr_naming_decl): New.
1346 (write_unqualified_name): Use it.
1348 2023-03-10 Jakub Jelinek <jakub@redhat.com>
1351 * decl.cc (poplevel): Suppress OPT_Wunused_variable warning
1352 after diagnosing it.
1354 2023-03-10 Jason Merrill <jason@redhat.com>
1357 * decl.cc (grokdeclarator): Handle non-typedef typedef_decl.
1359 2023-03-10 Jason Merrill <jason@redhat.com>
1362 * class.cc (instantiate_type): Strip location wrapper.
1364 2023-03-09 Jason Merrill <jason@redhat.com>
1367 * init.cc (find_allocator_temps_r): New.
1368 (combine_allocator_temps): Replace find_allocator_temp.
1369 (build_vec_init): Adjust.
1371 2023-03-09 Jason Merrill <jason@redhat.com>
1375 * pt.cc (alias_ctad_tweaks): Continue after deduction failure.
1377 2023-03-09 Jason Merrill <jason@redhat.com>
1378 Michael Spertus <mike@spertus.com>
1381 * pt.cc (corresponding_template_parameter_list): Split out...
1382 (corresponding_template_parameter): ...from here.
1383 (find_template_parameters): Factor out...
1384 (find_template_parameter_info::find_in): ...this function.
1385 (find_template_parameter_info::find_in_recursive): New.
1386 (find_template_parameter_info::found): New.
1387 (alias_ctad_tweaks): Only add parms used in the deduced args.
1389 2023-03-09 Jason Merrill <jason@redhat.com>
1391 * cp-trait.def (IS_DEDUCIBLE): Add space to name.
1393 2023-03-09 Jason Merrill <jason@redhat.com>
1396 * cp-trait.def (IS_DEDUCIBLE): New.
1397 * cxx-pretty-print.cc (pp_cxx_trait): Handle non-type.
1398 * parser.cc (cp_parser_trait): Likewise.
1399 * tree.cc (cp_tree_equal): Likewise.
1400 * pt.cc (tsubst_copy_and_build): Likewise.
1401 (type_targs_deducible_from): New.
1402 (alias_ctad_tweaks): Use it.
1403 * semantics.cc (trait_expr_value): Handle CPTK_IS_DEDUCIBLE.
1404 (finish_trait_expr): Likewise.
1405 * constraint.cc (diagnose_trait_expr): Likewise.
1406 * cp-tree.h (type_targs_deducible_from): Declare.
1408 2023-03-07 Jason Merrill <jason@redhat.com>
1412 * pt.cc (tsubst_function_decl): Don't replace the closure
1413 parameter if DECL_STATIC_FUNCTION_P.
1415 2023-03-07 Marek Polacek <polacek@redhat.com>
1418 * call.cc (reference_like_class_p): New.
1419 (do_warn_dangling_reference): Add new bool parameter. See through
1420 reference_like_class_p.
1422 2023-03-07 Jakub Jelinek <jakub@redhat.com>
1425 * rtti.cc (emit_support_tinfo_1): Don't assert that last
1426 unemitted_tinfo_decls element is tinfo, instead pop from it only in
1428 * decl2.cc (c_parse_final_cleanups): Don't call emit_tinfo_decl
1429 for unemitted_tinfO_decls which have already non-NULL DECL_INITIAL.
1431 2023-03-07 Marek Polacek <polacek@redhat.com>
1434 * constexpr.cc (cxx_eval_call_expression): Relax assert.
1436 2023-03-07 Marek Polacek <polacek@redhat.com>
1439 * constexpr.cc (potential_constant_expression_1) <case CALL_EXPR>: Pass
1440 'any' when recursing on a VAR_DECL and not a pointer to function.
1442 2023-03-04 Jakub Jelinek <jakub@redhat.com>
1445 * constexpr.cc: Include toplev.h.
1446 (cxx_eval_constant_expression) <case DECL_EXPR>: When seeing a local
1447 static initialized by constant expression outside of a constexpr
1448 function which has been deferred by make_rtl_for_nonlocal_decl,
1449 call rest_of_decl_compilation on it.
1451 2023-03-03 Patrick Palka <ppalka@redhat.com>
1454 * pt.cc (el_data::skipped_trees): New data member.
1455 (extract_locals_r): Push to skipped_trees any unevaluated
1456 contexts that we skipped over.
1457 (extract_local_specs): For the second walk, start from each
1458 tree in skipped_trees.
1460 2023-03-03 Alexandre Oliva <oliva@adacore.com>
1462 * typeck.cc (cp_build_binary_op): Suppress redundant warning
1463 for pfn null test in pmfn test with vbit-in-delta.
1465 2023-03-02 Jakub Jelinek <jakub@redhat.com>
1468 * cp-tree.h (enum cp_tree_index): Remove CPTI_FALLBACK_DFLOAT*_TYPE
1470 (fallback_dfloat32_type, fallback_dfloat64_type,
1471 fallback_dfloat128_type): Remove.
1472 * rtti.cc (emit_support_tinfo_1): If not emitted already, call
1473 emit_tinfo_decl and remove from unemitted_tinfo_decls right away.
1474 (emit_support_tinfos): Move &dfloat*_type_node from fundamentals array
1475 into new fundamentals_with_fallback array. Call emit_support_tinfo_1
1476 on elements of that array too, with the difference that if
1477 the type is NULL, use a fallback REAL_TYPE for it temporarily.
1478 Drop the !targetm.decimal_float_supported_p () handling. Call
1479 targetm.emit_support_tinfos at the end.
1480 * mangle.cc (write_builtin_type): Remove references to
1481 fallback_dfloat*_type. Handle bfloat16_type_node mangling.
1483 2023-03-02 Patrick Palka <ppalka@redhat.com>
1487 * cp-gimplify.cc (cp_fully_fold): Add an internal overload that
1488 additionally takes and propagate an mce_value parameter, and
1489 define the existing public overload in terms of it.
1490 (cp_fully_fold_init): Pass mce_false to cp_fully_fold.
1492 2023-03-02 Patrick Palka <ppalka@redhat.com>
1495 * constexpr.cc (maybe_constant_init_1): Override
1496 manifestly_const_eval to true if is_static.
1498 2023-03-02 Jakub Jelinek <jakub@redhat.com>
1501 * cp-gimplify.cc (cp_genericize_r) <case USING_STMT>: Set
1502 DECL_SOURCE_LOCATION on IMPORTED_DECL to expression location
1503 of USING_STMT or input_location.
1505 2023-03-02 Marek Polacek <polacek@redhat.com>
1508 * parser.cc (class_decl_loc_t::diag_mismatched_tags): If the first
1509 lookup of SPEC didn't find anything, try to look for
1510 most_general_template.
1512 2023-03-02 Jakub Jelinek <jakub@redhat.com>
1515 * parser.cc (cp_convert_omp_range_for): Allow in assert
1516 decomp_first_name without DECL_HAS_VALUE_EXPR_P if it has
1517 error_mark_node type.
1518 (cp_finish_omp_range_for): Don't set DECL_HAS_VALUE_EXPR_P back
1519 on decls which have error_mark_node type.
1521 2023-03-01 Marek Polacek <polacek@redhat.com>
1524 * constexpr.cc (cxx_eval_constant_expression): Emit an error when
1525 a PTRMEM_CST cannot be evaluated.
1527 2023-03-01 Patrick Palka <ppalka@redhat.com>
1529 * pt.cc (tsubst_scope): Define.
1530 (tsubst_decl) <case USING_DECL>: Call tsubst_scope instead of
1531 calling tsubst_scope with tf_qualifying_scope set.
1532 (tsubst_qualified_id): Call tsubst_scope instead of
1533 calling tsubst with tf_qualifying_scope set.
1534 (tsubst_copy): Immediately delegate to tsubst for all TYPE_P
1535 trees. Remove tf_qualifying_scope manipulation.
1536 <case SCOPE_REF>: Call tsubst_scope instead of calling
1537 tsubst with tf_qualifying_scope set.
1539 2023-03-01 Patrick Palka <ppalka@redhat.com>
1540 Jason Merrill <jason@redhat.com>
1544 * constexpr.cc (fold_to_constant): Define.
1545 (maybe_constant_value): Move up early exit test for unevaluated
1546 operands. Try reducing an unevaluated operand to a constant via
1548 (fold_non_dependent_expr_template): Add early exit test for
1549 CONSTANT_CLASS_P nodes. Try reducing an unevaluated operand
1550 to a constant via fold_to_constant.
1551 * cp-tree.h (fold_to_constant): Declare.
1553 2023-03-01 Jakub Jelinek <jakub@redhat.com>
1556 * constexpr.cc (potential_constant_expression_1) <case DECL_EXPR>:
1557 Only recurse on DECL_INITIAL (tmp) if tmp is a VAR_DECL, otherwise
1560 2023-02-28 Patrick Palka <ppalka@redhat.com>
1563 * pt.cc (finish_template_variable): Move dependence check
1565 (lookup_and_finish_template_variable): ... here.
1566 * semantics.cc (finish_id_expression_1): Call
1567 finish_template_variable sooner, before (and regardless of) the
1568 type_dependent_expression_p test.
1570 2023-02-28 Marek Polacek <polacek@redhat.com>
1573 * pt.cc (lookup_and_finish_template_variable): Clear tf_partial.
1575 2023-02-20 Marek Polacek <polacek@redhat.com>
1578 * constexpr.cc (cxx_eval_call_expression): Replace shortcutting trivial
1579 constructor/op= with a checking assert.
1581 2023-02-20 Marek Polacek <polacek@redhat.com>
1584 * pt.cc (prepend_one_capture): Set LAMBDA_CAPTURE_EXPLICIT_P.
1585 (tsubst_lambda_expr): Pass LAMBDA_CAPTURE_EXPLICIT_P to
1586 prepend_one_capture.
1588 2023-02-18 Jason Merrill <jason@redhat.com>
1598 * semantics.cc (finish_static_assert): Don't diagnose in
1601 2023-02-17 Patrick Palka <ppalka@redhat.com>
1605 * cp-gimplify.cc (enum fold_flags): Define.
1606 (fold_flags_t): Declare.
1607 (cp_fold_data::genericize): Replace this data member with ...
1608 (cp_fold_data::fold_flags): ... this.
1609 (cp_fold_r): Adjust use of cp_fold_data and calls to cp_fold.
1610 (cp_fold_function): Likewise.
1611 (cp_fold_maybe_rvalue): Add an internal overload that
1612 additionally takes and propagates a fold_flags_t parameter, and
1613 define the existing public overload in terms of it.
1614 (cp_fold_rvalue): Likewise.
1615 (cp_fully_fold_init): Adjust use of cp_fold_data.
1616 (fold_cache): Replace with ...
1617 (fold_caches): ... this 2-element array of caches.
1618 (get_fold_cache): Define.
1619 (clear_fold_cache): Adjust.
1620 (cp_fold): Add fold_flags_t parameter. Use get_fold_cache.
1621 Pass flags to calls to cp_fold, cp_fold_rvalue and
1622 cp_fold_maybe_rvalue.
1623 <case CALL_EXPR>: If ff_mce_false is set, fold
1624 __builtin_is_constant_evaluated to false and pass mce_false to
1625 maybe_constant_value.
1627 2023-02-17 Patrick Palka <ppalka@redhat.com>
1629 * constexpr.cc (constexpr_call::manifestly_const_eval): Give
1630 it type int instead of bool.
1631 (constexpr_ctx::manifestly_const_eval): Give it type mce_value
1633 (cxx_eval_builtin_function_call): Adjust after making
1634 manifestly_const_eval tri-state.
1635 (cxx_eval_call_expression): Likewise.
1636 (cxx_eval_binary_expression): Likewise.
1637 (cxx_eval_conditional_expression): Likewise.
1638 (cxx_eval_constant_expression): Likewise.
1639 (cxx_eval_outermost_constant_expr): Likewise.
1640 (cxx_constant_value): Likewise.
1641 (cxx_constant_dtor): Likewise.
1642 (maybe_constant_value): Give manifestly_const_eval parameter
1643 type mce_value instead of bool and adjust accordingly.
1644 (fold_non_dependent_expr_template): Adjust call
1645 to cxx_eval_outermost_constant_expr.
1646 (fold_non_dependent_expr): Likewise.
1647 (maybe_constant_init_1): Likewise.
1648 * constraint.cc (satisfy_atom): Adjust call to
1649 maybe_constant_value.
1650 * cp-tree.h (enum class mce_value): Define.
1651 (maybe_constant_value): Adjust manifestly_const_eval parameter
1652 type and default argument.
1653 * decl.cc (compute_array_index_type_loc): Adjust call to
1654 maybe_constant_value.
1655 * pt.cc (convert_nontype_argument): Likewise.
1657 2023-02-16 Patrick Palka <ppalka@redhat.com>
1660 * cp-tree.h (enum tsubst_flags): New flag tf_qualifying_scope.
1661 * decl.cc (make_typename_type): Use lookup_member instead of
1662 lookup_field. If tf_qualifying_scope is set, pass want_type=true
1663 instead of =false to lookup_member. Generalize format specifier
1664 in diagnostic to handle both type and non-type bindings.
1665 * pt.cc (tsubst_aggr_type_1): Clear tf_qualifying_scope. Tidy
1667 (tsubst_decl) <case USING_DECL>: Set tf_qualifying_scope when
1668 substituting USING_DECL_SCOPE.
1669 (tsubst): Clear tf_qualifying_scope right away and remember if
1670 it was set. Do the same for tf_tst_ok sooner.
1671 <case TYPENAME_TYPE>: Set tf_qualifying_scope when substituting
1672 TYPE_CONTEXT. Pass tf_qualifying_scope to make_typename_type
1674 (tsubst_qualified_id): Set tf_qualifying_scope when substituting
1676 (tsubst_copy): Clear tf_qualifying_scope and remember if it was
1678 <case SCOPE_REF>: Set tf_qualifying_scope when substituting the
1680 <case *_TYPE>: Pass tf_qualifying_scope to tsubst if it was set.
1681 * search.cc (lookup_member): Document default argument.
1683 2023-02-16 Patrick Palka <ppalka@redhat.com>
1685 * cp-tree.h: Mechanically drop static from static inline
1686 functions via s/^static inline/inline/g.
1688 2023-02-15 Marek Polacek <polacek@redhat.com>
1691 * call.cc (joust_maybe_elide_copy): Return false for ck_ambig.
1693 2023-02-10 Marek Polacek <polacek@redhat.com>
1696 * call.cc (set_up_extended_ref_temp): Pass var to maybe_constant_init.
1698 2023-02-09 Tobias Burnus <tobias@codesourcery.com>
1700 * parser.cc (cp_parser_omp_allocate): Parse align
1701 clause and check for restrictions.
1703 2023-02-09 Jakub Jelinek <jakub@redhat.com>
1706 * mangle.cc (write_expression, write_template_arg): Handle
1707 EXCESS_PRECISION_EXPR with REAL_CST operand as
1708 write_template_arg_literal on fold_convert of the REAL_CST
1709 to EXCESS_PRECISION_EXPR type.
1711 2023-02-06 Patrick Palka <ppalka@redhat.com>
1714 * cp-tree.h (call_expr_dependent_name): Declare.
1715 * pt.cc (iterative_hash_template_arg) <case CALL_EXPR>: Use
1716 call_expr_dependent_name instead of dependent_name.
1717 * tree.cc (call_expr_dependent_name): Define.
1718 (called_fns_equal): Adjust to take two CALL_EXPRs instead of
1719 CALL_EXPR_FNs thereof. Use call_expr_dependent_name instead
1721 (cp_tree_equal) <case CALL_EXPR>: Adjust call to called_fns_equal.
1723 2023-02-03 Marek Polacek <polacek@redhat.com>
1726 * constexpr.cc (cxx_eval_array_reference): Don't replace
1729 2023-02-03 Patrick Palka <ppalka@redhat.com>
1732 * semantics.cc (finish_call_expr): Strip ADDR_EXPR from
1733 the selected callee during overload set pruning.
1735 2023-02-03 Patrick Palka <ppalka@redhat.com>
1738 * class.cc (check_methods): Diagnose an unviable OVERLOAD
1739 set for CLASSTYPE_DESTRUCTOR differently from an ambiguous one.
1740 Then prune the OVERLOAD to a single function.
1741 (check_bases_and_members): Handle CLASSTYPE_DESTRUCTOR being
1742 an OVERLOAD when calling deduce_noexcept_on_destructor.
1743 Document why it has to be called before check_methods.
1745 2023-02-03 Patrick Palka <ppalka@redhat.com>
1748 * class.cc (check_methods): Swap order of constraints_satisfied_p
1749 and copy/move_fn_p tests.
1751 2023-02-01 Marek Polacek <polacek@redhat.com>
1754 * call.cc (build_new_op): Don't call warn_logical_operator when
1755 processing a template.
1757 2023-02-01 Jakub Jelinek <jakub@redhat.com>
1760 * constexpr.cc (cxx_eval_constant_expression): Handle OMP_*
1761 and OACC_* constructs as non-constant.
1762 (potential_constant_expression_1): Handle OMP_SCAN and OMP_SCOPE.
1764 2023-02-01 Jason Merrill <jason@redhat.com>
1766 * class.cc (note_name_declared_in_class): Change from permerror to
1767 -Wchanges-meaning pedwarn, forcing -pedantic-errors for most cases.
1769 2023-01-31 Jason Merrill <jason@redhat.com>
1772 * cp-gimplify.cc (any_non_eliding_target_exprs): New.
1773 (cp_genericize_init): Check it.
1775 2023-01-31 Marek Polacek <polacek@redhat.com>
1779 * cp-tree.h (instantiation_dependent_expression_p): Don't
1782 2023-01-26 Marek Polacek <polacek@redhat.com>
1785 * parser.cc: Remove unnecessary forward declarations.
1786 (cp_parser_string_literal): New wrapper.
1787 (cp_parser_string_literal_common): Renamed from
1788 cp_parser_string_literal. Add a bool parameter. Give an error when
1789 UDLs are not permitted.
1790 (cp_parser_userdef_string_literal): New wrapper.
1791 (finish_userdef_string_literal): Renamed from
1792 cp_parser_userdef_string_literal.
1793 (cp_parser_primary_expression): Call cp_parser_userdef_string_literal
1794 instead of cp_parser_string_literal.
1795 (cp_parser_linkage_specification): Move a variable declaration closer
1797 (cp_parser_static_assert): Likewise.
1798 (cp_parser_operator): Call cp_parser_userdef_string_literal instead of
1799 cp_parser_string_literal.
1800 (cp_parser_asm_definition): Move a variable declaration closer to its
1802 (cp_parser_asm_specification_opt): Move variable declarations closer to
1804 (cp_parser_asm_operand_list): Likewise.
1805 (cp_parser_asm_clobber_list): Likewise.
1807 2023-01-26 Jakub Jelinek <jakub@redhat.com>
1810 * parser.cc (cp_convert_omp_range_for): If cp_finish_decomp has been
1811 called in !processing_template_decl with processing_template_decl
1812 temporarily set, clear DECL_HAS_VALUE_EXPR_P on the vars temporarily.
1813 (cp_finish_omp_range_for): And set it back again here.
1815 2023-01-25 Jakub Jelinek <jakub@redhat.com>
1818 * mangle.cc (write_closure_type_name): Don't assume all
1819 lambda operator() fns are methods.
1821 2023-01-24 Jason Merrill <jason@redhat.com>
1824 * parser.cc (cp_lexer_new_main): Pass C_LEX_STRING_NO_JOIN for first
1827 2023-01-24 Jason Merrill <jason@redhat.com>
1830 * pt.cc (tsubst_function_decl): Handle static lambda.
1832 2023-01-24 Jakub Jelinek <jakub@redhat.com>
1835 * cp-gimplify.cc (cp_fold_r): Revert 2023-01-19 changes.
1837 2023-01-24 Jason Merrill <jason@redhat.com>
1841 * cp-gimplify.cc (cp_fold_r) [TARGET_EXPR]: In case of double
1842 TARGET_EXPR, keep the outer one instead of the inner one.
1843 (maybe_replace_decl): New.
1845 2023-01-23 Jason Merrill <jason@redhat.com>
1848 * cp-gimplify.cc (cp_gimplify_init_expr): Allow unexpected elision
1851 2023-01-23 Marek Polacek <polacek@redhat.com>
1854 * cvt.cc (ocp_convert): copy_warning when creating a new
1856 * init.cc (build_new_1): Suppress -Wunused-value on
1857 compiler-generated COMPOUND_EXPRs.
1859 2023-01-23 Jason Merrill <jason@redhat.com>
1862 * call.cc (build_user_type_conversion_1): Check whether the
1863 iterators also find a list ctor.
1865 2023-01-23 Jason Merrill <jason@redhat.com>
1868 * decl.cc (grokdeclarator): Check whether DECL_RESULT is already
1871 2023-01-23 Jason Merrill <jason@redhat.com>
1875 * call.cc (extend_ref_init_temps_1): Handle ptrmem expression.
1877 2023-01-19 Jakub Jelinek <jakub@redhat.com>
1880 * cp-tree.h (keep_unused_object_arg): Declare.
1881 * call.cc (keep_unused_object_arg): No longer static.
1882 * tree.cc (build_min_non_dep_op_overload): Handle ARRAY_REF
1883 with overload being static member function.
1885 2023-01-19 Jakub Jelinek <jakub@redhat.com>
1888 * cp-gimplify.cc (cp_fold_r): During cp_fully_fold_init replace
1889 DECL_ANON_UNION_VAR_P VAR_DECLs with their corresponding
1892 2023-01-16 Jakub Jelinek <jakub@redhat.com>
1895 * decl.cc (cp_finish_decl): Check warning_enabled_at
1896 at the DECL_SOURCE_LOCATION (decl) for OPT_Winit_self instead
1899 2023-01-14 Jakub Jelinek <jakub@redhat.com>
1902 * typeck.cc (cp_build_binary_op): Use may_shorten_divmod for integral
1905 2023-01-13 Jakub Jelinek <jakub@redhat.com>
1908 * cvt.cc (cp_convert_and_check): For EXCESS_PRECISION_EXPR
1909 use its operand except that for warning purposes use the original
1910 EXCESS_PRECISION_EXPR.
1911 * call.cc (convert_like_internal): Only look through
1912 EXCESS_PRECISION_EXPR when calling cp_convert, not when calling
1913 cp_convert_and_check.
1915 2023-01-09 Jakub Jelinek <jakub@redhat.com>
1920 * call.cc (maybe_init_list_as_range): Always return NULL_TREE if
1921 processing_template_decl.
1923 2023-01-05 Patrick Palka <ppalka@redhat.com>
1926 * parser.cc (cp_parser_class_head): Use dk_deferred instead of
1927 dk_no_check when parsing the class name.
1929 2023-01-05 Jakub Jelinek <jakub@redhat.com>
1932 * semantics.cc (finish_omp_target_clauses): Ignore clauses other than
1935 2023-01-04 Patrick Palka <ppalka@redhat.com>
1938 * decl2.cc (mark_single_function): Ignore mark_used failure
1939 only in a non-SFINAE context rather than in a SFINAE one.
1941 2023-01-04 Jakub Jelinek <jakub@redhat.com>
1944 * decl.cc (merge_default_template_args): Return false if either
1945 new_parm or old_parm are erroneous.
1948 Copyright (C) 2023 Free Software Foundation, Inc.
1950 Copying and distribution of this file, with or without modification,
1951 are permitted in any medium without royalty provided the copyright
1952 notice and this notice are preserved.