1 2023-12-22 Jason Merrill <jason@redhat.com>
4 * decl.cc (poplevel_named_label_1): Handle leaving catch.
5 (check_previous_goto_1): Likewise.
6 (check_goto_1): Likewise.
8 2023-12-22 Jason Merrill <jason@redhat.com>
11 * mangle.cc (write_expression): Handle v18 sizeof... bug.
12 * pt.cc (tsubst_pack_expansion): Keep TREE_VEC for sizeof...
13 (tsubst_expr): Don't strip TREE_VEC here.
15 2023-12-21 Patrick Palka <ppalka@redhat.com>
17 * cp-tree.h (maybe_warn_unparenthesized_assignment): Add
18 'nested_p' bool parameter.
19 * semantics.cc (boolish_class_type_p_cache): Define.
20 (boolish_class_type_p): Define.
21 (maybe_warn_unparenthesized_assignment): Add 'nested_p'
22 bool parameter. Suppress the warning for nested assignments
23 to bool and bool-like class types.
24 (maybe_convert_cond): Pass nested_p=false to
25 maybe_warn_unparenthesized_assignment.
26 * typeck.cc (convert_for_assignment): Pass nested_p=true to
27 maybe_warn_unparenthesized_assignment. Remove now redundant
28 check for 'rhs' having bool type.
30 2023-12-21 Patrick Palka <ppalka@redhat.com>
33 * decl.cc (merge_attribute_bits): Merge TREE_DEPRECATED
36 2023-12-21 Patrick Palka <ppalka@redhat.com>
40 * decl2.cc (min_vis_expr_r): Handle PTRMEM_CST and TEMPLATE_DECL
41 other than those for alias templates.
43 2023-12-21 Jakub Jelinek <jakub@redhat.com>
45 * cp-gimplify.cc (cp_genericize_r): If warn_alloc_size, call
46 warn_for_alloc_size for -Walloc-size diagnostics.
47 * semantics.cc (finish_call_expr): If warn_calloc_transposed_args,
48 call warn_for_calloc for -Wcalloc-transposed-args diagnostics.
50 2023-12-21 Jason Merrill <jason@redhat.com>
53 * decl.cc (identify_goto): Adjust for computed goto.
54 (struct named_label_use_entry): Add computed_goto field.
55 (poplevel_named_label_1): Add to computed_goto vec.
56 (check_previous_goto_1): Dump computed_goto vec.
57 (check_goto_1): Split out from check_goto.
58 (check_goto): Check all addressable labels for computed goto.
59 (struct named_label_entry): Add addressed field.
60 (mark_label_addressed): New.
61 * parser.cc (cp_parser_unary_expression): Call it.
62 * cp-tree.h (mark_label_addressed): Declare it.
64 2023-12-20 Jason Merrill <jason@redhat.com>
68 * except.cc (maybe_splice_retval_cleanup): Handle an empty block.
70 2023-12-20 Jason Merrill <jason@redhat.com>
73 * typeck.cc (cp_build_array_ref): Handle swapped operands.
75 2023-12-19 Patrick Palka <ppalka@redhat.com>
78 * method.cc (synthesize_method): Use maybe_push_to_top_level
79 and maybe_pop_from_top_level.
81 2023-12-19 Patrick Palka <ppalka@redhat.com>
83 * name-lookup.cc (struct local_state_t): Define.
84 (local_state_stack): Define.
85 (maybe_push_to_top_level): Use them.
86 (maybe_pop_from_top_level): Likewise.
87 * pt.cc (instantiate_decl): Remove dead code for saving/restoring
88 cp_unevaluated_operand and c_inhibit_evaluation_warnings.
90 2023-12-19 Nathaniel Shead <nathanieloshead@gmail.com>
93 * constexpr.cc (cxx_bind_parameters_in_call): Check for calling
94 non-static member functions with a null pointer.
96 2023-12-19 Sandra Loosemore <sandra@codesourcery.com>
98 * decl.cc (omp_declare_variant_finalize_one): Adjust for new
100 * parser.cc (omp_construct_selectors): Delete.
101 (omp_device_selectors): Delete.
102 (omp_implementation_selectors): Delete.
103 (omp_user_selectors): Delete.
104 (cp_parser_omp_context_selector): Adjust for new representations
105 and simplify dispatch logic. Uniformly warn instead of sometimes
106 error when an unknown selector is found. Adjust error messages
107 for extraneous/incorrect score.
108 (cp_parser_omp_context_selector_specification): Likewise.
109 * pt.cc (tsubst_attribute): Adjust for new representations.
111 2023-12-19 Sandra Loosemore <sandra@codesourcery.com>
113 * parser.cc (cp_parser_omp_context_selector): Adjust for new
114 namelist property representation.
115 * pt.cc (tsubst_attribute): Likewise.
117 2023-12-19 Sandra Loosemore <sandra@codesourcery.com>
119 * parser.cc (cp_parser_omp_context_selector): Use new constructors.
120 * pt.cc: Include omp-general.h.
121 (tsubst_attribute): Use new context selector accessors and
124 2023-12-19 Patrick Palka <ppalka@redhat.com>
127 * cp-tree.h (comp_template_args): Remove partial_order parameter.
128 (template_args_equal): Likewise.
129 * pt.cc (comparing_for_partial_ordering): New global flag.
130 (iterative_hash_template_arg) <case tcc_type>: Hash the template
131 and arguments for specializations that use structural equality.
132 (template_args_equal): Remove partial order parameter and
133 use comparing_for_partial_ordering instead.
134 (comp_template_args): Likewise.
135 (comp_template_args_porder): Set comparing_for_partial_ordering
136 instead. Make static.
137 (any_template_arguments_need_structural_equality_p): Return true
138 for an argument that's a dependent alias template specialization
139 or a class template specialization that itself needs structural
141 * tree.cc (cp_tree_equal) <case TREE_VEC>: Adjust call to
144 2023-12-19 Patrick Palka <ppalka@redhat.com>
147 * cp-tree.h (TEMPLATE_DECL_COMPLEX_ALIAS_P): Remove.
148 (most_general_template): Constify parameter.
149 * pt.cc (push_template_decl): Adjust after removing
150 TEMPLATE_DECL_COMPLEX_ALIAS_P.
151 (complex_alias_tmpl_info): New hash_map.
152 (uses_all_template_parms_data::seen): Change type to
154 (complex_alias_template_r): Adjust accordingly.
155 (complex_alias_template_p): Add 'seen_out' out parameter.
156 Call most_general_template and check PRIMARY_TEMPLATE_P.
157 Use complex_alias_tmpl_info to cache the result and set
158 '*seen_out' accordigly.
159 (dependent_alias_template_spec_p): Add !processing_template_decl
160 early exit test. Consider dependence of only template arguments
161 corresponding to seen template parameters as per
163 2023-12-19 Thomas Schwinge <thomas@codesourcery.com>
166 * parser.cc (cp_parser_oacc_declare): For "more than once", check
167 the DECL that we're actually setting the attribute on.
169 2023-12-16 Nathaniel Shead <nathanieloshead@gmail.com>
172 * module.cc (module_state::write_cluster): Don't skip first
175 2023-12-16 Nathaniel Shead <nathanieloshead@gmail.com>
178 * constexpr.cc (cxx_fold_indirect_ref_1): Check for CLASS_TYPE
179 before using CLASSTYPE_AS_BASE.
181 2023-12-16 Andrew Carlotti <andrew.carlotti@arm.com>
183 * decl2.cc (check_classfn): Update comment to include
184 target_version attributes.
186 2023-12-15 Patrick Palka <ppalka@redhat.com>
190 * pt.cc (tsubst_function_decl): Propagate DECL_SECTION_NAME
191 via set_decl_section_name.
192 (tsubst_decl) <case VAR_DECL>: Likewise.
194 2023-12-15 Patrick Palka <ppalka@redhat.com>
197 * mangle.cc (get_abi_tags): Strip TEMPLATE_DECL before looking
198 up the abi_tag attribute.
200 2023-12-14 Marek Polacek <polacek@redhat.com>
203 * decl.cc (grokdeclarator): Do not issue the auto parameter error while
204 tentatively parsing a function parameter.
205 * parser.cc (cp_parser_parameter_declaration_clause): Check it here.
207 2023-12-14 Marek Polacek <polacek@redhat.com>
210 * cp-gimplify.cc (cp_fold_immediate_r): Check cp_unevaluated_operand
211 and DECL_IMMEDIATE_FUNCTION_P rather than in_immediate_context.
213 2023-12-14 Patrick Palka <ppalka@redhat.com>
215 * cp-tree.h (type_targs_deducible_from): Adjust return type.
216 * pt.cc (alias_ctad_tweaks): Also handle C++23 inherited CTAD.
217 (inherited_ctad_tweaks): Define.
218 (type_targs_deducible_from): Return the deduced arguments or
219 NULL_TREE instead of a bool. Handle 'tmpl' being a TREE_LIST
220 representing a synthetic alias template.
221 (ctor_deduction_guides_for): Do inherited_ctad_tweaks for each
222 USING_DECL in C++23 mode.
223 (deduction_guides_for): Add FIXME for stale cache entries in
224 light of inherited CTAD.
226 2023-12-14 Jakub Jelinek <jakub@redhat.com>
229 * pt.cc (freelist<tree_node>::reinit): Make whole obj->common
230 defined for valgrind annotations rather than just obj->base,
231 and do it even for ENABLE_GC_CHECKING. If not ENABLE_GC_CHECKING,
232 clear TREE_CHAIN (obj) and TREE_TYPE (obj).
234 2023-12-13 Patrick Palka <ppalka@redhat.com>
236 * call.cc (print_z_candidates): Only print ignored candidates
237 when -fdiagnostics-all-candidates is set, otherwise suggest
239 (build_over_call): When diagnosing deletedness, note
240 other candidates only if -fdiagnostics-all-candidates is
241 set, otherwise suggest the flag.
243 2023-12-13 Patrick Palka <ppalka@redhat.com>
245 * call.cc (enum rejection_reason_code): Add rr_ignored.
246 (add_ignored_candidate): Define.
247 (ignored_candidate_p): Define.
248 (add_template_candidate_real): Do add_ignored_candidate
249 instead of returning NULL.
250 (splice_viable): Put ignored (non-viable) candidates last.
251 (print_z_candidate): Handle ignored candidates.
252 (build_new_function_call): Refine shortcut that calls
253 cp_build_function_call_vec now that non-templates can
254 appear in the candidate list for a template-id call.
255 (add_candidates): Replace 'bad_fns' overload with 'bad_cands'
256 candidate list. When not considering a candidate, add it
257 to the list as an ignored candidate. Add all 'bad_cands'
258 to the overload set as well.
260 2023-12-13 Patrick Palka <ppalka@redhat.com>
262 * call.cc: Include "tristate.h".
263 (splice_viable): Sort the candidate list according to viability.
264 Don't remove non-viable candidates from the list.
265 (print_z_candidates): Add defaulted only_viable_p parameter.
266 By default only print non-viable candidates if there is no
268 (tourney): Ignore non-viable candidates. Move the true champ to
269 the front of the candidates list, and update 'candidates' to
270 point to the front. Rename champ_compared_to_predecessor to
271 previous_worse_champ.
273 2023-12-13 Patrick Palka <ppalka@redhat.com>
277 * pt.cc (unify) <case INTEGER_CST>: Compare types as well.
279 2023-12-13 Patrick Palka <ppalka@redhat.com>
282 * pt.cc (unify) <case FUNCTION_DECL>: Handle it like FIELD_DECL
285 2023-12-13 Jason Merrill <jason@redhat.com>
287 * call.cc (convert_for_arg_passing)
288 * typeck.cc (convert_for_assignment): Adjust call to
289 warn_for_address_of_packed_member.
291 2023-12-13 Julian Brown <julian@codesourcery.com>
293 * parser.cc (cp_parser_oacc_all_clauses): Add TARGET_P parameter. Use
294 to select region type for finish_omp_clauses call.
295 (cp_parser_omp_target_data, cp_parser_omp_target_enter_data): Support
296 GOMP_MAP_ATTACH kind.
297 (cp_parser_omp_target_exit_data): Support GOMP_MAP_DETACH kind.
298 (cp_parser_oacc_declare): Update call to cp_parser_oacc_all_clauses.
299 (cp_parser_oacc_loop): Update calls to cp_parser_oacc_all_clauses.
300 (cp_parser_oacc_compute): Likewise.
301 * pt.cc (tsubst_expr): Use C_ORT_ACC_TARGET for call to
302 tsubst_omp_clauses for OpenACC compute regions.
303 * semantics.cc (cp_omp_address_inspector): New class, derived from
304 c_omp_address_inspector.
305 (handle_omp_array_sections_1, handle_omp_array_sections,
306 finish_omp_clauses): Use cp_omp_address_inspector class and OMP address
307 tokenizer to analyze and expand OpenMP map clause expressions. Fix
308 some diagnostics. Support C_ORT_ACC_TARGET.
309 (finish_omp_target): Handle GOMP_MAP_POINTER.
311 2023-12-13 Julian Brown <julian@codesourcery.com>
313 * semantics.cc (finish_omp_clause): Add braces and reindent
314 OMP_CLAUSE_TO/OMP_CLAUSE_FROM/OMP_CLAUSE__CACHE_ stanza.
316 2023-12-13 Jason Merrill <jason@redhat.com>
319 * tree.cc (bot_manip): Check data.clear_location for TARGET_EXPR.
321 2023-12-13 Nathaniel Shead <nathanieloshead@gmail.com>
324 * constexpr.cc (constexpr_global_ctx::get_value_ptr): Don't
325 return NULL_TREE for objects we're initializing.
326 (constexpr_global_ctx::destroy_value): Rename from remove_value.
327 Only mark real variables as outside lifetime.
328 (constexpr_global_ctx::clear_value): New function.
329 (destroy_value_checked): New function.
330 (cxx_eval_call_expression): Defer complaining about non-constant
331 arg0 for operator delete. Use remove_value_safe.
332 (cxx_fold_indirect_ref_1): Handle conversion to 'as base' type.
333 (outside_lifetime_error): Include name of object we're
335 (cxx_eval_store_expression): Handle clobbers. Improve error
337 (cxx_eval_constant_expression): Use remove_value_safe. Clear
338 bind variables before entering body.
340 2023-12-13 Jason Merrill <jason@redhat.com>
342 * constexpr.cc (cxx_eval_call_expression): Handle missing in-charge
345 2023-12-13 Jason Merrill <jason@redhat.com>
348 * constexpr.cc (cxx_eval_outermost_constant_expr): Turn
349 a constructor CALL_EXPR into a TARGET_EXPR.
351 2023-12-13 Jason Merrill <jason@redhat.com>
353 * tree.cc (build_aggr_init_expr): Copy EXPR_LOCATION.
355 2023-12-12 Jason Merrill <jason@redhat.com>
356 Jason Xu <rxu@DRWHoldings.com>
358 * class.cc (propagate_class_warmth_attribute): Handle
361 2023-12-12 Jason Merrill <jason@redhat.com>
362 Nathaniel Shead <nathanieloshead@gmail.com>
364 * call.cc (build_trivial_dtor_call): Use CLOBBER_OBJECT_END.
365 * decl.cc (build_clobber_this): Take clobber_kind argument.
366 (start_preparsed_function): Pass CLOBBER_OBJECT_BEGIN.
367 (begin_destructor_body): Pass CLOBBER_OBJECT_END.
369 2023-12-11 Patrick Palka <ppalka@redhat.com>
371 * pt.cc (alias_ctad_tweaks): Pass use_spec_table=false to
374 2023-12-11 Tobias Burnus <tobias@codesourcery.com>
376 * parser.cc (cp_parser_omp_requires): Handle acquires/release
377 in atomic_default_mem_order clause.
378 (cp_parser_omp_atomic): Update.
380 2023-12-11 Nathaniel Shead <nathanieloshead@gmail.com>
384 * call.cc (build_over_call): Prevent folding of trivial special
385 members when checking for noexcept.
386 * method.cc (constructible_expr): Perform value-initialisation
387 for empty parameter lists.
388 (is_nothrow_xible): Treat as noexcept operator.
390 2023-12-11 Nathaniel Shead <nathanieloshead@gmail.com>
394 * pt.cc (tsubst_template_decl): Clear
395 DECL_UNINSTANTIATED_TEMPLATE_FRIEND_P.
397 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
399 * cp-trait.def: Define __remove_pointer.
400 * semantics.cc (finish_trait_type): Handle CPTK_REMOVE_POINTER.
402 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
404 * cp-trait.def: Define __is_object.
405 * constraint.cc (diagnose_trait_expr): Handle CPTK_IS_OBJECT.
406 * semantics.cc (trait_expr_value): Likewise.
407 (finish_trait_expr): Likewise.
409 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
411 * cp-trait.def: Define __is_function.
412 * constraint.cc (diagnose_trait_expr): Handle CPTK_IS_FUNCTION.
413 * semantics.cc (trait_expr_value): Likewise.
414 (finish_trait_expr): Likewise.
416 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
418 * cp-trait.def: Define __is_reference.
419 * constraint.cc (diagnose_trait_expr): Handle CPTK_IS_REFERENCE.
420 * semantics.cc (trait_expr_value): Likewise.
421 (finish_trait_expr): Likewise.
423 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
425 * cp-trait.def: Define __is_member_object_pointer.
426 * constraint.cc (diagnose_trait_expr): Handle
427 CPTK_IS_MEMBER_OBJECT_POINTER.
428 * semantics.cc (trait_expr_value): Likewise.
429 (finish_trait_expr): Likewise.
431 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
433 * cp-trait.def: Define __is_member_function_pointer.
434 * constraint.cc (diagnose_trait_expr): Handle
435 CPTK_IS_MEMBER_FUNCTION_POINTER.
436 * semantics.cc (trait_expr_value): Likewise.
437 (finish_trait_expr): Likewise.
439 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
441 * cp-trait.def: Define __is_member_pointer.
442 * constraint.cc (diagnose_trait_expr): Handle
443 CPTK_IS_MEMBER_POINTER.
444 * semantics.cc (trait_expr_value): Likewise.
445 (finish_trait_expr): Likewise.
447 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
449 * cp-trait.def: Define __is_scoped_enum.
450 * constraint.cc (diagnose_trait_expr): Handle CPTK_IS_SCOPED_ENUM.
451 * semantics.cc (trait_expr_value): Likewise.
452 (finish_trait_expr): Likewise.
454 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
456 * cp-trait.def: Define __is_bounded_array.
457 * constraint.cc (diagnose_trait_expr): Handle
458 CPTK_IS_BOUNDED_ARRAY.
459 * semantics.cc (trait_expr_value): Likewise.
460 (finish_trait_expr): Likewise.
462 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
464 * cp-trait.def: Define __is_array.
465 * constraint.cc (diagnose_trait_expr): Handle CPTK_IS_ARRAY.
466 * semantics.cc (trait_expr_value): Likewise.
467 (finish_trait_expr): Likewise.
469 2023-12-10 Jason Merrill <jason@redhat.com>
471 * parser.cc (cp_parser_simple_type_specifier): Move trait
472 handling to default label.
474 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
476 * parser.cc (cp_lexer_lookup_trait): Rename to ...
477 (cp_lexer_peek_trait): ... this. Handle a subsequent token for
478 the corresponding built-in trait.
479 (cp_lexer_lookup_trait_expr): Rename to ...
480 (cp_lexer_peek_trait_expr): ... this.
481 (cp_lexer_lookup_trait_type): Rename to ...
482 (cp_lexer_peek_trait_type): ... this.
483 (cp_lexer_next_token_is_decl_specifier_keyword): Call
484 cp_lexer_peek_trait_type.
485 (cp_parser_simple_type_specifier): Likewise.
486 (cp_parser_primary_expression): Call cp_lexer_peek_trait_expr.
488 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
489 Patrick Palka <ppalka@redhat.com>
491 * cp-objcp-common.cc (names_builtin_p): Remove all RID value
492 cases for built-in traits. Check for built-in traits via
493 the new cik_trait kind.
494 * cp-tree.h (enum cp_trait_kind): Set its underlying type to
496 (struct cp_trait): New struct to hold trait information.
497 (cp_traits): New array to hold a mapping to all traits.
498 (cik_reserved_for_udlit): Rename to ...
499 (cik_trait): ... this.
500 (IDENTIFIER_ANY_OP_P): Exclude cik_trait.
501 (IDENTIFIER_TRAIT_P): New macro to detect cik_trait.
502 * lex.cc (cp_traits): Define its values, declared in cp-tree.h.
503 (init_cp_traits): New function to set cik_trait and
504 IDENTIFIER_CP_INDEX for all built-in trait identifiers.
505 (cxx_init): Call init_cp_traits function.
506 * parser.cc (cp_lexer_lookup_trait): New function to look up a
507 built-in trait by IDENTIFIER_CP_INDEX.
508 (cp_lexer_lookup_trait_expr): Likewise, look up an
509 expression-yielding built-in trait.
510 (cp_lexer_lookup_trait_type): Likewise, look up a type-yielding
512 (cp_keyword_starts_decl_specifier_p): Remove all RID value cases
514 (cp_lexer_next_token_is_decl_specifier_keyword): Handle
515 type-yielding built-in traits.
516 (cp_parser_primary_expression): Remove all RID value cases for
517 built-in traits. Handle expression-yielding built-in traits.
518 (cp_parser_trait): Handle cp_trait instead of enum rid.
519 (cp_parser_simple_type_specifier): Remove all RID value cases
520 for built-in traits. Handle type-yielding built-in traits.
522 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
524 * constraint.cc (diagnose_trait_expr): Sort built-in traits
526 * cp-trait.def: Likewise.
527 * semantics.cc (trait_expr_value): Likewise.
528 (finish_trait_expr): Likewise.
529 (finish_trait_type): Likewise.
531 2023-12-09 Jakub Jelinek <jakub@redhat.com>
533 * parser.cc (cp_parser_statement, cp_parser_expression_statement,
534 cp_parser_declaration, cp_parser_asm_definition): Don't diagnose
535 ignored attributes if !any_nonignored_attribute_p.
536 * decl.cc (grokdeclarator): Likewise.
537 * name-lookup.cc (handle_namespace_attrs, finish_using_directive):
538 Don't diagnose ignoring of attr_ignored_p attributes.
540 2023-12-08 Patrick Palka <ppalka@redhat.com>
543 * semantics.cc (capture_decltype): Inline into its only caller ...
544 (finish_decltype_type): ... here. Update nearby comment to refer
545 to recent standard. Add FIXME. Restrict uncaptured variable type
546 transformation to happen only for lambdas with a by-copy
549 2023-12-08 Jakub Jelinek <jakub@redhat.com>
551 * parser.cc (cp_parser_std_attribute_spec): Return void_list_node
552 rather than NULL_TREE if token is neither CPP_OPEN_SQUARE nor
553 RID_ALIGNAS CPP_KEYWORD.
554 (cp_parser_std_attribute_spec_seq): For attr_spec == void_list_node
555 break, for attr_spec == NULL_TREE continue.
557 2023-12-08 Jakub Jelinek <jakub@redhat.com>
560 * cp-gimplify.cc (cp_fold): If SAVE_EXPR has been previously
561 folded, unshare_expr what is returned.
563 2023-12-08 Patrick Palka <ppalka@redhat.com>
566 * parser.cc (cp_parser_expression_statement): If the statement
567 is error_mark_node, make sure we've seen_error().
569 2023-12-08 Patrick Palka <ppalka@redhat.com>
573 * typeck.cc (cp_build_c_cast): If we're committed to a const_cast
574 and the result is erroneous, call build_const_cast_1 a second
575 time to issue errors. Use complain=tf_none instead of =false.
577 2023-12-06 David Malcolm <dmalcolm@redhat.com>
579 * cp-tree.h (cxx_print_error_function): Make diagnostic_info param
581 * error.cc (cxx_print_error_function): Likewise.
582 (cp_diagnostic_starter): Likewise.
583 (cp_print_error_function): Likewise.
585 2023-12-06 Jason Merrill <jason@redhat.com>
589 * pt.cc (more_specialized_fn): Fix object parameter handling.
591 2023-12-05 Jakub Jelinek <jakub@redhat.com>
594 * cp-tree.h (cp_check_pragma_unroll): Declare.
595 * semantics.cc (cp_check_pragma_unroll): New function.
596 * parser.cc (cp_parser_pragma_unroll): Use cp_check_pragma_unroll.
597 * pt.cc (tsubst_expr) <case ANNOTATE_EXPR>: Likewise.
598 (tsubst_stmt) <case RANGE_FOR_STMT>: Likwsie.
600 2023-12-05 Richard Sandiford <richard.sandiford@arm.com>
602 * tree.cc (cxx_gnu_attribute_table): Add extra braces to work
603 around PR 16333 in older compilers.
605 2023-12-05 Jakub Jelinek <jakub@redhat.com>
608 * parser.cc (cp_parser_block_declaration): Implement C++ DR 2262
609 - Attributes for asm-definition. Call cp_parser_asm_definition
610 even if RID_ASM token is only seen after sequence of standard
612 (cp_parser_asm_definition): Parse standard attributes before
613 RID_ASM token and warn for them with -Wattributes.
615 2023-12-05 Marek Polacek <polacek@redhat.com>
619 * call.cc (in_immediate_context): No longer static.
620 * constexpr.cc (cxx_eval_call_expression): Adjust assert.
621 * cp-gimplify.cc (deferred_escalating_exprs): New vec.
622 (remember_escalating_expr): New.
623 (enum fold_flags): Remove ff_fold_immediate.
624 (immediate_escalating_function_p): New.
625 (unchecked_immediate_escalating_function_p): New.
626 (promote_function_to_consteval): New.
627 (cp_fold_immediate): Move above. Return non-null if any errors were
629 (maybe_explain_promoted_consteval): New.
630 (cp_gimplify_expr) <case CALL_EXPR>: Assert we've handled all
631 immediate invocations.
632 (taking_address_of_imm_fn_error): New.
633 (cp_fold_immediate_r): Merge ADDR_EXPR and PTRMEM_CST cases. Implement
634 P2564 - promoting functions to consteval.
635 <case CALL_EXPR>: Implement P2564 - promoting functions to consteval.
636 (cp_fold_r): If an expression turns into a CALL_EXPR after cp_fold,
637 call cp_fold_immediate_r on the CALL_EXPR.
638 (cp_fold_function): Set DECL_ESCALATION_CHECKED_P if
639 deferred_escalating_exprs does not contain current_function_decl.
640 (process_and_check_pending_immediate_escalating_fns): New.
641 * cp-tree.h (struct lang_decl_fn): Add escalated_p bit-field.
642 (DECL_ESCALATION_CHECKED_P): New.
643 (immediate_invocation_p): Declare.
644 (process_pending_immediate_escalating_fns): Likewise.
645 * decl2.cc (c_parse_final_cleanups): Set at_eof to 2 after all
646 templates have been instantiated; and to 3 at the end of the function.
647 Call process_pending_immediate_escalating_fns.
648 * error.cc (dump_template_bindings): Check at_eof against an updated
650 * module.cc (trees_out::lang_decl_bools): Stream escalated_p.
651 (trees_in::lang_decl_bools): Likewise.
652 * pt.cc (push_tinst_level_loc): Set at_eof to 3, not 2.
653 * typeck.cc (cp_build_addr_expr_1): Don't check
654 DECL_IMMEDIATE_FUNCTION_P.
656 2023-12-04 Jason Merrill <jason@redhat.com>
658 * constexpr.cc (potential_constant_expression_1): Fix
659 check for loading volatile lvalue.
661 2023-12-04 Jakub Jelinek <jakub@redhat.com>
664 * cp-tree.h (cp_convert_range_for): Change UNROLL type from
665 unsigned short to tree.
666 (finish_while_stmt_cond, finish_do_stmt, finish_for_cond): Likewise.
667 * parser.cc (cp_parser_statement): Pass NULL_TREE rather than 0 to
668 cp_parser_iteration_statement UNROLL argument.
669 (cp_parser_for, cp_parser_c_for): Change UNROLL type from
670 unsigned short to tree.
671 (cp_parser_range_for): Likewise. Set RANGE_FOR_UNROLL to just UNROLL
672 rather than build_int_cst from it.
673 (cp_convert_range_for, cp_parser_iteration_statement): Change UNROLL
674 type from unsigned short to tree.
675 (cp_parser_omp_loop_nest): Pass NULL_TREE rather than 0 to
676 cp_parser_range_for UNROLL argument.
677 (cp_parser_pragma_unroll): Return tree rather than unsigned short.
678 If parsed expression is type dependent, just return it, don't diagnose
679 issues with value if it is value dependent.
680 (cp_parser_pragma): Change UNROLL type from unsigned short to tree.
681 * semantics.cc (finish_while_stmt_cond): Change UNROLL type from
682 unsigned short to tree. Build ANNOTATE_EXPR with UNROLL as its last
683 operand rather than build_int_cst from it.
684 (finish_do_stmt, finish_for_cond): Likewise.
685 * pt.cc (tsubst_stmt) <case RANGE_FOR_STMT>: Change UNROLL type from
686 unsigned short to tree and set it to RECUR on RANGE_FOR_UNROLL (t).
687 (tsubst_expr) <case ANNOTATE_EXPR>: For annot_expr_unroll_kind repeat
688 checks on UNROLL value from cp_parser_pragma_unroll.
690 2023-12-02 Richard Sandiford <richard.sandiford@arm.com>
692 * cp-tree.h (cxx_attribute_table): Delete.
693 (cxx_gnu_attribute_table, std_attribute_table): Declare.
694 * cp-objcp-common.h (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): Delete.
695 (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Delete.
696 (cp_objcp_attribute_table): New table.
697 (LANG_HOOKS_ATTRIBUTE_TABLE): Redefine.
698 * tree.cc (cxx_attribute_table): Replace with...
699 (cxx_gnu_attributes, cxx_gnu_attribute_table): ...these globals.
700 (std_attribute_table): Change type to scoped_attribute_specs, using...
701 (std_attributes): ...this as the underlying array.
702 (init_tree): Remove call to register_scoped_attributes.
704 2023-12-01 Jason Merrill <jason@redhat.com>
706 * mangle.cc (write_type): Mangle placeholder as its template.
708 2023-12-01 Jason Merrill <jason@redhat.com>
710 * cp-tree.h (TEMPLATE_ARGS_TYPE_CONSTRAINT_P): New.
711 (get_concept_check_template): Declare.
712 * constraint.cc (combine_constraint_expressions)
713 (finish_shorthand_constraint): Use UNKNOWN_LOCATION.
714 * pt.cc (convert_generic_types_to_packs): Likewise.
715 * mangle.cc (write_constraint_expression)
716 (write_tparms_constraints, write_type_constraint)
717 (template_parm_natural_p, write_requirement)
718 (write_requires_expr): New.
719 (write_encoding): Mangle trailing requires-clause.
720 (write_name): Pass parms to write_template_args.
721 (write_template_param_decl): Factor out from...
722 (write_closure_template_head): ...here.
723 (write_template_args): Mangle non-natural parms
725 (write_expression): Handle REQUIRES_EXPR.
727 2023-12-01 Jason Merrill <jason@redhat.com>
729 * semantics.cc (finish_non_static_data_member)
730 (finish_decltype_type, capture_decltype):
731 Handle deduced closure parameter.
733 2023-11-30 Marek Polacek <polacek@redhat.com>
736 * typeck.cc (finish_class_member_access_expr): When accessing
737 a static data member, use ba_any for lookup_base.
739 2023-11-30 Jakub Jelinek <jakub@redhat.com>
742 * cp-tree.h: Implement C++26 P2169R4 - Placeholder variables with no
744 (OVL_NAME_INDEPENDENT_DECL_P): Define.
745 (add_capture): Add unsigned * argument.
746 (name_independent_decl_p): New inline function.
747 * name-lookup.cc (class name_lookup): Make ambiguous and
748 add_value members public.
749 (name_independent_linear_search): New function.
750 (get_class_binding_direct): Handle member_vec_binary_search
751 returning OVL_NAME_INDEPENDENT_DECL_P OVERLOAD. Use
752 name_independent_linear_search rather than fields_linear_search
753 for linear lookup of _ name if !want_type.
754 (member_name_cmp): Sort name-independent declarations first.
755 (member_vec_dedup): Handle name-independent declarations.
756 (pop_local_binding): Handle binding->value being a TREE_LIST for
757 ambiguous name-independent declarations.
758 (supplement_binding): Handle name-independent declarations.
759 (update_binding): Likewise.
760 (check_local_shadow): Return tree rather than void, normally
761 NULL_TREE but old for name-independent declarations which used
762 to conflict with outer scope declaration. Don't emit -Wshadow*
763 warnings for name-independent declarations.
764 (pushdecl): Handle name-independent declarations.
765 * search.cc (lookup_field_r): Handle nval being a TREE_LIST.
766 * lambda.cc (build_capture_proxy): Adjust for ___.<number>
768 (add_capture): Add NAME_INDEPENDENT_CNT argument. Use ___.<number>
769 name rather than ___ for second and following capture with
771 (add_default_capture): Adjust add_capture caller.
772 * decl.cc (poplevel): Don't warn about name-independent declarations.
773 (duplicate_decls): If in C++26 a _ named declaration conflicts with
774 earlier declarations, emit explaining note why the new declaration
775 is not name-independent.
776 (reshape_init_class): If field is a TREE_LIST, emit an ambiguity
777 error with list of candidates rather than error about non-existing
778 non-static data member.
779 * parser.cc (cp_parser_lambda_introducer): Adjust add_capture callers.
780 Allow name-independent capture redeclarations.
781 (cp_parser_decomposition_declaration): Set decl_specs.storage_class
782 to sc_static for static structured bindings.
783 * pt.cc (tsubst_lambda_expr): Adjust add_capture caller.
785 2023-11-30 Alexandre Oliva <oliva@adacore.com>
787 * decl.cc (finish_enum_value_list): Set TYPE_PACKED if
788 use_short_enum, and propagate it to variants.
790 2023-11-30 Jason Merrill <jason@redhat.com>
792 * cp-tree.h (LAMBDA_EXPR_MUTABLE_P): Remove.
793 * cp-tree.def: Remove documentation.
794 * lambda.cc (build_lambda_expr): Remove reference.
795 * parser.cc (cp_parser_lambda_declarator_opt): Likewise.
796 * pt.cc (tsubst_lambda_expr): Likewise.
797 * ptree.cc (cxx_print_lambda_node): Likewise.
798 * semantics.cc (capture_decltype): Get the object quals
799 from the object instead.
801 2023-11-29 Marek Polacek <polacek@redhat.com>
804 * constexpr.cc (cxx_eval_constant_expression) <case PARM_DECL>: Allow
805 reference to unknown/this as per P2280.
806 <case VAR_DECL>: Allow reference to unknown as per P2280.
808 2023-11-29 Patrick Palka <ppalka@redhat.com>
811 * pt.cc (tsubst_expr) <case MODOP_EXPR>: Look through implicit
812 INDIRECT_REF when propagating -Wparentheses warning suppression.
813 * semantics.cc (maybe_warn_unparenthesized_assignment): Replace
814 REFERENCE_REF_P handling with STRIP_REFERENCE_REF.
815 (finish_parenthesized_expr): Likewise.
817 2023-11-29 Jakub Jelinek <jakub@redhat.com>
819 * semantics.cc (finish_static_assert): Free buf on error return.
821 2023-11-29 Alexandre Oliva <oliva@adacore.com>
823 * decl.cc (maybe_prepare_return_this): Split out of...
824 (maybe_return_this): ... this.
825 * cp-tree.h (maybe_prepare_return_this): Declare.
826 * class.cc (build_clone): Call it.
828 2023-11-29 Alexandre Oliva <oliva@adacore.com>
830 * contracts.cc (check_postcondition_result): Cope with
833 2023-11-28 Jason Merrill <jason@redhat.com>
837 * call.cc (convert_like_internal): Remove obsolete comment.
838 * typeck.cc (decay_conversion): Allow array prvalue.
839 (maybe_warn_about_returning_address_of_local): Check
840 for returning pointer to temporary.
842 2023-11-28 Jakub Jelinek <jakub@redhat.com>
844 * cp-objcp-common.cc (cp_feature_table): Evaluate
845 __has_extension (cxx_init_captures) to 1 even for -std=c++11.
847 2023-11-27 Alex Coplan <alex.coplan@arm.com>
848 Iain Sandoe <iain@sandoe.co.uk>
851 * cp-lang.cc (c_family_register_lang_features): New.
852 * cp-objcp-common.cc (struct cp_feature_selector): New.
853 (cp_feature_selector::has_feature): New.
854 (struct cp_feature_info): New.
855 (cp_register_features): New.
856 * cp-objcp-common.h (cp_register_features): New.
858 2023-11-25 Nathaniel Shead <nathanieloshead@gmail.com>
860 * name-lookup.cc (check_can_export_using_decl): New.
861 (do_nonmember_using_decl): Use above to check if names can be
864 2023-11-25 Nathaniel Shead <nathanieloshead@gmail.com>
867 * decl.cc (duplicate_decls): Allow exporting a redeclaration of
870 2023-11-24 Tobias Burnus <tobias@codesourcery.com>
872 * parser.cc (cp_parser_omp_clause_dist_schedule,
873 cp_parser_omp_scan_loop_body, cp_parser_omp_assumption_clauses,
874 cp_parser_omp_depobj): Add OPT_Wopenmp to warning_at.
875 * semantics.cc (finish_omp_clauses): Likewise.
877 2023-11-24 Tobias Burnus <tobias@codesourcery.com>
879 * parser.cc (cp_parser_omp_depobj): Accept optionally an argument
880 to the destroy clause.
882 2023-11-24 Nathaniel Shead <nathanieloshead@gmail.com>
885 * decl.cc (grokvardecl): Don't mark variables attached to
888 2023-11-24 Nathaniel Shead <nathanieloshead@gmail.com>
891 * module.cc (trees_out::get_merge_kind): Handle lambdas in class
893 (maybe_key_decl): Remove assertion and fix whitespace.
895 2023-11-24 Nathaniel Shead <nathanieloshead@gmail.com>
898 * decl.cc (duplicate_decls): Adjust error message.
899 (xref_tag): Adjust error message. Check exporting decl that is
900 already declared as non-exporting.
902 2023-11-23 Jakub Jelinek <jakub@redhat.com>
905 * parser.cc: Implement C++26 P2741R3 - user-generated static_assert
907 (cp_parser_static_assert): Parse message argument as
908 conditional-expression if it is not a pure string literal or
909 several of them concatenated followed by closing paren.
910 * semantics.cc (finish_static_assert): Handle message which is not
911 STRING_CST. For condition with bare parameter packs return early.
912 * pt.cc (tsubst_expr) <case STATIC_ASSERT>: Also tsubst_expr
913 message and make sure that if it wasn't originally STRING_CST, it
914 isn't after tsubst_expr either.
916 2023-11-22 Patrick Palka <ppalka@redhat.com>
919 * pt.cc (tsubst_aggr_type): Handle empty TYPE_TEMPLATE_INFO
920 in the entering_scope adjustment.
922 2023-11-22 Jason Merrill <jason@redhat.com>
924 * decl.cc (start_preparsed_function): Clarify ctype logic.
926 2023-11-20 Marc Poulhiès <dkm@kataplop.net>
928 * lambda.cc (compare_lambda_sig): Fix typo in variadic.
930 2023-11-20 Jason Merrill <jason@redhat.com>
932 * pt.cc (comp_template_parms): Just one level.
933 (template_parameter_lists_equivalent_p): Likewise.
935 2023-11-20 Jason Merrill <jason@redhat.com>
937 * cp-tree.h (DECL_TEMPLATE_PARM_CHECK): New.
938 (DECL_IMPLICIT_TEMPLATE_PARM_P): New.
939 (decl_template_parm_check): New.
940 * mangle.cc (write_closure_template_head): Use it.
941 * parser.cc (synthesize_implicit_template_parm): Likewise.
942 * pt.cc (template_parameters_equivalent_p): Likewise.
944 2023-11-19 Nathaniel Shead <nathanieloshead@gmail.com>
947 * cp-tree.h (enum cp_tree_index): Add CPTI_THREAD_ATEXIT.
948 (thread_atexit_node): New.
949 * decl.cc (get_thread_atexit_node): Cache in thread_atexit_node.
951 2023-11-19 David Malcolm <dmalcolm@redhat.com>
953 * mapper-client.cc: Include "rich-location.h".
955 2023-11-16 Jakub Jelinek <jakub@redhat.com>
958 * class.cc (layout_class_type): Don't
959 SET_DECL_FIELD_CXX_ZERO_WIDTH_BIT_FIELD on FIELD_DECLs with
960 error_mark_node type.
962 2023-11-16 Patrick Palka <ppalka@redhat.com>
966 * constexpr.cc (potential_constant_expression_1) <case CALL_EXPR>:
967 Fix FUNCTION_POINTER_TYPE_P test.
969 2023-11-16 Marek Polacek <polacek@redhat.com>
972 * parser.cc (cp_parser_direct_declarator): Maybe call
973 abort_fully_implicit_template if it turned out the parameter list was
976 2023-11-15 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
978 * tree.cc (build_cplus_array_type): Revert using the macro
981 2023-11-15 Patrick Palka <ppalka@redhat.com>
984 * decl.cc (is_direct_enum_init): Check type-dependence of the
987 2023-11-15 Patrick Palka <ppalka@redhat.com>
990 * tree.cc (strip_typedefs_expr) <case TREE_LIST>: Handle
991 non-empty TREE_PURPOSE.
993 2023-11-15 Patrick Palka <ppalka@redhat.com>
996 * tree.cc (build_min_non_dep): Propagate TREE_SIDE_EFFECTS from
997 the original arguments.
998 (build_min_non_dep_call_vec): Likewise.
999 * typeck2.cc (build_m_component_ref): Use cp_convert, build2 and
1000 cp_fully_fold instead of fold_build_pointer_plus and fold_convert.
1001 Don't build the POINTER_PLUS_EXPR in a template context.
1003 2023-11-15 Patrick Palka <ppalka@redhat.com>
1007 * constexpr.cc (potential_constant_expression_1) <case VAR_DECL>:
1008 Only consider var_in_maybe_constexpr_fn if 'now' is false.
1009 <case INDIRECT_REF>: Likewise.
1011 2023-11-15 Jakub Jelinek <jakub@redhat.com>
1013 * typeck.cc: Implement C++26 P2864R2 - Remove Deprecated Arithmetic
1014 Conversion on Enumerations From C++26.
1015 (do_warn_enum_conversions): Return bool rather than void, add COMPLAIN
1016 argument. Use pedwarn rather than warning_at for C++26 and remove
1017 " is deprecated" part of the diagnostics in that case. For SFINAE
1018 in C++26 return true on newly erroneous cases.
1019 (cp_build_binary_op): For C++26 call do_warn_enum_conversions
1020 unconditionally, pass complain argument to it and if it returns true,
1021 return error_mark_node.
1022 * call.cc (build_conditional_expr): Use pedwarn rather than warning_at
1023 for C++26 and remove " is deprecated" part of the diagnostics in that
1024 case and check for complain & tf_warning_or_error. Use emit_diagnostic
1025 with cxx_dialect >= cxx26 ? DK_PEDWARN : DK_WARNING. For SFINAE in
1026 C++26 return error_mark_node on newly erroneous cases.
1027 (build_new_op): Use emit_diagnostic with cxx_dialect >= cxx26
1028 ? DK_PEDWARN : DK_WARNING and complain & tf_warning_or_error check
1029 for C++26. For SFINAE in C++26 return error_mark_node on newly
1032 2023-11-14 Nathaniel Shead <nathanieloshead@gmail.com>
1035 * module.cc (trees_out::decl_node): Write DECL_VINDEX for
1037 (trees_in::tree_node): Read DECL_VINDEX for virtual clones.
1039 2023-11-14 Nathaniel Shead <nathanieloshead@gmail.com>
1042 * name-lookup.cc (do_nonmember_using_decl): Handle
1043 TEMPLATE_DECLs when checking module attachment.
1045 2023-11-14 David Malcolm <dmalcolm@redhat.com>
1047 * decl.cc (finish_function): Update call to
1048 global_dc->m_option_enabled to use option_enabled_p.
1050 2023-11-14 David Malcolm <dmalcolm@redhat.com>
1052 * contracts.cc (build_comment): Use global_dc's file_cache.
1054 2023-11-14 Jonathan Wakely <jwakely@redhat.com>
1058 * call.cc (convert_like_internal): Use OPT_Wnarrowing for
1059 pedwarns about illformed conversions involving extended
1060 floating-point types. Clarify that ISO C++ requires these
1063 2023-11-14 Jakub Jelinek <jakub@redhat.com>
1066 * call.cc (magic_varargs_p): Return 4 for
1067 BUILT_IN_{CLZ,CTZ,CLRSB,FFS,PARITY,POPCOUNT}G.
1068 (build_over_call): Don't promote first argument of
1069 BUILT_IN_{CLZ,CTZ,CLRSB,FFS,PARITY,POPCOUNT}G.
1070 * cp-gimplify.cc (cp_gimplify_expr): For BUILT_IN_C{L,T}ZG use
1073 2023-11-10 Patrick Palka <ppalka@redhat.com>
1076 * cp-tree.h (STRIP_REFERENCE_REF): Define.
1077 * semantics.cc (outer_var_p): Assert REFERENCE_REF_P is false.
1078 (finish_decltype_type): Look through implicit INDIRECT_REF when
1079 deciding whether to call capture_decltype.
1081 2023-11-10 Patrick Palka <ppalka@redhat.com>
1085 * semantics.cc (finish_decltype_type): Handle an id-expression
1086 naming a capture proxy specially.
1088 2023-11-07 Kwok Cheung Yeung <kcy@codesourcery.com>
1090 * cp-tree.h (cp_omp_declare_target_attr): Add indirect field.
1091 * decl2.cc (cplus_decl_attributes): Add attribute for indirect
1093 * parser.cc (cp_parser_omp_clause_name): Handle indirect clause.
1094 (cp_parser_omp_clause_indirect): New.
1095 (cp_parser_omp_all_clauses): Handle indirect clause.
1096 (handle_omp_declare_target_clause): Add extra parameter. Add
1097 indirect attribute for indirect functions.
1098 (OMP_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
1099 (cp_parser_omp_declare_target): Handle indirect clause. Emit error
1100 message if device_type or indirect clauses used alone. Emit error
1101 if indirect clause used with device_type that is not 'any'.
1102 (OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
1103 (cp_parser_omp_begin): Handle indirect clause.
1104 * semantics.cc (finish_omp_clauses): Handle indirect clause.
1106 2023-11-04 Jakub Jelinek <jakub@redhat.com>
1108 * parser.h (struct cp_parser): Adjust comment on omp_attrs_forbidden_p
1110 * parser.cc (cp_parser_omp_section_scan): Allow __directive__ spelling.
1112 2023-11-04 David Malcolm <dmalcolm@redhat.com>
1114 * call.cc: Update for changes to diagnostic_context.
1115 * class.cc: Likewise.
1116 * decl.cc: Likewise.
1117 * error.cc: Likewise.
1118 * except.cc: Likewise.
1121 2023-11-02 Jason Merrill <jason@redhat.com>
1123 * semantics.cc (nrv_data): Change visited to hash_set.
1124 (finalize_nrv_r): Reorganize.
1126 2023-11-02 Jason Merrill <jason@redhat.com>
1131 * except.cc (maybe_splice_retval_cleanup): Clear
1132 current_retval_sentinel when destroying retval.
1133 * semantics.cc (nrv_data): Add in_nrv_cleanup.
1134 (finalize_nrv): Set it.
1135 (finalize_nrv_r): Fix handling of throwing cleanups.
1137 2023-11-02 Jakub Jelinek <jakub@redhat.com>
1140 * parser.cc: Implement C++26 P2361R6 - Unevaluated strings.
1141 (uneval_string_attr): New enumerator.
1142 (cp_parser_string_literal_common): Add UNEVAL argument. If true,
1143 pass CPP_UNEVAL_STRING rather than CPP_STRING to
1144 cpp_interpret_string_notranslate.
1145 (cp_parser_string_literal, cp_parser_userdef_string_literal): Adjust
1146 callers of cp_parser_string_literal_common.
1147 (cp_parser_unevaluated_string_literal): New function.
1148 (cp_parser_parenthesized_expression_list): Handle uneval_string_attr.
1149 (cp_parser_linkage_specification): Use
1150 cp_parser_unevaluated_string_literal for C++26.
1151 (cp_parser_static_assert): Likewise.
1152 (cp_parser_std_attribute): Use uneval_string_attr for standard
1153 deprecated and nodiscard attributes.
1155 2023-10-31 David Malcolm <dmalcolm@redhat.com>
1157 * module.cc (ordinary_loc_of): Update for removal of
1158 MACRO_MAP_EXPANSION_POINT_LOCATION.
1159 (module_state::note_location): Update for renaming of field.
1160 (module_state::write_macro_maps): Likewise.
1162 2023-10-27 Patrick Palka <ppalka@redhat.com>
1165 * init.cc (build_new_1): Remove unnecessary call to convert
1166 on 'nelts'. Use build2 instead of fold_build2 for
1167 'outer_nelts_checks'.
1169 2023-10-27 Patrick Palka <ppalka@redhat.com>
1171 * cp-tree.h (maybe_warn_unparenthesized_assignment): Declare.
1172 * semantics.cc (is_assignment_op_expr_p): Generalize to return
1173 true for any assignment operator expression, not just one that
1174 has been resolved to an operator overload.
1175 (maybe_warn_unparenthesized_assignment): Factored out from ...
1176 (maybe_convert_cond): ... here.
1177 (finish_parenthesized_expr): Mention
1178 maybe_warn_unparenthesized_assignment.
1179 * typeck.cc (convert_for_assignment): Replace -Wparentheses
1180 warning logic with maybe_warn_unparenthesized_assignment.
1182 2023-10-27 Lewis Hyatt <lhyatt@gmail.com>
1184 PR preprocessor/87299
1185 * parser.cc (cp_lexer_new_main): Call c_reset_target_pragmas ()
1186 after preprocessing is complete, before starting compilation.
1188 2023-10-26 liuhongt <hongtao.liu@intel.com>
1190 * typeck.cc (build_vec_cmp): Pass type of arg0 to
1193 2023-10-25 Jason Merrill <jason@redhat.com>
1195 * cp-tree.def: Improve OFFSET_REF comment.
1196 * cp-gimplify.cc (cp_fold_immediate): Add to comment.
1198 2023-10-25 Thomas Schwinge <thomas@codesourcery.com>
1200 * parser.cc (cp_parser_omp_clause_name): Return
1201 'PRAGMA_OACC_CLAUSE_SELF' for "self".
1202 (cp_parser_oacc_data_clause, OACC_UPDATE_CLAUSE_MASK): Adjust.
1203 (cp_parser_oacc_all_clauses): Remove 'bool compute_p' formal
1204 parameter, and instead locally determine whether we're called for
1205 an OpenACC compute construct or OpenACC 'update' directive.
1206 (cp_parser_oacc_compute): Adjust.
1208 2023-10-25 Chung-Lin Tang <cltang@codesourcery.com>
1210 * parser.cc (cp_parser_oacc_compute_clause_self): New function.
1211 (cp_parser_oacc_all_clauses): Add new 'bool compute_p = false'
1212 parameter, add parsing of self clause when compute_p is true.
1213 (OACC_KERNELS_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_SELF.
1214 (OACC_PARALLEL_CLAUSE_MASK): Likewise,
1215 (OACC_SERIAL_CLAUSE_MASK): Likewise.
1216 (cp_parser_oacc_compute): Adjust call to c_parser_oacc_all_clauses to
1217 set compute_p argument to true.
1218 * pt.cc (tsubst_omp_clauses): Add OMP_CLAUSE_SELF case.
1219 * semantics.cc (c_finish_omp_clauses): Add OMP_CLAUSE_SELF case, merged
1220 with OMP_CLAUSE_IF case.
1222 2023-10-25 Marek Polacek <polacek@redhat.com>
1225 * typeck.cc (build_static_cast_1): Call decay_conversion.
1227 2023-10-24 Patrick Palka <ppalka@redhat.com>
1230 * init.cc (build_new_1): Use convert, build2, build3 and
1231 cp_fully_fold instead of fold_convert, size_binop and
1232 fold_build3 when building up 'size'.
1234 2023-10-24 Patrick Palka <ppalka@redhat.com>
1237 * tree.cc (cp_stabilize_reference): Do nothing when
1238 processing_template_decl.
1240 2023-10-22 Patrick Palka <ppalka@redhat.com>
1243 * pt.cc (tsubst_expr) <case AT_ENCODE_EXPR>: Use tsubst instead
1246 2023-10-20 Jason Merrill <jason@redhat.com>
1248 * call.cc (implicit_conversion_1): Rename...
1249 (implicit_conversion): ...to this. Remove the old wrapper.
1251 2023-10-20 Jason Merrill <jason@redhat.com>
1253 * call.cc (tourney): Only skip champ_compared_to_predecessor.
1255 2023-10-20 Nathan Sidwell <nathan@acm.org>
1258 * module.cc (trees_out::core_vals): Stream CONSTRUCTOR operands
1260 (trees_in::core_vals): Likewise.
1262 2023-10-20 Patrick Palka <ppalka@redhat.com>
1264 * cp-lang.cc (objcp_tsubst_copy_and_build): Rename to ...
1265 (objcp_tsubst_expr): ... this.
1266 * cp-objcp-common.h (objcp_tsubst_copy_and_build): Rename to ...
1267 (objcp_tsubst_expr): ... this.
1268 * cp-tree.h (tsubst_copy_and_build): Remove declaration.
1269 * init.cc (maybe_instantiate_nsdmi_init): Use tsubst_expr
1270 instead of tsubst_copy_and_build.
1271 * pt.cc (expand_integer_pack): Likewise.
1272 (instantiate_non_dependent_expr_internal): Likewise.
1273 (instantiate_class_template): Use tsubst_stmt instead of
1274 tsubst_expr for STATIC_ASSERT.
1275 (tsubst_function_decl): Adjust tsubst_copy_and_build uses.
1276 (tsubst_arg_types): Likewise.
1277 (tsubst_exception_specification): Likewise.
1278 (tsubst_tree_list): Likewise.
1280 (tsubst_name): Likewise.
1281 (tsubst_omp_clause_decl): Use tsubst_stmt instead of tsubst_expr.
1282 (tsubst_omp_clauses): Likewise.
1283 (tsubst_copy_asm_operands): Adjust tsubst_copy_and_build use.
1284 (tsubst_omp_for_iterator): Use tsubst_stmt instead of tsubst_expr.
1285 (tsubst_expr): Rename to ...
1286 (tsubst_stmt): ... this.
1287 <case CO_YIELD_EXPR, CO_AWAIT_EXPR>: Move to tsubst_expr.
1288 (tsubst_omp_udr): Use tsubst_stmt instead of tsubst_expr.
1289 (tsubst_non_call_postfix_expression): Adjust tsubst_copy_and_build
1291 (tsubst_lambda_expr): Likewise. Use tsubst_stmt instead of
1292 tsubst_expr for the body of a lambda.
1293 (tsubst_copy_and_build_call_args): Rename to ...
1294 (tsubst_call_args): ... this. Adjust tsubst_copy_and_build use.
1295 (tsubst_copy_and_build): Rename to tsubst_expr. Adjust
1296 tsubst_copy_and_build and tsubst_copy_and_build_call_args use.
1297 <case TRANSACTION_EXPR>: Use tsubst_stmt instead of tsubst_expr.
1298 (maybe_instantiate_noexcept): Adjust tsubst_copy_and_build use.
1299 (instantiate_body): Use tsubst_stmt instead of tsubst_expr for
1300 substituting the function body.
1301 (tsubst_initializer_list): Adjust tsubst_copy_and_build use.
1303 2023-10-20 Patrick Palka <ppalka@redhat.com>
1305 * cp-tree.h (enum tsubst_flags): Add tf_no_name_lookup.
1306 * pt.cc (tsubst_pack_expansion): Use tsubst for substituting
1308 (tsubst_decl) <case USING_DECL>: Use tsubst_name instead of
1310 (tsubst) <case TEMPLATE_TYPE_PARM>: Use tsubst_copy_and_build
1311 instead of tsubst_copy for substituting
1312 CLASS_PLACEHOLDER_TEMPLATE.
1313 <case TYPENAME_TYPE>: Use tsubst_name instead of tsubst_copy for
1314 substituting TYPENAME_TYPE_FULLNAME.
1315 (tsubst_name): Define.
1316 (tsubst_qualified_id): Use tsubst_name instead of tsubst_copy
1317 for substituting the component name of a SCOPE_REF.
1318 (tsubst_copy): Remove.
1319 (tsubst_copy_and_build): Clear tf_no_name_lookup at the start,
1320 and remember if it was set. Call maybe_dependent_member_ref if
1321 tf_no_name_lookup was not set.
1322 <case IDENTIFIER_NODE>: Don't do name lookup if tf_no_name_lookup
1324 <case TEMPLATE_ID_EXPR>: If tf_no_name_lookup was set, use
1325 tsubst_name instead of tsubst_copy_and_build to substitute the
1326 template and don't finish the template-id.
1327 <case BIT_NOT_EXPR>: Handle identifier and type operand (if
1328 tf_no_name_lookup was set).
1329 <case SCOPE_REF>: Avoid trying to resolve a SCOPE_REF if
1330 tf_no_name_lookup was set by calling build_qualified_name directly
1331 instead of tsubst_qualified_id.
1332 <case SIZEOF_EXPR>: Handling of sizeof... copied from tsubst_copy.
1333 <case CALL_EXPR>: Use tsubst_name instead of tsubst_copy to
1334 substitute a TEMPLATE_ID_EXPR callee naming an unresolved template.
1335 <case COMPONENT_REF>: Likewise to substitute the member.
1336 <case FUNCTION_DECL>: Copied from tsubst_copy and merged with ...
1337 <case VAR_DECL, PARM_DECL>: ... these. Initial handling copied
1338 from tsubst_copy. Optimize local variable substitution by
1339 trying retrieve_local_specialization before checking
1340 uses_template_parms.
1341 <case CONST_DECL>: Copied from tsubst_copy.
1342 <case FIELD_DECL>: Likewise.
1343 <case NAMESPACE_DECL>: Likewise.
1344 <case OVERLOAD>: Likewise.
1345 <case TEMPLATE_DECL>: Likewise.
1346 <case TEMPLATE_PARM_INDEX>: Likewise.
1347 <case TYPE_DECL>: Likewise.
1348 <case CLEANUP_POINT_EXPR>: Likewise.
1349 <case OFFSET_REF>: Likewise.
1350 <case EXPR_PACK_EXPANSION>: Likewise.
1351 <case NONTYPE_ARGUMENT_PACK>: Likewise.
1352 <case *_CST>: Likewise.
1353 <case *_*_FOLD_EXPR>: Likewise.
1354 <case DEBUG_BEGIN_STMT>: Likewise.
1355 <case CO_AWAIT_EXPR>: Likewise.
1356 <case TRAIT_EXPR>: Use tsubst and tsubst_copy_and_build instead
1358 <default>: Copied from tsubst_copy.
1359 (tsubst_initializer_list): Use tsubst and tsubst_copy_and_build
1360 instead of tsubst_copy.
1362 2023-10-20 Patrick Palka <ppalka@redhat.com>
1365 * parser.cc (cp_parser_postfix_expression): Consolidate three
1366 calls to finish_call_expr, one to build_new_method_call and
1367 one to build_min_nt_call_vec into one call to finish_call_expr.
1368 Don't call maybe_generic_this_capture here.
1369 * pt.cc (tsubst_copy_and_build) <case CALL_EXPR>: Remove
1370 COMPONENT_REF callee handling.
1371 (type_dependent_expression_p): Use t_d_object_e_p instead of
1372 t_d_e_p for COMPONENT_REF and OFFSET_REF.
1373 * semantics.cc (finish_call_expr): In the type-dependent case,
1374 call maybe_generic_this_capture here instead.
1376 2023-10-20 Patrick Palka <ppalka@redhat.com>
1378 * call.cc (build_new_method_call): Remove calls to
1379 build_non_dependent_expr and/or make_args_non_dependent.
1380 * coroutines.cc (finish_co_return_stmt): Likewise.
1381 * cp-tree.h (build_non_dependent_expr): Remove.
1382 (make_args_non_dependent): Remove.
1383 * decl2.cc (grok_array_decl): Remove calls to
1384 build_non_dependent_expr and/or make_args_non_dependent.
1385 (build_offset_ref_call_from_tree): Likewise.
1386 * init.cc (build_new): Likewise.
1387 * pt.cc (make_args_non_dependent): Remove.
1388 (test_build_non_dependent_expr): Remove.
1389 (cp_pt_cc_tests): Adjust.
1390 * semantics.cc (finish_expr_stmt): Remove calls to
1391 build_non_dependent_expr and/or make_args_non_dependent.
1392 (finish_for_expr): Likewise.
1393 (finish_call_expr): Likewise.
1394 (finish_omp_atomic): Likewise.
1395 * typeck.cc (finish_class_member_access_expr): Likewise.
1396 (build_x_indirect_ref): Likewise.
1397 (build_x_binary_op): Likewise.
1398 (build_x_array_ref): Likewise.
1399 (build_x_vec_perm_expr): Likewise.
1400 (build_x_shufflevector): Likewise.
1401 (build_x_unary_op): Likewise.
1402 (cp_build_addressof): Likewise.
1403 (build_x_conditional_expr): Likewise.
1404 (build_x_compound_expr): Likewise.
1405 (build_static_cast): Likewise.
1406 (build_x_modify_expr): Likewise.
1407 (check_return_expr): Likewise.
1408 * typeck2.cc (build_x_arrow): Likewise.
1410 2023-10-20 Patrick Palka <ppalka@redhat.com>
1412 * class.cc (instantiate_type): Remove NON_DEPENDENT_EXPR
1414 * constexpr.cc (cxx_eval_constant_expression): Likewise.
1415 (potential_constant_expression_1): Likewise.
1416 * coroutines.cc (coro_validate_builtin_call): Don't
1417 expect ALIGNOF_EXPR to be wrapped in NON_DEPENDENT_EXPR.
1418 * cp-objcp-common.cc (cp_common_init_ts): Remove
1419 NON_DEPENDENT_EXPR handling.
1420 * cp-tree.def (NON_DEPENDENT_EXPR): Remove.
1421 * cp-tree.h (build_non_dependent_expr): Temporarily redefine as
1422 the identity function.
1423 * cvt.cc (maybe_warn_nodiscard): Handle type-dependent and
1424 variable callee of CALL_EXPR.
1425 * cxx-pretty-print.cc (cxx_pretty_printer::expression): Remove
1426 NON_DEPENDENT_EXPR handling.
1427 * error.cc (dump_decl): Likewise.
1428 (dump_expr): Likewise.
1429 * expr.cc (mark_use): Likewise.
1430 (mark_exp_read): Likewise.
1431 * pt.cc (build_non_dependent_expr): Remove.
1432 * tree.cc (lvalue_kind): Remove NON_DEPENDENT_EXPR handling.
1433 (cp_stabilize_reference): Likewise.
1434 * typeck.cc (warn_for_null_address): Likewise.
1435 (cp_build_binary_op): Handle type-dependent SIZEOF_EXPR operands.
1436 (cp_build_unary_op) <case TRUTH_NOT_EXPR>: Don't fold inside a
1439 2023-10-20 Alexandre Oliva <oliva@adacore.com>
1441 * decl.cc (push_throw_library_fn): Mark with ECF_XTHROW.
1442 * except.cc (build_throw): Likewise __cxa_throw,
1443 _ITM_cxa_throw, __cxa_rethrow.
1445 2023-10-20 Nathaniel Shead <nathanieloshead@gmail.com>
1449 * call.cc (build_over_call): Fold more indirect refs for trivial
1451 * class.cc (type_has_non_deleted_trivial_default_ctor): Create.
1452 * constexpr.cc (cxx_eval_call_expression): Start lifetime of
1453 union member before entering constructor.
1454 (cxx_eval_component_reference): Check against first member of
1455 value-initialised union.
1456 (cxx_eval_store_expression): Activate member for
1457 value-initialised union. Check for accessing inactive union
1459 * cp-tree.h (type_has_non_deleted_trivial_default_ctor):
1462 2023-10-20 Nathaniel Shead <nathanieloshead@gmail.com>
1464 * constexpr.cc (is_std_source_location_current): New.
1465 (cxx_eval_constant_expression): Only ignore cast from void* for
1466 specific cases and improve other diagnostics.
1468 2023-10-19 Marek Polacek <polacek@redhat.com>
1470 * cp-gimplify.cc (cp_fold_r): Don't call maybe_constant_value.
1472 2023-10-19 Jason Merrill <jason@redhat.com>
1474 * typeck2.cc (check_narrowing): Adjust.
1476 2023-10-19 Jason Merrill <jason@redhat.com>
1478 * parser.cc (cp_parser_primary_expression): Use G_.
1479 (cp_parser_using_enum): Likewise.
1480 * decl.cc (identify_goto): Likewise.
1482 2023-10-18 Jason Merrill <jason@redhat.com>
1484 * typeck2.cc (check_narrowing): Use permerror.
1486 2023-10-17 Marek Polacek <polacek@redhat.com>
1489 * parser.cc (cp_parser_simple_declaration): Do cp_parser_error
1492 2023-10-17 Marek Polacek <polacek@redhat.com>
1495 * cp-gimplify.cc (cp_fold_immediate_r) <case COND_EXPR>: Don't
1497 (cp_fold_r): Handle COND_EXPR here.
1499 2023-10-17 Jason Merrill <jason@redhat.com>
1501 * mangle.cc (abi_check): New.
1502 (write_prefix, write_unqualified_name, write_discriminator)
1503 (write_type, write_member_name, write_expression)
1504 (write_template_arg, write_template_param): Use it.
1505 (start_mangling): Assign from {}.
1506 * cp-tree.h: Update comment.
1508 2023-10-17 Nathaniel Shead <nathanieloshead@gmail.com>
1510 * constexpr.cc (cxx_eval_dynamic_cast_fn): Add missing
1511 auto_diagnostic_group.
1512 (cxx_eval_call_expression): Likewise.
1513 (diag_array_subscript): Likewise.
1514 (outside_lifetime_error): Likewise.
1515 (potential_constant_expression_1): Likewise.
1517 2023-10-16 Jason Merrill <jason@redhat.com>
1519 * parser.cc (cp_parser_fold_expression): Track location range.
1520 * semantics.cc (finish_unary_fold_expr)
1521 (finish_left_unary_fold_expr, finish_right_unary_fold_expr)
1522 (finish_binary_fold_expr): Add location parm.
1523 * constraint.cc (finish_shorthand_constraint): Pass it.
1524 * pt.cc (convert_generic_types_to_packs): Likewise.
1525 * cp-tree.h: Adjust.
1527 2023-10-16 Marek Polacek <polacek@redhat.com>
1530 * constexpr.cc (explain_invalid_constexpr_fn): Also check the body of
1531 a constructor in C++14 and up.
1533 2023-10-14 Jakub Jelinek <jakub@redhat.com>
1536 * module.cc (trees_out::start, trees_in::start): Remove
1537 TREE_INT_CST_OFFSET_NUNITS handling.
1539 2023-10-10 Jason Merrill <jason@redhat.com>
1542 * mangle.cc (write_template_param): Also mangle level.
1544 2023-10-08 David Malcolm <dmalcolm@redhat.com>
1546 * module.cc (module_state::read_location): Update for renaming of
1547 get_combined_adhoc_loc.
1549 2023-10-03 David Malcolm <dmalcolm@redhat.com>
1551 * error.cc (print_instantiation_partial_context_line): Call
1552 diagnostic_show_locus.
1554 2023-10-03 David Malcolm <dmalcolm@redhat.com>
1556 * error.cc: Update for "m_" prefixes to text_info fields.
1558 2023-09-30 Eugene Rozenfeld <erozen@microsoft.com>
1560 * Make-lang.in: Make create_fdas_for_cc1plus target not .PHONY
1562 2023-09-28 Richard Sandiford <richard.sandiford@arm.com>
1564 * constexpr.cc (cxx_fold_indirect_ref): Remove unused variables.
1566 2023-09-22 Jason Merrill <jason@redhat.com>
1569 * pt.cc (expand_integer_pack): Use IMPLICIT_CONV_EXPR.
1571 2023-09-22 Jason Merrill <jason@redhat.com>
1573 * constexpr.cc (free_constructor): Handle null ce->value.
1575 2023-09-22 Jason Merrill <jason@redhat.com>
1578 * parser.cc (cp_parser_lambda_declarator_opt): Don't suggest
1579 -std=c++14 for lambda templates.
1580 * pt.cc (tsubst_expr): Move ANNOTATE_EXPR handling...
1581 (tsubst_copy_and_build): ...here.
1583 2023-09-22 Patrick Palka <ppalka@redhat.com>
1586 * decl2.cc (grok_array_decl): Guard diagnostic and backward
1587 compatibility fallback code paths with tf_error.
1589 2023-09-22 Patrick Palka <ppalka@redhat.com>
1592 * pt.cc (is_compatible_template_arg): New parameter 'args'.
1593 Add the outer template arguments 'args' to 'new_args'.
1594 (convert_template_argument): Pass 'args' to
1595 is_compatible_template_arg.
1597 2023-09-20 Jakub Jelinek <jakub@redhat.com>
1599 * parser.cc (cp_parser_postfix_expression): Parse
1600 __builtin_classify_type call with typename as argument.
1601 * pt.cc (tsubst_copy_and_build): Handle __builtin_classify_type
1602 with dependent typename as argument.
1604 2023-09-20 Patrick Palka <ppalka@redhat.com>
1607 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
1608 <case VAR_DECL>: Handle class NTTP objects by printing
1609 their type and value.
1610 <case VIEW_CONVERT_EXPR>: Strip const VIEW_CONVERT_EXPR
1611 wrappers for class NTTPs.
1612 (pp_cxx_template_argument_list): Don't handle class NTTP
1615 2023-09-20 Patrick Palka <ppalka@redhat.com>
1617 * pt.cc (tsubst_function_decl): Don't bother computing 'argvec'
1618 when 'lambda_fntype' is set.
1619 (tsubst_template_decl): Make sure we return a TEMPLATE_DECL
1620 during specialization lookup. In the non-class non-function
1621 template case, use tsubst_decl directly with use_spec_table=false,
1622 update DECL_TI_ARGS and call register_specialization like
1623 tsubst_decl would have done if use_spec_table=true.
1625 2023-09-20 Jakub Jelinek <jakub@redhat.com>
1628 * parser.h (struct cp_lexer): Add in_omp_decl_attribute member.
1629 * cp-tree.h (cp_maybe_parse_omp_decl): Declare.
1630 * parser.cc (cp_parser_handle_statement_omp_attributes): Diagnose
1631 omp::decl attribute on statements. Adjust diagnostic wording for
1633 (cp_parser_omp_directive_args): Add DECL_P argument, set TREE_PUBLIC
1634 to it on the DEFERRED_PARSE tree.
1635 (cp_parser_omp_sequence_args): Adjust caller.
1636 (cp_parser_std_attribute): Handle omp::decl attribute.
1637 (cp_parser_omp_var_list): If parser->lexer->in_omp_decl_attribute
1638 don't expect any arguments, instead create clause or TREE_LIST for
1640 (cp_parser_late_parsing_omp_declare_simd): Adjust diagnostic wording
1642 (cp_maybe_parse_omp_decl): New function.
1643 (cp_parser_omp_declare_target): If
1644 parser->lexer->in_omp_decl_attribute and first token isn't name or
1645 comma invoke cp_parser_omp_var_list.
1646 * decl2.cc (cplus_decl_attributes): Adjust diagnostic wording for
1647 omp::decl. Handle omp::decl on declarations.
1648 * name-lookup.cc (finish_using_directive): Adjust diagnostic wording
1651 2023-09-19 Ben Boeckel <ben.boeckel@kitware.com>
1653 * mapper-client.cc, mapper-client.h (open_module_client): Accept
1654 dependency tracking and track module mapper files as
1656 * module.cc (make_mapper, get_mapper): Pass the dependency
1657 tracking class down.
1659 2023-09-19 Ben Boeckel <ben.boeckel@kitware.com>
1661 * module.cc (do_import): Report imported CMI files as
1664 2023-09-19 Ben Boeckel <ben.boeckel@kitware.com>
1666 * module.cc (preprocessed_module): Pass whether the module is
1667 exported to dependency tracking.
1669 2023-09-19 Javier Martinez <javier.martinez.bugzilla@gmail.com>
1671 * class.cc (propagate_class_warmth_attribute): New function.
1672 (check_bases_and_members): propagate hot and cold attributes
1673 to all FUNCTION_DECL when the record is marked hot or cold.
1674 * cp-tree.h (maybe_propagate_warmth_attributes): New function.
1675 * decl2.cc (maybe_propagate_warmth_attributes): New function.
1676 * method.cc (lazily_declare_fn): propagate hot and cold
1677 attributes to lazily declared functions when the record is
1680 2023-09-19 Patrick Palka <ppalka@redhat.com>
1682 * ptree.cc (cxx_print_type): Remove TYPE_LANG_SPECIFIC
1683 test guarding TYPE_TEMPLATE_INFO.
1685 2023-09-19 Jason Merrill <jason@redhat.com>
1688 * class.cc (add_implicit_default_ctor): Split out...
1689 (add_implicitly_declared_members): ...from here.
1690 Also call it when inheriting a default ctor.
1692 2023-09-19 Marek Polacek <polacek@redhat.com>
1694 * call.cc (build_over_call): Set ADDR_EXPR_DENOTES_CALL_P. Don't handle
1695 immediate_invocation_p here.
1696 * constexpr.cc (cxx_eval_call_expression): Use mce_true for
1697 DECL_IMMEDIATE_FUNCTION_P.
1698 (cxx_eval_conditional_expression): Call cp_fold_immediate.
1699 * cp-gimplify.cc (enum fold_flags): Add ff_fold_immediate.
1700 (maybe_replace_decl): Make static.
1701 (cp_fold_r): Expand immediate invocations.
1702 (cp_fold_immediate_r): New.
1703 (cp_fold_immediate): New.
1704 * cp-tree.h (ADDR_EXPR_DENOTES_CALL_P): Define.
1705 (cp_fold_immediate): Declare.
1706 * tree.cc (bot_replace): Don't handle immediate invocations here.
1708 2023-09-19 Patrick Palka <ppalka@redhat.com>
1711 * cvt.cc (convert_to_void) <case INDIRECT_REF>: Only call
1712 complete_type if the type is volatile.
1713 <case VAR_DECL>: Likewise.
1715 2023-09-19 Patrick Palka <ppalka@redhat.com>
1718 * semantics.cc (finish_decltype_type): For an NTTP object,
1719 return its type modulo cv-quals.
1721 2023-09-18 Patrick Palka <ppalka@redhat.com>
1724 * pt.cc (try_class_unification): Strengthen TI_TEMPLATE equality
1725 test by not calling most_general_template. Only unify the
1726 innermost levels of template arguments.
1727 (unify) <case CLASS_TYPE>: Only unify the innermost levels of
1728 template arguments, and only if the template is primary.
1730 2023-09-18 Patrick Palka <ppalka@redhat.com>
1734 * semantics.cc (maybe_convert_cond): Look through implicit
1735 INDIRECT_REF when deciding whether to issue a -Wparentheses
1736 warning, and consider templated assignment expressions as well.
1737 (finish_parenthesized_expr): Look through implicit INDIRECT_REF
1738 when suppressing -Wparentheses warning.
1739 * typeck.cc (build_x_modify_expr): Check simple assignments
1740 ahead time too, not just compound assignments. Give the second
1741 operand of MODOP_EXPR a non-null type so that it's not considered
1742 always instantiation-dependent. Don't call suppress_warning.
1744 2023-09-18 Patrick Palka <ppalka@redhat.com>
1747 * pt.cc (unify): Return unify_success for identical dependent
1748 DECL_P 'arg' and 'parm'.
1749 <case CONST_DECL>: Remove handling.
1751 2023-09-18 Patrick Palka <ppalka@redhat.com>
1753 * call.cc (add_template_candidate_real): Check arity even
1754 when there are no explicit template arguments. Combine the
1755 two adjacent '!obj' tests into one.
1757 2023-09-18 Patrick Palka <ppalka@redhat.com>
1759 * pt.cc (register_specialization): Remove now-unnecessary
1760 early exit for FUNCTION_DECL partial instantiation.
1761 (tsubst_template_decl): Pass use_spec_table=false to
1762 tsubst_function_decl. Set DECL_TI_ARGS of a non-lambda
1763 FUNCTION_DECL specialization to the full set of arguments.
1764 Simplify register_specialization call accordingly.
1766 2023-09-18 Jason Merrill <jason@redhat.com>
1768 * class.cc (check_subobject_offset): Use similar_type_p.
1770 2023-09-12 Jason Merrill <jason@redhat.com>
1773 * pt.cc (expand_integer_pack): Convert argument to int.
1775 2023-09-12 Jason Merrill <jason@redhat.com>
1778 * typeck2.cc (process_init_constructor_array): Use VEC_INIT_EXPR
1779 regardless of seen_error.
1781 2023-09-08 Patrick Palka <ppalka@redhat.com>
1784 * pt.cc (check_non_deducible_conversions): Add bool parameter
1785 passed down to check_non_deducible_conversion.
1786 (fn_type_unification): Call check_non_deducible_conversions
1787 an extra time before satisfaction with noninst_only_p=true.
1788 (conversion_may_instantiate_p): Define.
1789 (check_non_deducible_conversion): Add bool parameter controlling
1790 whether to compute only conversions that are guaranteed to
1791 not induce template instantiation.
1793 2023-09-07 Sandra Loosemore <sandra@codesourcery.com>
1796 * parser.cc (fixup_blocks_walker): Check for null BIND_EXPR_BLOCK.
1798 2023-09-06 Jason Merrill <jason@redhat.com>
1800 * class.cc (check_subobject_offset): Check
1801 same_type_ignoring_top_level_qualifiers_p.
1803 2023-09-05 Marek Polacek <polacek@redhat.com>
1806 * constexpr.cc (verify_constant_explain_r): New.
1807 (verify_constant): Call it.
1809 2023-09-05 Jakub Jelinek <jakub@redhat.com>
1812 * name-lookup.cc (check_local_shadow): Don't punt early for
1813 DECL_EXTERNAL decls, instead just disable the shadowing of namespace
1814 decls check for those and emit a pedwarn rather than error_at or
1815 permerror for those. Formatting fix.
1817 2023-09-05 Jakub Jelinek <jakub@redhat.com>
1820 * name-lookup.h (struct cp_binding_level): Add artificial bit-field.
1822 * name-lookup.cc (check_local_shadow): Skip artificial bindings when
1823 checking if parameter scope is parent scope. Don't special case
1824 FUNCTION_NEEDS_BODY_BLOCK. Diagnose the in_function_try_handler
1825 cases in the b->kind == sk_function_parms test and verify no
1826 non-artificial intervening scopes. Add missing auto_diagnostic_group.
1827 * decl.cc (begin_function_body): Set
1828 current_binding_level->artificial.
1829 * semantics.cc (begin_function_try_block): Likewise.
1831 2023-09-05 Patrick Palka <ppalka@redhat.com>
1833 * parser.cc (cp_parser_parenthesized_expression_list_elt): Pass
1834 nullptr as non_constant_p to cp_parser_braced_list if our
1835 non_constant_p is null.
1836 (cp_parser_initializer_list): Likewise to
1837 cp_parser_initializer_clause. Avoid inspecting
1838 clause_non_constant_p if it's uninitialized.
1840 2023-09-05 Patrick Palka <ppalka@redhat.com>
1842 * call.cc (build_user_type_conversion): Free allocated
1844 (build_converted_constant_expr_internal): Use
1845 conversion_obstack_sentinel instead.
1846 (perform_dguide_overload_resolution): Likewise.
1847 (build_new_function_call): Likewise.
1848 (build_operator_new_call): Free allocated conversions.
1849 (build_op_call): Use conversion_obstack_sentinel instead.
1850 (build_conditional_expr): Use conversion_obstack_sentinel
1851 instead, and hoist it out to the outermost scope.
1852 (build_new_op): Use conversion_obstack_sentinel instead
1853 and set it up before the first goto. Remove second unneeded goto.
1854 (build_op_subscript): Use conversion_obstack_sentinel instead.
1855 (ref_conv_binds_to_temporary): Likewise.
1856 (build_new_method_call): Likewise.
1857 (can_convert_arg): Likewise.
1858 (can_convert_arg_bad): Likewise.
1859 (perform_implicit_conversion_flags): Likewise.
1860 (perform_direct_initialization_if_possible): Likewise.
1861 (initialize_reference): Likewise.
1863 2023-09-01 Jakub Jelinek <jakub@redhat.com>
1866 * cp-tree.h (determine_local_discriminator): Add NAME argument with
1868 (struct cp_decomp): New type.
1869 (cp_finish_decl): Add DECOMP argument defaulted to nullptr.
1870 (cp_maybe_mangle_decomp): Remove declaration.
1871 (cp_finish_decomp): Add cp_decomp * argument, remove tree and unsigned
1873 (cp_convert_range_for): Likewise.
1874 * decl.cc (determine_local_discriminator): Add NAME argument, use it
1875 if non-NULL, otherwise compute it the old way.
1876 (maybe_commonize_var): Don't return early for structured bindings.
1877 (cp_finish_decl): Add DECOMP argument, if non-NULL, call
1878 cp_maybe_mangle_decomp.
1879 (cp_maybe_mangle_decomp): Make it static with a forward declaration.
1880 Call determine_local_discriminator. Replace FIRST and COUNT arguments
1881 with DECOMP argument.
1882 (cp_finish_decomp): Replace FIRST and COUNT arguments with DECOMP
1884 * mangle.cc (find_decomp_unqualified_name): Remove.
1885 (write_unqualified_name): Don't call find_decomp_unqualified_name.
1886 (mangle_decomp): Handle mangling of static function/block scope
1887 structured bindings. Don't call decl_mangling_context twice. Call
1888 check_abi_tags, call write_abi_tags for abi version >= 19 and emit
1889 -Wabi warnings if needed.
1890 (write_guarded_var_name): Handle structured bindings.
1891 (mangle_ref_init_variable): Use write_guarded_var_name.
1892 * parser.cc (cp_parser_range_for): Adjust do_range_for_auto_deduction
1893 and cp_convert_range_for callers.
1894 (do_range_for_auto_deduction): Replace DECOMP_FIRST_NAME and
1895 DECOMP_CNT arguments with DECOMP. Adjust cp_finish_decomp caller.
1896 (cp_convert_range_for): Replace DECOMP_FIRST_NAME and
1897 DECOMP_CNT arguments with DECOMP. Don't call cp_maybe_mangle_decomp,
1898 adjust cp_finish_decl and cp_finish_decomp callers.
1899 (cp_parser_decomposition_declaration): Don't call
1900 cp_maybe_mangle_decomp, adjust cp_finish_decl and cp_finish_decomp
1902 (cp_convert_omp_range_for): Adjust do_range_for_auto_deduction
1903 and cp_finish_decomp callers.
1904 (cp_finish_omp_range_for): Don't call cp_maybe_mangle_decomp,
1905 adjust cp_finish_decl and cp_finish_decomp callers.
1906 * pt.cc (tsubst_omp_for_iterator): Adjust tsubst_decomp_names
1908 (tsubst_decomp_names): Replace FIRST and CNT arguments with DECOMP.
1909 (tsubst_expr): Don't call cp_maybe_mangle_decomp, adjust
1910 tsubst_decomp_names, cp_finish_decl, cp_finish_decomp and
1911 cp_convert_range_for callers.
1913 2023-08-30 Marek Polacek <polacek@redhat.com>
1916 * parser.cc (cp_parser_initializer_list): Set CONSTRUCTOR_IS_DIRECT_INIT
1917 when the designated initializer is of the .x{} form.
1919 2023-08-30 Marek Polacek <polacek@redhat.com>
1922 * decl.cc (grokdeclarator): Disallow constinit on functions.
1924 2023-08-29 Marek Polacek <polacek@redhat.com>
1926 * call.cc (convert_like_internal): Show where the conversion function
1928 (maybe_show_nonconverting_candidate): New.
1929 * cp-tree.h (maybe_show_nonconverting_candidate): Declare.
1930 * typeck.cc (convert_for_assignment): Call it.
1932 2023-08-25 Sandra Loosemore <sandra@codesourcery.com>
1934 * cp-tree.h (cp_convert_omp_range_for): Adjust declaration.
1935 * parser.cc (struct omp_for_parse_data): New.
1936 (cp_parser_postfix_expression): Diagnose calls to OpenMP runtime
1937 in intervening code.
1938 (check_omp_intervening_code): New.
1939 (cp_parser_statement_seq_opt): Special-case nested loops, blocks,
1940 and other constructs for OpenMP loops.
1941 (cp_parser_iteration_statement): Reject loops in intervening code.
1942 (cp_parser_omp_for_loop_init): Expand comments and tweak the
1943 interface slightly to better distinguish input/output parameters.
1944 (cp_convert_omp_range_for): Likewise.
1945 (cp_parser_omp_loop_nest): New, split from cp_parser_omp_for_loop
1946 and largely rewritten. Add more comments.
1947 (insert_structured_blocks): New.
1948 (find_structured_blocks): New.
1949 (struct sit_data, substitute_in_tree_walker, substitute_in_tree):
1951 (fixup_blocks_walker): New.
1952 (cp_parser_omp_for_loop): Rewrite to use recursive descent instead
1953 of a loop. Add logic to reshuffle the bits of code collected
1954 during parsing so intervening code gets moved to the loop body.
1955 (cp_parser_omp_loop): Remove call to finish_omp_for_block, which
1957 (cp_parser_omp_simd): Likewise.
1958 (cp_parser_omp_for): Likewise.
1959 (cp_parser_omp_distribute): Likewise.
1960 (cp_parser_oacc_loop): Likewise.
1961 (cp_parser_omp_taskloop): Likewise.
1962 (cp_parser_pragma): Reject OpenMP pragmas in intervening code.
1963 * parser.h (struct cp_parser): Add omp_for_parse_state field.
1964 * pt.cc (tsubst_omp_for_iterator): Adjust call to
1965 cp_convert_omp_range_for.
1966 * semantics.cc (finish_omp_for): Try harder to preserve location
1967 of loop variable init expression for use in diagnostics.
1968 (struct fofb_data, finish_omp_for_block_walker): New.
1969 (finish_omp_for_block): Allow variables to be bound in a BIND_EXPR
1970 nested inside BIND instead of directly in BIND itself.
1972 2023-08-25 Sandra Loosemore <sandra@codesourcery.com>
1974 * constexpr.cc (cxx_eval_constant_expression): Handle
1975 OMP_STRUCTURED_BLOCK.
1976 * pt.cc (tsubst_expr): Likewise.
1978 2023-08-25 Uros Bizjak <ubizjak@gmail.com>
1980 * call.cc (build_conditional_expr):
1981 Rename TRUE/FALSE to true/false.
1982 (build_new_op): Ditto.
1984 2023-08-22 Jason Merrill <jason@redhat.com>
1986 * pt.cc (outer_template_args): Handle non-template argument.
1987 * constraint.cc (maybe_substitute_reqs_for): Pass decl to it.
1988 * cp-tree.h (outer_template_args): Adjust.
1990 2023-08-22 Jason Merrill <jason@redhat.com>
1993 * cp-tree.h (member_like_constrained_friend_p): Declare.
1994 * decl.cc (member_like_constrained_friend_p): New.
1995 (function_requirements_equivalent_p): Check it.
1996 (duplicate_decls): Check it.
1997 (grokfndecl): Check friend template constraints.
1998 * mangle.cc (decl_mangling_context): Check it.
1999 (write_unqualified_name): Check it.
2000 * pt.cc (uses_outer_template_parms_in_constraints): Fix for friends.
2001 (tsubst_friend_function): Don't check satisfaction.
2003 2023-08-22 Tobias Burnus <tobias@codesourcery.com>
2005 * parser.cc (cp_parser_omp_clause_defaultmap): Parse
2008 2023-08-15 Chung-Lin Tang <cltang@codesourcery.com>
2009 Thomas Schwinge <thomas@codesourcery.com>
2011 * parser.cc (OACC_DATA_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_DEFAULT.
2013 2023-08-14 gnaggnoyil <gnaggnoyil@gmail.com>
2017 * decl.cc (get_tuple_size): Update implementation for DR 2386.
2019 2023-08-14 Jason Merrill <jason@redhat.com>
2021 * parser.cc (cp_parser_simple_type_specifier): Handle -std=c++14
2024 2023-08-12 Patrick Palka <ppalka@redhat.com>
2025 Jason Merrill <jason@redhat.com>
2028 * decl.cc (redeclaration_error_message): Remove special handling
2029 for deduction guides.
2030 (grokfndecl): Give deduction guides a dummy DECL_INITIAL.
2032 2023-08-11 Patrick Palka <ppalka@redhat.com>
2035 * parser.cc (cp_parser_type_requirement): Pass
2036 check_dependency_p=true instead of =false.
2038 2023-08-11 Patrick Palka <ppalka@redhat.com>
2041 * decl.cc (grokdeclarator): Pass 'dname' instead of
2042 'unqualified_id' as the name when building the VAR_DECL for a
2043 static data member. Call check_explicit_specialization for a
2044 TEMPLATE_ID_EXPR such member.
2045 * pt.cc (finish_member_template_decl): Return NULL_TREE
2046 instead of 'decl' when DECL_TEMPLATE_SPECIALIZATION is not
2049 2023-08-11 Patrick Palka <ppalka@redhat.com>
2051 * ptree.cc (cxx_print_decl): Check for DECL_LANG_SPECIFIC and
2052 TS_DECL_COMMON only when necessary. Print DECL_TEMPLATE_INFO
2053 for all decls that have it, not just VAR_DECL or FUNCTION_DECL.
2054 Also print DECL_USE_TEMPLATE.
2055 (cxx_print_type): Print TYPE_TEMPLATE_INFO.
2056 <case BOUND_TEMPLATE_TEMPLATE_PARM>: Don't print TYPE_TI_ARGS
2058 <case TEMPLATE_TYPE/TEMPLATE_PARM>: Print TEMPLATE_TYPE_PARM_INDEX
2059 instead of printing the index, level and original level
2062 2023-08-08 Marek Polacek <polacek@redhat.com>
2064 * parser.cc (cp_parser_postfix_expression): Adjust the call to
2065 cp_parser_braced_list.
2066 (cp_parser_postfix_open_square_expression): Likewise.
2067 (cp_parser_new_initializer): Likewise.
2068 (cp_parser_assignment_expression): Adjust the call to
2069 cp_parser_initializer_clause.
2070 (cp_parser_lambda_introducer): Adjust the call to cp_parser_initializer.
2071 (cp_parser_range_for): Adjust the call to cp_parser_braced_list.
2072 (cp_parser_jump_statement): Likewise.
2073 (cp_parser_mem_initializer): Likewise.
2074 (cp_parser_template_argument): Likewise.
2075 (cp_parser_default_argument): Adjust the call to cp_parser_initializer.
2076 (cp_parser_initializer): Handle null is_direct_init and non_constant_p
2078 (cp_parser_initializer_clause): Handle null non_constant_p argument.
2079 (cp_parser_braced_list): Likewise.
2080 (cp_parser_initializer_list): Likewise.
2081 (cp_parser_member_declaration): Adjust the call to
2082 cp_parser_initializer_clause and cp_parser_initializer.
2083 (cp_parser_yield_expression): Adjust the call to cp_parser_braced_list.
2084 (cp_parser_functional_cast): Likewise.
2085 (cp_parser_late_parse_one_default_arg): Adjust the call to
2086 cp_parser_initializer.
2087 (cp_parser_omp_for_loop_init): Likewise.
2088 (cp_parser_omp_declare_reduction_exprs): Likewise.
2090 2023-08-08 Nathaniel Shead <nathanieloshead@gmail.com>
2093 * parser.cc (cp_parser_decltype_expr): Report errors raised by
2094 finish_id_expression.
2096 2023-08-04 Tamar Christina <tamar.christina@arm.com>
2098 * cp-tree.h (RANGE_FOR_NOVECTOR): New.
2099 (cp_convert_range_for, finish_while_stmt_cond, finish_do_stmt,
2100 finish_for_cond): Add novector param.
2101 * init.cc (build_vec_init): Default novector to false.
2102 * method.cc (build_comparison_op): Likewise.
2103 * parser.cc (cp_parser_statement): Likewise.
2104 (cp_parser_for, cp_parser_c_for, cp_parser_range_for,
2105 cp_convert_range_for, cp_parser_iteration_statement,
2106 cp_parser_omp_for_loop, cp_parser_pragma): Support novector.
2107 (cp_parser_pragma_novector): New.
2108 * pt.cc (tsubst_expr): Likewise.
2109 * semantics.cc (finish_while_stmt_cond, finish_do_stmt,
2110 finish_for_cond): Likewise.
2112 2023-08-01 Lewis Hyatt <lhyatt@gmail.com>
2114 * parser.cc (c_init_preprocess): New function.
2115 (maybe_read_tokens_for_pragma_lex): New function.
2116 (pragma_lex): Support preprocess-only mode.
2117 (pragma_lex_discard_to_eol): New function.
2119 2023-07-31 Chung-Lin Tang <cltang@codesourcery.com>
2121 * parser.cc (cp_parser_oacc_host_data): Add checking requiring OpenACC
2122 host_data construct to have an use_device clause.
2124 2023-07-28 Ng YongXiang <yongxiangng@gmail.com>
2128 * init.cc (build_vec_delete_1): Devirtualize array destruction.
2130 2023-07-27 Patrick Palka <ppalka@redhat.com>
2133 * constexpr.cc (cxx_eval_array_reference): Allow synthesizing an
2134 empty subobject even if CONSTRUCTOR_NO_CLEARING is set.
2135 (cxx_eval_bare_aggregate): Set 'no_slot' to true more generally
2136 whenever new_ctx.ctor is set to NULL_TREE by init_subob_ctx,
2137 i.e. whenever initializing an subobject of empty type.
2138 (cxx_eval_vec_init_1): Define 'no_slot' as above and use it
2141 2023-07-27 Nathaniel Shead <nathanieloshead@gmail.com>
2144 * pt.cc (type_uses_auto): Check inside parameter packs.
2146 2023-07-26 Patrick Palka <ppalka@redhat.com>
2150 * pt.cc (reduce_template_parm_level): Set DECL_TEMPLATE_INFO
2151 on the DECL_TEMPLATE_RESULT of the new ttp.
2152 (add_defaults_to_ttp): Make a copy of the original ttp's
2153 DECL_TEMPLATE_RESULT, and update this copy's DECL_TEMPLATE_INFO
2155 (coerce_template_template_parms): Make sure 'scope_args' has
2156 the right amount of levels for the ttp argument.
2157 (most_general_template): Handle template template parameters.
2158 (rewrite_template_parm): Set DECL_TEMPLATE_RESULT on the
2159 DECL_TEMPLATE_RESULT of the new ttp.
2161 2023-07-26 Patrick Palka <ppalka@redhat.com>
2165 * pt.cc (coerce_template_template_parms): Simplify by using
2166 DECL_INNERMOST_TEMPLATE_PARMS and removing redundant asserts.
2167 Always pass the parameters of the most general template to
2168 coerce_template_parms.
2170 2023-07-26 Patrick Palka <ppalka@redhat.com>
2173 * pt.cc (unify) <case INTEGER_CST>: Generalize to handle
2176 2023-07-26 Marek Polacek <polacek@redhat.com>
2178 * parser.cc (cp_parser_constant_expression): Allow non_constant_p to be
2179 nullptr even when allow_non_constant_p is true. Don't call
2180 _rvalue_constant_expression when not necessary. Move local variable
2181 declarations closer to their first use.
2182 (cp_parser_static_assert): Don't pass a dummy down to
2183 cp_parser_constant_expression.
2185 2023-07-26 Jason Merrill <jason@redhat.com>
2188 * parser.cc (cp_parser_template_name): Skip non-member
2189 lookup after the template keyword.
2190 (cp_parser_lookup_name): Pass down template_keyword_p.
2192 2023-07-26 Nathaniel Shead <nathanieloshead@gmail.com>
2197 * constexpr.cc (constexpr_global_ctx::is_outside_lifetime): New
2199 (constexpr_global_ctx::get_value): Don't return expired values.
2200 (constexpr_global_ctx::get_value_ptr): Likewise.
2201 (constexpr_global_ctx::remove_value): Mark value outside
2203 (outside_lifetime_error): New function.
2204 (cxx_eval_call_expression): No longer track save_exprs.
2205 (cxx_eval_loop_expr): Likewise.
2206 (cxx_eval_constant_expression): Add checks for outside lifetime
2207 values. Remove local variables at end of bind exprs, and
2208 temporaries after cleanup points.
2210 2023-07-26 Nathaniel Shead <nathanieloshead@gmail.com>
2213 * cp-gimplify.cc (cp_genericize_r): Transform RETURN_EXPRs to
2214 not return dangling pointers.
2215 * cp-tree.h (RETURN_EXPR_LOCAL_ADDR_P): New flag.
2216 (check_return_expr): Add a new parameter.
2217 * semantics.cc (finish_return_stmt): Set flag on RETURN_EXPR
2218 when referring to dangling pointer.
2219 * typeck.cc (check_return_expr): Disable transformation of
2220 dangling pointers, instead pass this information to caller.
2222 2023-07-26 Nathaniel Shead <nathanieloshead@gmail.com>
2224 * constexpr.cc (modifying_const_object_error): Find the source
2225 location of the const object's declaration.
2226 (cxx_eval_constant_expression): Update input_location to the
2227 location of the currently evaluated expression, if possible.
2229 2023-07-25 Marek Polacek <polacek@redhat.com>
2232 * pt.cc (lookup_and_finish_template_variable): Don't clear tf_partial
2234 (instantiate_template): Reset all complain flags except
2235 tf_warning_or_error.
2237 2023-07-25 Marek Polacek <polacek@redhat.com>
2240 * constexpr.cc (cxx_eval_array_reference): Create a new constructor
2241 only when we don't already have a matching one. Clear the object
2242 when the type is non-scalar.
2244 2023-07-21 Marek Polacek <polacek@redhat.com>
2247 * constexpr.cc (potential_constant_expression_1): Try to complete the
2248 type when !processing_template_decl.
2250 2023-07-20 Marek Polacek <polacek@redhat.com>
2253 * call.cc (implicit_conversion_1): Return early if the type isn't
2256 2023-07-19 Marek Polacek <polacek@redhat.com>
2259 * error.cc (dump_simple_decl): Print base class name.
2261 2023-07-19 Marek Polacek <polacek@redhat.com>
2264 * typeck2.cc (process_init_constructor_record): Don't emit
2265 -Wmissing-field-initializers for empty classes.
2267 2023-07-19 Patrick Palka <ppalka@redhat.com>
2269 * pt.cc (type_unification_real): Test for PARM_DECL instead
2270 of TEMPLATE_PARM_INDEX to distinguish a type vs non-type
2271 template parameter pack.
2272 (type_targs_deducible_from): Likewise.
2274 2023-07-19 Patrick Palka <ppalka@redhat.com>
2276 * pt.cc (tsubst_function_decl): Add defaulted 'use_spec_table'
2277 flag parameter. Don't look up or insert into the specializations
2278 table if 'use_spec_table' is false.
2279 (tsubst_decl): Add defaulted 'use_spec_table' flag parameter.
2280 Check for error_mark_node.
2281 <case FUNCTION_DECL>: Pass 'use_spec_table' to
2282 tsubst_function_decl.
2283 <case TYPE/VAR_DECL>: Don't call coerce_template_parms.
2284 Don't look up or insert into the specializations table if
2285 'use_spec_table' is false. Exit earlier if the substituted
2286 type is erroneous and we're not complaining, and do so for
2287 alias specializations as well.
2288 (instantiate_template): Pass false as 'use_spec_table'
2289 to tsubst_decl. Call register_specialization afterwards.
2291 2023-07-18 Jason Merrill <jason@redhat.com>
2293 * constexpr.cc (cxx_eval_bit_cast): Check that the result of
2294 native_interpret_aggregate doesn't need more evaluation.
2296 2023-07-18 Patrick Palka <ppalka@redhat.com>
2298 * call.cc (add_template_conv_candidate): Don't check for
2299 non-empty 'candidates' here.
2300 (build_op_call): Check it here, before we've considered any
2301 conversion functions.
2303 2023-07-18 Patrick Palka <ppalka@redhat.com>
2306 * call.cc (add_conv_candidate): Check constraints.
2308 2023-07-17 Jason Merrill <jason@redhat.com>
2310 * constexpr.cc (cxx_eval_call_expression): Only cache
2311 reduced_constant_expression_p results.
2312 (reduced_constant_expression_p): Handle CONSTRUCTOR of scalar type.
2313 (cxx_eval_constant_expression): Fold vectors here.
2314 (cxx_eval_bare_aggregate): Not here.
2316 2023-07-15 Patrick Palka <ppalka@redhat.com>
2319 * call.cc (keep_unused_object_arg): Use cp_build_compound_expr
2320 instead of building a COMPOUND_EXPR directly.
2322 2023-07-15 Patrick Palka <ppalka@redhat.com>
2325 * mangle.cc (write_expression): Handle TEMPLATE_ID_EXPR
2326 whose template is already an IDENTIFIER_NODE.
2328 2023-07-14 Nathaniel Shead <nathanieloshead@gmail.com>
2330 * constexpr.cc (cxx_eval_constant_expression): Pass t to get_value.
2332 2023-07-14 Jason Merrill <jason@redhat.com>
2335 * constexpr.cc (cxx_eval_constant_expression): Move P2738 handling
2336 after heap handling.
2337 * name-lookup.cc (get_cxx_dialect_name): Add C++26.
2339 2023-07-14 Marek Polacek <polacek@redhat.com>
2340 Jason Merrill <jason@redhat.com>
2343 * decl.cc (cp_finish_decl): Set TREE_CONSTANT when initializing
2344 an object of empty class type.
2345 * pt.cc (value_dependent_expression_p) <case VAR_DECL>: Treat a
2346 constexpr-declared non-constant variable as value-dependent.
2348 2023-07-11 Patrick Palka <ppalka@redhat.com>
2351 * pt.cc (lookup_template_variable): Pass all levels of arguments
2352 to coerce_template_parms, and use the parameters from the most
2355 2023-07-10 Patrick Palka <ppalka@redhat.com>
2358 * pt.cc (redeclare_class_template): Relax the ttp DECL_CONTEXT
2359 assert, and downgrade it to a checking assert.
2361 2023-06-30 Patrick Palka <ppalka@redhat.com>
2363 * cp-tree.h (TEMPLATE_PARM_DESCENDANTS): Harden.
2364 (TEMPLATE_TYPE_DESCENDANTS): Define.
2365 (TEMPLATE_TEMPLATE_PARM_SIMPLE_P): Define.
2366 * pt.cc (reduce_template_parm_level): Revert
2367 r14-418-g0bc2a1dc327af9 change.
2368 (process_template_parm): Set TEMPLATE_TEMPLATE_PARM_SIMPLE_P
2370 (uses_outer_template_parms): Determine the outer depth of
2371 a template template parm without relying on DECL_CONTEXT.
2372 (tsubst) <case TEMPLATE_TEMPLATE_PARM>: Cache lowering a
2373 simple template template parm. Consistently use 'code'.
2375 2023-06-29 Patrick Palka <ppalka@redhat.com>
2378 * init.cc (maybe_instantiate_nsdmi_init): Mask out all
2379 tsubst flags except for tf_warning_or_error.
2381 2023-06-29 Patrick Palka <ppalka@redhat.com>
2384 * cp-gimplify.cc (cp_fold) <case CONSTRUCTOR>: Propagate
2385 CONSTRUCTOR_MUTABLE_POISON.
2387 2023-06-29 Patrick Palka <ppalka@redhat.com>
2389 * cp-tree.h (tree_template_info::partial): New data member.
2390 (TI_PARTIAL_INFO): New tree accessor.
2391 (most_specialized_partial_spec): Add defaulted bool parameter.
2392 * module.cc (trees_out::core_vals) <case TEMPLATE_INFO>: Stream
2394 (trees_in::core_vals) <case TEMPLATE_INFO>: Likewise.
2395 * parser.cc (specialization_of): Adjust after making
2396 most_specialized_partial_spec return TEMPLATE_INFO instead
2398 * pt.cc (process_partial_specialization): Set TI_PARTIAL_INFO
2399 of 'decl' to point back to the partial TEMPLATE_DECL. Likewise
2400 (and pass rechecking=true to most_specialization_partial_spec).
2401 (instantiate_class_template): Likewise.
2402 (instantiate_template): Set TI_PARTIAL_INFO to the result of
2403 most_specialization_partial_spec after forming a variable
2404 template specialization.
2405 (most_specialized_partial_spec): Add 'rechecking' parameter.
2406 Exit early if the template is not primary. Use the TI_PARTIAL_INFO
2407 of the corresponding TEMPLATE_INFO as a cache unless 'rechecking'
2408 is true. Don't bother setting TREE_TYPE of each TREE_LIST.
2409 (instantiate_decl): Adjust after making
2410 most_specialized_partial_spec return TEMPLATE_INFO instead of
2412 * ptree.cc (cxx_print_xnode) <case TEMPLATE_INFO>: Dump
2415 2023-06-29 Eugene Rozenfeld <erozen@microsoft.com>
2417 * Make-lang.in: Pass correct stage cc1plus when processing
2418 profile data collected while building target libraries
2420 2023-06-28 Patrick Palka <ppalka@redhat.com>
2424 * cp-tree.h (lookup_template_variable): Add complain parameter.
2425 * parser.cc (cp_parser_template_id): Pass tf_warning_or_error
2426 to lookup_template_variable.
2427 * pt.cc (lookup_template_variable): Add complain parameter.
2428 Coerce template arguments here ...
2429 (finish_template_variable): ... instead of here.
2430 (lookup_and_finish_template_variable): Check for error_mark_node
2431 result from lookup_template_variable.
2432 (tsubst_copy) <case TEMPLATE_ID_EXPR>: Pass complain to
2433 lookup_template_variable.
2434 (instantiate_template): Use build2 instead of
2435 lookup_template_variable to build a TEMPLATE_ID_EXPR
2436 for most_specialized_partial_spec.
2438 2023-06-28 Marek Polacek <polacek@redhat.com>
2441 * typeck.cc (cp_build_unary_op): Check tf_warning before warning.
2443 2023-06-28 Jason Merrill <jason@redhat.com>
2446 * cp-tree.h (clone_attrs): Declare.
2447 * method.cc (implicitly_declare_fn): Use it for inherited
2449 * optimize.cc (clone_attrs): New.
2450 (maybe_clone_body): Use it.
2452 2023-06-28 Jason Merrill <jason@redhat.com>
2455 * constexpr.cc (cxx_eval_constant_expression): In C++26, allow cast
2456 from void* to the type of a pointed-to object.
2458 2023-06-23 David Malcolm <dmalcolm@redhat.com>
2461 * cp-name-hint.h (maybe_suggest_missing_header): New decl.
2462 * decl.cc: Define INCLUDE_MEMORY. Add include of
2463 "cp/cp-name-hint.h".
2464 (start_decl_1): Call maybe_suggest_missing_header.
2465 * name-lookup.cc (maybe_suggest_missing_header): Remove "static".
2467 2023-06-16 Alex Coplan <alex.coplan@arm.com>
2469 * parser.cc (cp_parser_enum_specifier): Don't reject
2470 elaborated-type-specifier with enum-base, instead emit new
2471 Welaborated-enum-base warning.
2473 2023-06-14 Jason Merrill <jason@redhat.com>
2477 * call.cc (joust_maybe_elide_copy): Don't change cand.
2478 (joust): Move the elided tiebreaker later.
2480 2023-06-13 David Malcolm <dmalcolm@redhat.com>
2483 * name-lookup.cc (missing_std_header::~missing_std_header): Reword
2484 note to avoid negative tone of "forgetting".
2486 2023-06-13 Jason Merrill <jason@redhat.com>
2488 * tree.cc (build_target_expr): Check TYPE_HAS_MUTABLE_P.
2490 2023-06-12 Tobias Burnus <tobias@codesourcery.com>
2492 * parser.cc (cp_parser_omp_clause_map): Reword error message for
2493 clearness especially with 'omp target (enter/exit) data.'
2494 * semantics.cc (handle_omp_array_sections): Handle
2495 GOMP_MAP_{ALWAYS_,}PRESENT_{TO,TOFROM,FROM,ALLOC} enum values.
2497 2023-06-12 Jason Merrill <jason@redhat.com>
2500 * call.cc (convert_like_internal) [ck_list]: Use
2501 maybe_init_list_as_array.
2502 * constexpr.cc (cxx_eval_vec_init_1): Init might have
2504 * tree.cc (build_vec_init_elt): Likewise.
2505 * init.cc (build_vec_init): Handle from_array from a
2506 TARGET_EXPR. Retain TARGET_EXPR of a different type.
2508 2023-06-11 Patrick Palka <ppalka@redhat.com>
2511 * constexpr.cc (cxx_eval_call_expression): Synthesize defaulted
2512 functions needed for constant evaluation.
2513 (instantiate_cx_fn_r): Likewise.
2515 2023-06-11 Patrick Palka <ppalka@redhat.com>
2518 * pt.cc (lookup_template_class): Extend shortcut for looking up the
2519 current class scope to consider outer class scopes too, and use
2520 current_nonlambda_class_type instead of current_class_type. Only
2521 call coerce_template_parms when specializing a primary template.
2523 2023-06-10 Nathan Sidwell <nathan@acm.org>
2526 * pt.cc (maybe_adjust_types_for_deduction): Implement DR976.
2528 2023-06-09 Jason Merrill <jason@redhat.com>
2532 * method.cc (build_comparison_op): Give retval a name.
2533 * typeck.cc (check_return_expr): Fix for nameless variables.
2535 2023-06-09 Jason Merrill <jason@redhat.com>
2537 * parser.cc (cp_parser_simple_type_specifier): Check for auto
2538 in template argument.
2539 (cp_parser_template_type_arg): Remove auto checking.
2541 2023-06-09 Jason Merrill <jason@redhat.com>
2544 * call.cc (maybe_init_list_as_array): Check that the element type is
2547 2023-06-07 Jason Merrill <jason@redhat.com>
2551 * cp-tree.h (INIT_EXPR_NRV_P): New.
2552 * semantics.cc (finalize_nrv_r): Check it.
2553 * name-lookup.h (decl_in_scope_p): Declare.
2554 * name-lookup.cc (decl_in_scope_p): New.
2555 * typeck.cc (check_return_expr): Allow non-NRV
2556 returns if the NRV is no longer in scope.
2558 2023-06-07 Jason Merrill <jason@redhat.com>
2561 * typeck.cc (want_nrvo_p): New.
2562 (check_return_expr): Handle -Wnrvo.
2564 2023-06-07 Jason Merrill <jason@redhat.com>
2568 * decl.cc (finish_function): Simplify NRV handling.
2569 * except.cc (maybe_set_retval_sentinel): Also set if NRV.
2570 (maybe_splice_retval_cleanup): Don't add the cleanup region
2571 if we don't need it.
2572 * semantics.cc (nrv_data): Add simple field.
2573 (finalize_nrv): Set it.
2574 (finalize_nrv_r): Check it and retval sentinel.
2575 * cp-tree.h (finalize_nrv): Adjust declaration.
2576 * typeck.cc (check_return_expr): Remove named_labels check.
2578 2023-06-07 Jason Merrill <jason@redhat.com>
2581 * typeck.cc (check_return_expr): Prevent NRV in the presence of
2584 2023-06-07 Jason Merrill <jason@redhat.com>
2587 * except.cc (maybe_splice_retval_cleanup): Change
2588 recognition of function body and try scopes.
2589 * semantics.cc (do_poplevel): Call it after poplevel.
2590 (at_try_scope): New.
2591 * cp-tree.h (maybe_splice_retval_cleanup): Adjust.
2593 2023-06-07 Jason Merrill <jason@redhat.com>
2595 * semantics.cc (finalize_nrv_r): [RETURN_EXPR]: Only replace the
2598 2023-06-06 Kwok Cheung Yeung <kcy@codesourcery.com>
2599 Tobias Burnus <tobias@codesourcery.com>
2601 * parser.cc (cp_parser_omp_clause_defaultmap,
2602 cp_parser_omp_clause_map): Parse 'present'.
2603 (cp_parser_omp_clause_from_to): New; parse to/from
2604 clauses with optional 'present' modifier.
2605 (cp_parser_omp_all_clauses): Update call.
2606 (cp_parser_omp_target_data, cp_parser_omp_target_enter_data,
2607 cp_parser_omp_target_exit_data): Handle new enum value for
2609 * semantics.cc (finish_omp_target): Likewise.
2611 2023-06-04 Jason Merrill <jason@redhat.com>
2614 * cp-tree.h (enum cp_tree_index): Add CPTI_CALL_TERMINATE_FN.
2615 (call_terminate_fn): New macro.
2616 * cp-gimplify.cc (gimplify_must_not_throw_expr): Use it.
2617 * except.cc (init_exception_processing): Set it.
2618 (cp_protect_cleanup_actions): Return it.
2620 2023-06-03 Patrick Palka <ppalka@redhat.com>
2623 * pt.cc (is_specialization_of_friend): Fix overbroad check for
2624 a non-template member function of a class template.
2626 2023-06-03 Patrick Palka <ppalka@redhat.com>
2628 * pt.cc (iterative_hash_template_arg): Don't hash
2629 TEMPLATE_TEMPLATE_PARM specially.
2631 2023-06-03 Patrick Palka <ppalka@redhat.com>
2633 * class.cc (build_base_path): Check in_template_context instead
2634 of in_template_function.
2635 (resolves_to_fixed_type_p): Likewise.
2636 * cp-tree.h (in_template_context): Define.
2637 (in_template_function): Remove.
2638 * decl.cc (cp_make_fname_decl): Check current_function_decl
2639 and in_template_context instead of in_template_function.
2640 * decl2.cc (mark_used): Check in_template_context instead of
2641 in_template_function.
2642 * pt.cc (in_template_function): Remove.
2643 * semantics.cc (enforce_access): Check in_template_context
2644 instead of current_template_parms directly.
2646 2023-06-03 Patrick Palka <ppalka@redhat.com>
2649 * mangle.cc (write_expression): Handle NOEXCEPT_EXPR.
2651 2023-06-02 Jason Merrill <jason@redhat.com>
2655 * call.cc (sfk_copy_or_move): New.
2656 (joust): Add tiebreaker for explicit conv and copy ctor.
2658 2023-06-02 Jason Merrill <jason@redhat.com>
2662 * call.cc (maybe_init_list_as_array): Set DECL_MERGEABLE.
2663 (convert_like_internal) [ck_list]: Set it.
2664 (set_up_extended_ref_temp): Copy it.
2665 * tree.cc (handle_no_unique_addr_attribute): Set it.
2667 2023-06-01 Jason Merrill <jason@redhat.com>
2669 * typeck2.cc (check_narrowing): Check flag_permissive.
2671 2023-05-30 Tobias Burnus <tobias@codesourcery.com>
2674 * parser.cc (cp_parser_oacc_all_clauses,
2675 cp_parser_omp_all_clauses): Improve error wording.
2677 2023-05-19 Andrew Pinski <apinski@marvell.com>
2680 * lang-specs.h ("@c++-header"): Add %w after
2682 ("@c++-system-header"): Likewise.
2683 ("@c++-user-header"): Likewise.
2685 2023-05-19 Patrick Palka <ppalka@redhat.com>
2687 * constraint.cc (normalize_concept_check): Avoid having to do
2688 two norm_cache lookups. Remove unnecessary early exit for an
2689 ill-formed concept definition.
2691 2023-05-19 Patrick Palka <ppalka@redhat.com>
2694 * pt.cc (lookup_and_finish_template_variable): Don't call
2695 convert_from_reference.
2696 (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Call
2697 convert_from_reference on the result of
2698 lookup_and_finish_template_variable.
2700 2023-05-18 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
2702 * call.cc (promoted_arithmetic_type_p): Use _P defines from tree.h.
2703 (build_conditional_expr): Ditto.
2704 (convert_like_internal): Ditto.
2705 (convert_arg_to_ellipsis): Ditto.
2706 (build_over_call): Ditto.
2707 (compare_ics): Ditto.
2708 * class.cc (is_empty_base_ref): Ditto.
2709 * coroutines.cc (rewrite_param_uses): Ditto.
2710 * cp-tree.h (DECL_DISCRIMINATOR_P): Ditto.
2711 (ARITHMETIC_TYPE_P): Ditto.
2712 * cvt.cc (ocp_convert): Ditto.
2713 * cxx-pretty-print.cc (pp_cxx_template_argument_list): Ditto.
2714 * decl.cc (layout_var_decl): Ditto.
2715 (get_tuple_size): Ditto.
2716 * error.cc (dump_simple_decl): Ditto.
2717 * lambda.cc (start_lambda_scope): Ditto.
2718 * mangle.cc (write_template_arg): Ditto.
2719 * method.cc (spaceship_comp_cat): Ditto.
2720 * module.cc (node_template_info): Ditto.
2721 (trees_out::start): Ditto.
2722 (trees_out::decl_node): Ditto.
2723 (trees_in::read_var_def): Ditto.
2724 (set_instantiating_module): Ditto.
2725 * name-lookup.cc (maybe_record_mergeable_decl): Ditto.
2726 (consider_decl): Ditto.
2727 (maybe_add_fuzzy_decl): Ditto.
2728 * pt.cc (convert_nontype_argument): Ditto.
2729 * semantics.cc (handle_omp_array_sections_1): Ditto.
2730 (finish_omp_clauses): Ditto.
2731 (finish_omp_target_clauses_r): Ditto.
2732 (is_this_parameter): Ditto.
2733 * tree.cc (build_cplus_array_type): Ditto.
2734 (is_this_expression): Ditto.
2735 * typeck.cc (do_warn_enum_conversions): Ditto.
2736 * typeck2.cc (store_init_value): Ditto.
2737 (check_narrowing): Ditto.
2739 2023-05-17 Jakub Jelinek <jakub@redhat.com>
2742 * init.cc (build_zero_init_1): Don't initialize zero-width bitfields.
2743 For unions only initialize the first FIELD_DECL.
2745 2023-05-16 Marek Polacek <polacek@redhat.com>
2748 * typeck.cc (check_return_expr): In a template, return only after
2749 suppressing -Wdangling-reference.
2751 2023-05-16 Patrick Palka <ppalka@redhat.com>
2754 * call.cc (add_list_candidates): Check for invalid designated
2755 initialization sooner and even for types that have a list
2758 2023-05-11 Patrick Palka <ppalka@redhat.com>
2761 * typeck2.cc (poison_mutable_constructors): Define.
2762 (store_init_value): Use it instead of setting
2763 CONSTRUCTOR_MUTABLE_POISON directly.
2765 2023-05-11 Patrick Palka <ppalka@redhat.com>
2766 Jonathan Wakely <jwakely@redhat.com>
2771 * pt.cc (convert_nontype_argument_function): Remove linkage
2772 requirement for C++17 and later.
2773 (invalid_tparm_referent_p) <case ADDR_EXPR>: Restrict
2774 DECL_ARTIFICIAL rejection test to VAR_DECL.
2776 2023-05-10 Marek Polacek <polacek@redhat.com>
2779 * method.cc (build_trait_object): New.
2780 (assignable_expr): Use it.
2781 (ref_xes_from_temporary): Likewise.
2782 (is_convertible_helper): Likewise. Check FUNC_OR_METHOD_TYPE_P.
2784 2023-05-10 Jason Merrill <jason@redhat.com>
2786 * call.cc (convert_like_internal): Share ck_ref_bind handling
2787 between all bad conversions.
2789 2023-05-10 Jason Merrill <jason@redhat.com>
2792 * constexpr.cc (cxx_eval_outermost_constant_expr): Preserve
2794 (potential_constant_expression_1): Check TARGET_EXPR_ELIDING_P.
2795 * typeck2.cc (store_init_value): Diagnose constinit sooner.
2797 2023-05-10 Jason Merrill <jason@redhat.com>
2799 * constexpr.cc (cxx_eval_outermost_constant_expr): Always check
2800 for address of immediate fn.
2801 (maybe_constant_init_1): Evaluate PTRMEM_CST.
2803 2023-05-10 Jakub Jelinek <jakub@redhat.com>
2806 * parser.cc (cp_parser_std_attribute): For unknown attributes with
2807 arguments set TREE_VALUE (attribute) to error_mark_node after skipping
2808 the balanced tokens.
2809 (cp_parser_std_attribute_list): If ... is used after attribute without
2810 arguments, diagnose it and return error_mark_node. If
2811 TREE_VALUE (attribute) is error_mark_node, don't call
2812 make_pack_expansion nor return early error_mark_node.
2814 2023-05-09 Patrick Palka <ppalka@redhat.com>
2817 * constraint.cc (satisfaction_cache::satisfaction_cache): In the
2818 unexpected case of evaluating an atom for the first time noisily,
2819 remove the cache slot that we inserted.
2821 2023-05-09 Patrick Palka <ppalka@redhat.com>
2824 * parser.cc (cp_parser_class_specifier): Don't pass a class
2825 context to noexcept_override_late_checks.
2826 (noexcept_override_late_checks): Remove 'type' parameter
2827 and use DECL_CONTEXT of 'fndecl' instead.
2829 2023-05-09 Jakub Jelinek <jakub@redhat.com>
2832 * cp-gimplify.cc (process_stmt_assume_attribute): Diagnose pack
2833 expansion of assume attribute.
2835 2023-05-08 Patrick Palka <ppalka@redhat.com>
2839 * pt.cc (do_auto_deduction): Move up resolve_nondeduced_context
2840 calls to happen before do_class_deduction. Add some
2841 error_mark_node tests.
2843 2023-05-07 Patrick Palka <ppalka@redhat.com>
2846 * cxx-pretty-print.cc (cxx_pretty_printer::unary_expression)
2847 <case ALIGNOF_EXPR>: Consider ALIGNOF_EXPR_STD_P.
2848 * error.cc (dump_expr) <case ALIGNOF_EXPR>: Likewise.
2850 2023-05-07 Patrick Palka <ppalka@redhat.com>
2854 * decl.cc (decl_jump_unsafe): Return bool instead of int.
2855 Don't consider TYPE_HAS_NONTRIVIAL_DESTRUCTOR.
2856 (check_previous_goto_1): Simplify now that decl_jump_unsafe
2857 returns bool instead of int.
2858 (check_goto): Likewise.
2860 2023-05-07 Patrick Palka <ppalka@redhat.com>
2862 * pt.cc (instantiate_alias_template): Exit early upon
2863 error from coerce_template_parms. Remove dependence test
2864 guarding constraints_satisfied_p.
2866 2023-05-07 Patrick Palka <ppalka@redhat.com>
2868 * cp-tree.h (PLACEHOLDER_TYPE_CONSTRAINTS_INFO): Harden via
2869 TEMPLATE_TYPE_PARM_CHECK.
2870 (TPARMS_PRIMARY_TEMPLATE): Harden via TREE_VEC_CHECK.
2871 (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL): Harden via
2872 TEMPLATE_TEMPLATE_PARM_CHECK.
2873 * cxx-pretty-print.cc (cxx_pretty_printer::simple_type_specifier):
2874 Guard PLACEHOLDER_TYPE_CONSTRAINTS access.
2875 * error.cc (dump_type) <case TEMPLATE_TYPE_PARM>: Use separate
2876 variable to store CLASS_PLACEHOLDER_TEMPLATE result.
2877 * pt.cc (outer_template_args): Use strip_innermost_template_args.
2878 (any_type_dependent_arguments_p): Exit early if
2879 !processing_template_decl. Use range-based for.
2880 (any_dependent_template_arguments_p): Likewise.
2882 2023-05-07 Patrick Palka <ppalka@redhat.com>
2885 * pt.cc (tsubst_copy_and_build) <case COMPONENT_REF>: Propagate
2886 REF_PARENTHESIZED_P more generally via force_paren_expr.
2887 * semantics.cc (force_paren_expr): Document default argument.
2889 2023-05-07 Patrick Palka <ppalka@redhat.com>
2892 * pt.cc (coerce_template_args_for_ttp): Mention we can hit the
2893 current_template_parms fallback when level-lowering a bound ttp.
2894 (tsubst_template_decl): Add lambda_tparms parameter. Prefer to
2895 use lambda_tparms instead of substituting DECL_TEMPLATE_PARMS.
2896 (tsubst_decl) <case TEMPLATE_DECL>: Pass NULL_TREE as lambda_tparms
2897 to tsubst_template_decl.
2898 (tsubst_lambda_expr): For a generic lambda, substitute
2899 DECL_TEMPLATE_PARMS and set current_template_parms to it
2900 before substituting the function type. Pass the substituted
2901 DECL_TEMPLATE_PARMS as lambda_tparms to tsubst_template_decl.
2903 2023-05-07 Patrick Palka <ppalka@redhat.com>
2906 * semantics.cc (enforce_access): Check current_template_parms
2907 instead of processing_template_decl when deciding whether to
2908 defer the access check.
2910 2023-05-07 Patrick Palka <ppalka@redhat.com>
2913 * constexpr.cc (potential_constant_expression_1) <case CALL_EXPR>:
2914 Reorganize to call get_fns sooner. Remove special handling of
2915 the object argument of a non-static member function call. Remove
2916 dead store to 'fun'.
2918 2023-05-05 Jason Merrill <jason@redhat.com>
2921 2023-04-27 Jason Merrill <jason@redhat.com>
2924 * pt.cc (instantiate_decl): Assert !defer_ok for local
2927 2023-05-03 Jason Merrill <jason@redhat.com>
2931 * friend.cc (do_friend): Don't call check_explicit_specialization if
2932 DECL_TEMPLATE_INFO is already set.
2933 * decl2.cc (check_classfn): Set DECL_TEMPLATE_INFO.
2934 * name-lookup.cc (set_decl_namespace): Likewise.
2936 2023-05-03 Jakub Jelinek <jakub@redhat.com>
2938 * cp-gimplify.cc (cp_fold_data): Move definition earlier.
2939 (cp_gimplify_expr): Pass address of ff_genericize | ff_mce_false
2940 constructed data rather than &pset to cp_walk_tree with cp_fold_r.
2942 2023-05-03 Jason Merrill <jason@redhat.com>
2944 * pt.cc (reduce_template_parm_level): Fix comparison of
2945 template template parm to cached version.
2947 2023-05-02 Jason Merrill <jason@redhat.com>
2949 * pt.cc (instantiate_class_template): Skip the RECORD_TYPE
2950 of a class template.
2951 (tsubst_template_decl): Clear CLASSTYPE_USE_TEMPLATE.
2953 2023-05-02 Jason Merrill <jason@redhat.com>
2955 * name-lookup.cc (pop_from_top_level): Don't
2956 invalidate_class_lookup_cache.
2958 2023-05-02 Jason Merrill <jason@redhat.com>
2961 * cp-tree.h (lookup_base): Add offset parm.
2962 * constexpr.cc (cxx_fold_indirect_ref_1): Pass it.
2963 * search.cc (struct lookup_base_data_s): Add offset.
2964 (dfs_lookup_base): Handle it.
2965 (lookup_base): Pass it.
2967 2023-05-02 Jason Merrill <jason@redhat.com>
2970 * constexpr.cc (cxx_fold_indirect_ref_1): Handle empty base first.
2972 2023-05-01 Jason Merrill <jason@redhat.com>
2975 * name-lookup.cc (maybe_push_to_top_level)
2976 (maybe_pop_from_top_level): Split out...
2977 * pt.cc (instantiate_body): ...from here.
2978 * init.cc (maybe_instantiate_nsdmi_init): Use them.
2979 * name-lookup.h: Declare them..
2981 2023-04-28 Eugene Rozenfeld <erozen@microsoft.com>
2983 * Make-lang.in: Merge perf data collected when compiling cc1plus and runtime libraries
2985 2023-04-27 Jason Merrill <jason@redhat.com>
2987 * call.cc (print_conversion_rejection): Use iloc_sentinel.
2989 2023-04-27 Jason Merrill <jason@redhat.com>
2992 * pt.cc (instantiate_decl): Assert !defer_ok for local
2995 2023-04-26 Jason Merrill <jason@redhat.com>
2997 * init.cc (nsdmi_inst): Remove.
2998 (maybe_instantiate_nsdmi_init): Use DECL_INITIAL instead.
3000 2023-04-26 Jason Merrill <jason@redhat.com>
3003 * pt.cc (instantiate_class_template): Do partially instantiate.
3004 (tsubst_expr): Do call complete_type for partial instantiations.
3006 2023-04-26 Jason Merrill <jason@redhat.com>
3009 * pt.cc (regenerate_decl_from_template): Skip unique friends.
3011 2023-04-26 Patrick Palka <ppalka@redhat.com>
3013 * pt.cc (most_specialized_partial_spec): Exit early when
3014 DECL_TEMPLATE_SPECIALIZATIONS is empty. Move local variable
3015 declarations closer to their first use. Remove redundant
3016 flag_concepts test. Remove redundant forward declaration.
3018 2023-04-25 Patrick Palka <ppalka@redhat.com>
3021 * pt.cc (value_dependent_expression_p) <case VAR_DECL>:
3022 Suppress conservative early exit for reference variables
3023 when DECL_HAS_VALUE_EXPR_P.
3025 2023-04-25 Tobias Burnus <tobias@codesourcery.com>
3027 * parser.cc (cp_parser_omp_scan_loop_body): Handle
3028 zero exec statements before/after 'omp scan'.
3030 2023-04-24 Patrick Palka <ppalka@redhat.com>
3032 * cp-tree.h (cp_expr_location): Define here.
3033 * tree.cc (cp_expr_location): Don't define here.
3035 2023-04-21 Jason Merrill <jason@redhat.com>
3038 * decl.cc (grokdeclarator): Don't clear typedef_decl after 'unsigned
3039 typedef' pedwarn. Use c_common_signed_or_unsigned_type. Also
3040 handle 'signed typedef'.
3042 2023-04-21 Patrick Palka <ppalka@redhat.com>
3044 * tree.cc (cp_walk_subtrees): Avoid repeatedly dereferencing tp.
3045 <case DECLTYPE_TYPE>: Use cp_unevaluated and WALK_SUBTREE.
3046 <case ALIGNOF_EXPR etc>: Likewise.
3048 2023-04-20 Patrick Palka <ppalka@redhat.com>
3050 * pt.cc (tsubst) <case TEMPLATE_TYPE_PARM>: Don't recurse when
3051 level lowering a cv-qualified type template parameter. Remove
3052 recursive loop breaker in the level lowering case for constrained
3053 autos. Use the TEMPLATE_PARM_DESCENDANTS cache in this case as
3056 2023-04-20 Patrick Palka <ppalka@redhat.com>
3058 * constraint.cc (diagnose_trait_expr): Convert a TREE_VEC
3059 of arguments into a TREE_LIST for sake of pretty printing.
3060 * cxx-pretty-print.cc (pp_cxx_trait): Handle TREE_VEC
3061 instead of TREE_LIST of trailing variadic trait arguments.
3062 * method.cc (constructible_expr): Likewise.
3063 (is_xible_helper): Likewise.
3064 * parser.cc (cp_parser_trait): Represent trailing variadic trait
3065 arguments as a TREE_VEC instead of TREE_LIST.
3066 * pt.cc (value_dependent_expression_p): Handle TREE_VEC
3067 instead of TREE_LIST of trailing variadic trait arguments.
3068 * semantics.cc (finish_type_pack_element): Likewise.
3069 (check_trait_type): Likewise.
3071 2023-04-20 Patrick Palka <ppalka@redhat.com>
3073 * tree.cc (strip_typedefs): Move TREE_LIST handling to
3074 strip_typedefs_expr. Dispatch to strip_typedefs_expr for
3076 <case TYPENAME_TYPE>: Remove manual dispatching to
3077 strip_typedefs_expr.
3078 <case TRAIT_TYPE>: Likewise.
3079 (strip_typedefs_expr): Replaces calls to strip_typedefs_expr
3080 with strip_typedefs throughout. Don't dispatch to strip_typedefs
3082 <case TREE_LIST>: Replace this with the better version from
3085 2023-04-19 Patrick Palka <ppalka@redhat.com>
3086 Jonathan Wakely <jwakely@redhat.com>
3089 * cp-trait.def (TYPE_PACK_ELEMENT): Define.
3090 * cp-tree.h (finish_trait_type): Add complain parameter.
3091 * cxx-pretty-print.cc (pp_cxx_trait): Handle
3092 CPTK_TYPE_PACK_ELEMENT.
3093 * parser.cc (cp_parser_constant_expression): Document default
3095 (cp_parser_trait): Handle CPTK_TYPE_PACK_ELEMENT. Pass
3096 tf_warning_or_error to finish_trait_type.
3097 * pt.cc (tsubst) <case TRAIT_TYPE>: Handle non-type first
3098 argument. Pass complain to finish_trait_type.
3099 * semantics.cc (finish_type_pack_element): Define.
3100 (finish_trait_type): Add complain parameter. Handle
3101 CPTK_TYPE_PACK_ELEMENT.
3102 * tree.cc (strip_typedefs): Handle non-type first argument.
3103 Pass tf_warning_or_error to finish_trait_type.
3104 * typeck.cc (structural_comptypes) <case TRAIT_TYPE>: Use
3105 cp_tree_equal instead of same_type_p for the first argument.
3107 2023-04-19 Patrick Palka <ppalka@redhat.com>
3110 * pt.cc (try_class_unification): Don't ggc_free the copy of
3113 2023-04-19 Jason Merrill <jason@redhat.com>
3116 * decl.cc (grokdeclarator): Keep typedef_decl for __int128_t.
3118 2023-04-17 Patrick Palka <ppalka@redhat.com>
3121 * pt.cc (tsubst) <case BOUND_TEMPLATE_TEMPLATE_PARM>:
3122 In the level-lowering case just use lookup_template_class
3123 to rebuild the bound ttp.
3125 2023-04-15 Jason Merrill <jason@redhat.com>
3128 * constexpr.cc (cxx_eval_constant_expression) [TARGET_EXPR]:
3129 Check for complex initializer.
3131 2023-04-13 Patrick Palka <ppalka@redhat.com>
3134 * decl.cc (make_typename_type): Also ignore non-types during the
3135 lookup if tag_type corresponds to an elaborated-type-specifier.
3136 * pt.cc (tsubst) <case TYPENAME_TYPE>: Pass class_type or
3137 enum_type as tag_type to make_typename_type accordingly instead
3138 of always passing typename_type.
3140 2023-04-13 Jason Merrill <jason@redhat.com>
3143 * semantics.cc (check_trait_type): Handle incomplete type directly.
3144 * typeck2.cc (cxx_incomplete_type_diagnostic): Remove assert.
3146 2023-04-13 Jason Merrill <jason@redhat.com>
3148 * typeck2.cc (cxx_incomplete_type_diagnostic): Return bool.
3149 * cp-tree.h (cxx_incomplete_type_diagnostic): Adjust.
3151 2023-04-12 Jakub Jelinek <jakub@redhat.com>
3153 * Make-lang.in (s-cp-module-version): New target.
3154 (cp/module.o): Depend on it.
3155 (MODULE_VERSION): Remove variable.
3156 (CFLAGS-cp/module.o): For -DMODULE_VERSION= argument just
3157 cat s-cp-module-version.
3159 2023-04-09 Iain Sandoe <iain@sandoe.co.uk>
3161 * coroutines.cc (coro_rewrite_function_body): Ensure that added
3162 bind expressions have scope blocks.
3164 2023-04-04 Jason Merrill <jason@redhat.com>
3167 * decl2.cc (find_last_decl): Return early if DECL_USE_TEMPLATE.
3169 2023-04-03 Patrick Palka <ppalka@redhat.com>
3172 * decl.cc (cp_finish_decl): Diagnose ordinary auto deduction
3173 with no initializer, instead of asserting.
3175 2023-04-01 Patrick Palka <ppalka@redhat.com>
3178 * cp-tree.h (do_auto_deduction): Add defaulted tmpl parameter.
3179 * pt.cc (convert_template_argument): Pass 'in_decl' as 'tmpl' to
3181 (tsubst_decl) <case VAR_/TYPE_DECL>: Pass 'tmpl' instead of 't' as
3182 'in_decl' to coerce_template_parms.
3183 (unify) <case TEMPLATE_PARM_INDEX>: Pass TPARMS_PRIMARY_TEMPLATE
3184 as 'tmpl' to do_auto_deduction.
3185 (do_auto_deduction): Document default arguments. Rename local
3186 variable 'tmpl' to 'ctmpl'. Use 'tmpl' to obtain a full set of
3187 template arguments for satisfaction in the adc_unify case.
3189 2023-04-01 Patrick Palka <ppalka@redhat.com>
3193 * pt.cc (invalid_tparm_referent_p): Accept ADDR_EXPR of
3195 (instantiate_class_template): Call mark_template_arguments_used.
3196 (tsubst_copy_and_build) <case CALL_EXPR>: Revert r13-995 change.
3197 (mark_template_arguments_used): Define.
3198 (instantiate_body): Call mark_template_arguments_used.
3200 2023-04-01 Iain Sandoe <iain@sandoe.co.uk>
3203 * coroutines.cc (flatten_await_stmt): Use the current count of
3204 promoted temporaries to build a unique name for the frame entries.
3206 2023-03-30 Jason Merrill <jason@redhat.com>
3209 * search.cc (type_context_for_name_lookup): New.
3210 (accessible_p): Handle anonymous union.
3211 * init.cc (maybe_instantiate_nsdmi_init): Use
3212 type_context_for_name_lookup.
3213 * parser.cc (cp_parser_class_specifier): Likewise.
3214 * cp-tree.h (type_context_for_name_lookup): Declare.
3216 2023-03-30 Jason Merrill <jason@redhat.com>
3219 * pt.cc (unify) [FUNCTION_TYPE]: Handle function pointer
3222 2023-03-30 Jakub Jelinek <jakub@redhat.com>
3225 * decl2.cc (grok_array_decl): After emitting a pedwarn for
3226 -Wcomma-subscript, if processing_template_decl set orig_index_exp
3227 to compound expr from orig_index_exp_list.
3229 2023-03-30 Jason Merrill <jason@redhat.com>
3233 * decl2.cc (record_mangling): Use symtab_node::reset.
3235 2023-03-30 Jakub Jelinek <jakub@redhat.com>
3238 * call.cc (convert_like_internal): If pedwarn for extended float
3239 type conversions doesn't report anything, avoid calling
3240 maybe_inform_about_fndecl_for_bogus_argument_init.
3242 2023-03-29 Jason Merrill <jason@redhat.com>
3246 * pt.cc (alias_ctad_tweaks): Rewrite deduced args.
3247 (type_targs_deducible_from): Handle null pack deduction.
3249 2023-03-28 David Malcolm <dmalcolm@redhat.com>
3252 * parser.cc (cp_parser_binary_expression): Update for new param of
3253 check_for_xor_used_as_pow.
3255 2023-03-28 Jakub Jelinek <jakub@redhat.com>
3258 * contracts.cc: Include intl.h.
3259 (check_postcondition_result): Don't form diagnostics from two halves
3260 of an English message to allow translations.
3262 2023-03-24 Patrick Palka <ppalka@redhat.com>
3265 * parser.cc (cp_parser_class_specifier): Clear current_class_ptr
3266 and current_class_ref sooner, before parsing a class definition.
3268 2023-03-24 Jason Merrill <jason@redhat.com>
3271 * pt.cc (type_unification_real): Adjust for partial ordering.
3273 2023-03-23 Jason Merrill <jason@redhat.com>
3276 * typeck.cc (build_ptrmemfunc): Drop 0-offset optimization
3277 and location wrappers.
3279 2023-03-23 Marek Polacek <polacek@redhat.com>
3282 * call.cc (class_has_reference_member_p): New.
3283 (class_has_reference_member_p_r): New.
3284 (reference_like_class_p): Don't look for a specific constructor.
3285 Use a DFS walk with class_has_reference_member_p_r.
3287 2023-03-23 Jason Merrill <jason@redhat.com>
3290 * pt.cc (find_parameter_packs_r): Handle null TREE_BINFO.
3292 2023-03-22 Jason Merrill <jason@redhat.com>
3295 * pt.cc (unify): Use fold of build_nop instead of fold_convert.
3297 2023-03-22 Jason Merrill <jason@redhat.com>
3300 * semantics.cc (finish_id_expression_1): Check scope before
3301 returning id_expression.
3303 2023-03-22 Alex Coplan <alex.coplan@arm.com>
3306 * call.cc (build_over_call): Use make_temp_override to suppress
3307 both unavailable and deprecated warnings when calling
3310 2023-03-21 Jason Merrill <jason@redhat.com>
3313 * init.cc (maybe_instantiate_nsdmi_init): Don't leave
3314 current_function_decl set to a constructor.
3316 2023-03-20 Marek Polacek <polacek@redhat.com>
3319 * call.cc (add_template_candidate_real): Add explicit decls to the
3320 set of candidates when the initializer is a braced-init-list.
3322 2023-03-20 Jakub Jelinek <jakub@redhat.com>
3325 * cp-tree.h (var_needs_tls_wrapper): Declare.
3326 * decl2.cc (var_needs_tls_wrapper): No longer static.
3327 * decl.cc (cp_finish_decl): Clear TREE_READONLY on TLS variables
3328 for which a TLS wrapper will be needed.
3330 2023-03-17 Jason Merrill <jason@redhat.com>
3333 * lambda.cc (prune_lambda_captures): Don't bother in a template.
3335 2023-03-17 Jason Merrill <jason@redhat.com>
3338 * except.cc (build_throw): Check dtor access.
3340 2023-03-17 Jason Merrill <jason@redhat.com>
3343 * friend.cc (do_friend): Handle namespace as scope argument.
3344 * decl.cc (grokdeclarator): Pass down in_namespace.
3346 2023-03-16 Jason Merrill <jason@redhat.com>
3349 * init.cc (get_nsdmi): Split out...
3350 (maybe_instantiate_nsdmi_init): ...this function.
3351 * cp-tree.h: Declare it.
3352 * pt.cc (tsubst_expr): Use it.
3354 2023-03-16 Jason Merrill <jason@redhat.com>
3357 * pt.cc (tsubst_expr) [TAG_DEFN]: Handle partial instantiation.
3359 2023-03-16 Jason Merrill <jason@redhat.com>
3362 * semantics.cc (finish_qualified_id_expr): Don't try to build a
3363 pointer-to-member if the scope is an enumeration.
3365 2023-03-16 Patrick Palka <ppalka@redhat.com>
3368 * constexpr.cc (maybe_constant_init_1): For an unevaluated
3369 non-manifestly-constant operand, don't constant evaluate
3370 and instead call fold_to_constant as in maybe_constant_value.
3372 2023-03-16 Patrick Palka <ppalka@redhat.com>
3375 * constraint.cc (satisfaction_cache::get): Relax overly strict
3376 checking assert in the constraint recursion case.
3378 2023-03-16 Jason Merrill <jason@redhat.com>
3381 * coroutines.cc (build_co_await): Handle lvalue 'o'.
3383 2023-03-15 Jason Merrill <jason@redhat.com>
3387 * typeck.cc (cp_build_modify_expr): Allow array initialization of
3388 DECL_ARTIFICIAL variable.
3390 2023-03-15 Marek Polacek <polacek@redhat.com>
3393 * constexpr.cc (cxx_eval_store_expression): Strip location wrappers.
3395 2023-03-15 Jason Merrill <jason@redhat.com>
3398 * semantics.cc (check_template_template_default_arg): Check
3399 maybe_get_template_decl_from_type_decl.
3401 2023-03-15 Jason Merrill <jason@redhat.com>
3406 * pt.cc (coerce_template_template_parms): Use args from
3407 DECL_CONTEXT (arg_tmpl) instead of outer_args.
3409 2023-03-15 Jason Merrill <jason@redhat.com>
3412 * pt.cc (coerce_template_template_parms): Take the arg and parm
3414 (coerce_template_template_parm): Adjust.
3415 (template_template_parm_bindings_ok_p): Adjust.
3416 (convert_template_argument): Adjust.
3418 2023-03-14 Patrick Palka <ppalka@redhat.com>
3421 * pt.cc (push_inline_template_parms_recursive): Set
3422 TEMPLATE_PARMS_CONSTRAINTS.
3423 (push_template_decl): For an out-of-line declaration, verify
3424 constraints for each enclosing template scope match those of the
3425 original template declaratation.
3427 2023-03-14 Patrick Palka <ppalka@redhat.com>
3430 * pt.cc (redeclare_class_template): Add missing "of" in
3431 constraint mismatch diagnostic.
3432 (tsubst_friend_class): For an already declared class template,
3433 substitute and pass the friend declaration's constraints to
3434 redeclare_class_template instead of passing the existing
3435 template's constraints.
3437 2023-03-14 Jason Merrill <jason@redhat.com>
3440 * pt.cc (unify_pack_expansion): Check that TPARMS_PRIMARY_TEMPLATE
3443 2023-03-14 Jason Merrill <jason@redhat.com>
3446 * cp-gimplify.cc (genericize_if_stmt): Restore folding
3447 of constant conditions.
3449 2023-03-14 Jakub Jelinek <jakub@redhat.com>
3452 * tree.cc (record_has_unique_obj_representations): Ignore unnamed
3455 2023-03-13 Jason Merrill <jason@redhat.com>
3458 * parser.cc (cp_parser_set_decl_spec_type): Use
3459 redefined_builtin_type for extended_float_type_p.
3461 2023-03-13 Marek Polacek <polacek@redhat.com>
3464 * call.cc (reference_like_class_p): Check for std::span.
3466 2023-03-10 Jakub Jelinek <jakub@redhat.com>
3469 * decl.cc (cp_finish_decl): Don't clear TREE_READONLY on
3470 automatic non-aggregate variables just because of
3471 -fmerge-all-constants.
3473 2023-03-10 Jakub Jelinek <jakub@redhat.com>
3476 * class.cc (end_of_class): For bit-fields, instead of computing
3477 offset as sum of byte_position (field) and DECL_SIZE_UNIT (field),
3478 compute it as sum of bit_position (field) and DECL_SIZE (field)
3479 divided by BITS_PER_UNIT rounded up.
3481 2023-03-10 Jason Merrill <jason@redhat.com>
3484 * lambda.cc (compare_lambda_template_head): Check more
3485 for error_mark_node.
3487 2023-03-10 Jason Merrill <jason@redhat.com>
3490 * mangle.cc (anon_aggr_naming_decl): New.
3491 (write_unqualified_name): Use it.
3493 2023-03-10 Jakub Jelinek <jakub@redhat.com>
3496 * decl.cc (poplevel): Suppress OPT_Wunused_variable warning
3497 after diagnosing it.
3499 2023-03-10 Jason Merrill <jason@redhat.com>
3502 * decl.cc (grokdeclarator): Handle non-typedef typedef_decl.
3504 2023-03-10 Jason Merrill <jason@redhat.com>
3507 * class.cc (instantiate_type): Strip location wrapper.
3509 2023-03-09 Jason Merrill <jason@redhat.com>
3512 * init.cc (find_allocator_temps_r): New.
3513 (combine_allocator_temps): Replace find_allocator_temp.
3514 (build_vec_init): Adjust.
3516 2023-03-09 Jason Merrill <jason@redhat.com>
3520 * pt.cc (alias_ctad_tweaks): Continue after deduction failure.
3522 2023-03-09 Jason Merrill <jason@redhat.com>
3523 Michael Spertus <mike@spertus.com>
3526 * pt.cc (corresponding_template_parameter_list): Split out...
3527 (corresponding_template_parameter): ...from here.
3528 (find_template_parameters): Factor out...
3529 (find_template_parameter_info::find_in): ...this function.
3530 (find_template_parameter_info::find_in_recursive): New.
3531 (find_template_parameter_info::found): New.
3532 (alias_ctad_tweaks): Only add parms used in the deduced args.
3534 2023-03-09 Jason Merrill <jason@redhat.com>
3536 * cp-trait.def (IS_DEDUCIBLE): Add space to name.
3538 2023-03-09 Jason Merrill <jason@redhat.com>
3541 * cp-trait.def (IS_DEDUCIBLE): New.
3542 * cxx-pretty-print.cc (pp_cxx_trait): Handle non-type.
3543 * parser.cc (cp_parser_trait): Likewise.
3544 * tree.cc (cp_tree_equal): Likewise.
3545 * pt.cc (tsubst_copy_and_build): Likewise.
3546 (type_targs_deducible_from): New.
3547 (alias_ctad_tweaks): Use it.
3548 * semantics.cc (trait_expr_value): Handle CPTK_IS_DEDUCIBLE.
3549 (finish_trait_expr): Likewise.
3550 * constraint.cc (diagnose_trait_expr): Likewise.
3551 * cp-tree.h (type_targs_deducible_from): Declare.
3553 2023-03-07 Jason Merrill <jason@redhat.com>
3557 * pt.cc (tsubst_function_decl): Don't replace the closure
3558 parameter if DECL_STATIC_FUNCTION_P.
3560 2023-03-07 Marek Polacek <polacek@redhat.com>
3563 * call.cc (reference_like_class_p): New.
3564 (do_warn_dangling_reference): Add new bool parameter. See through
3565 reference_like_class_p.
3567 2023-03-07 Jakub Jelinek <jakub@redhat.com>
3570 * rtti.cc (emit_support_tinfo_1): Don't assert that last
3571 unemitted_tinfo_decls element is tinfo, instead pop from it only in
3573 * decl2.cc (c_parse_final_cleanups): Don't call emit_tinfo_decl
3574 for unemitted_tinfO_decls which have already non-NULL DECL_INITIAL.
3576 2023-03-07 Marek Polacek <polacek@redhat.com>
3579 * constexpr.cc (cxx_eval_call_expression): Relax assert.
3581 2023-03-07 Marek Polacek <polacek@redhat.com>
3584 * constexpr.cc (potential_constant_expression_1) <case CALL_EXPR>: Pass
3585 'any' when recursing on a VAR_DECL and not a pointer to function.
3587 2023-03-04 Jakub Jelinek <jakub@redhat.com>
3590 * constexpr.cc: Include toplev.h.
3591 (cxx_eval_constant_expression) <case DECL_EXPR>: When seeing a local
3592 static initialized by constant expression outside of a constexpr
3593 function which has been deferred by make_rtl_for_nonlocal_decl,
3594 call rest_of_decl_compilation on it.
3596 2023-03-03 Patrick Palka <ppalka@redhat.com>
3599 * pt.cc (el_data::skipped_trees): New data member.
3600 (extract_locals_r): Push to skipped_trees any unevaluated
3601 contexts that we skipped over.
3602 (extract_local_specs): For the second walk, start from each
3603 tree in skipped_trees.
3605 2023-03-03 Alexandre Oliva <oliva@adacore.com>
3607 * typeck.cc (cp_build_binary_op): Suppress redundant warning
3608 for pfn null test in pmfn test with vbit-in-delta.
3610 2023-03-02 Jakub Jelinek <jakub@redhat.com>
3613 * cp-tree.h (enum cp_tree_index): Remove CPTI_FALLBACK_DFLOAT*_TYPE
3615 (fallback_dfloat32_type, fallback_dfloat64_type,
3616 fallback_dfloat128_type): Remove.
3617 * rtti.cc (emit_support_tinfo_1): If not emitted already, call
3618 emit_tinfo_decl and remove from unemitted_tinfo_decls right away.
3619 (emit_support_tinfos): Move &dfloat*_type_node from fundamentals array
3620 into new fundamentals_with_fallback array. Call emit_support_tinfo_1
3621 on elements of that array too, with the difference that if
3622 the type is NULL, use a fallback REAL_TYPE for it temporarily.
3623 Drop the !targetm.decimal_float_supported_p () handling. Call
3624 targetm.emit_support_tinfos at the end.
3625 * mangle.cc (write_builtin_type): Remove references to
3626 fallback_dfloat*_type. Handle bfloat16_type_node mangling.
3628 2023-03-02 Patrick Palka <ppalka@redhat.com>
3632 * cp-gimplify.cc (cp_fully_fold): Add an internal overload that
3633 additionally takes and propagate an mce_value parameter, and
3634 define the existing public overload in terms of it.
3635 (cp_fully_fold_init): Pass mce_false to cp_fully_fold.
3637 2023-03-02 Patrick Palka <ppalka@redhat.com>
3640 * constexpr.cc (maybe_constant_init_1): Override
3641 manifestly_const_eval to true if is_static.
3643 2023-03-02 Jakub Jelinek <jakub@redhat.com>
3646 * cp-gimplify.cc (cp_genericize_r) <case USING_STMT>: Set
3647 DECL_SOURCE_LOCATION on IMPORTED_DECL to expression location
3648 of USING_STMT or input_location.
3650 2023-03-02 Marek Polacek <polacek@redhat.com>
3653 * parser.cc (class_decl_loc_t::diag_mismatched_tags): If the first
3654 lookup of SPEC didn't find anything, try to look for
3655 most_general_template.
3657 2023-03-02 Jakub Jelinek <jakub@redhat.com>
3660 * parser.cc (cp_convert_omp_range_for): Allow in assert
3661 decomp_first_name without DECL_HAS_VALUE_EXPR_P if it has
3662 error_mark_node type.
3663 (cp_finish_omp_range_for): Don't set DECL_HAS_VALUE_EXPR_P back
3664 on decls which have error_mark_node type.
3666 2023-03-01 Marek Polacek <polacek@redhat.com>
3669 * constexpr.cc (cxx_eval_constant_expression): Emit an error when
3670 a PTRMEM_CST cannot be evaluated.
3672 2023-03-01 Patrick Palka <ppalka@redhat.com>
3674 * pt.cc (tsubst_scope): Define.
3675 (tsubst_decl) <case USING_DECL>: Call tsubst_scope instead of
3676 calling tsubst_scope with tf_qualifying_scope set.
3677 (tsubst_qualified_id): Call tsubst_scope instead of
3678 calling tsubst with tf_qualifying_scope set.
3679 (tsubst_copy): Immediately delegate to tsubst for all TYPE_P
3680 trees. Remove tf_qualifying_scope manipulation.
3681 <case SCOPE_REF>: Call tsubst_scope instead of calling
3682 tsubst with tf_qualifying_scope set.
3684 2023-03-01 Patrick Palka <ppalka@redhat.com>
3685 Jason Merrill <jason@redhat.com>
3689 * constexpr.cc (fold_to_constant): Define.
3690 (maybe_constant_value): Move up early exit test for unevaluated
3691 operands. Try reducing an unevaluated operand to a constant via
3693 (fold_non_dependent_expr_template): Add early exit test for
3694 CONSTANT_CLASS_P nodes. Try reducing an unevaluated operand
3695 to a constant via fold_to_constant.
3696 * cp-tree.h (fold_to_constant): Declare.
3698 2023-03-01 Jakub Jelinek <jakub@redhat.com>
3701 * constexpr.cc (potential_constant_expression_1) <case DECL_EXPR>:
3702 Only recurse on DECL_INITIAL (tmp) if tmp is a VAR_DECL, otherwise
3705 2023-02-28 Patrick Palka <ppalka@redhat.com>
3708 * pt.cc (finish_template_variable): Move dependence check
3710 (lookup_and_finish_template_variable): ... here.
3711 * semantics.cc (finish_id_expression_1): Call
3712 finish_template_variable sooner, before (and regardless of) the
3713 type_dependent_expression_p test.
3715 2023-02-28 Marek Polacek <polacek@redhat.com>
3718 * pt.cc (lookup_and_finish_template_variable): Clear tf_partial.
3720 2023-02-20 Marek Polacek <polacek@redhat.com>
3723 * constexpr.cc (cxx_eval_call_expression): Replace shortcutting trivial
3724 constructor/op= with a checking assert.
3726 2023-02-20 Marek Polacek <polacek@redhat.com>
3729 * pt.cc (prepend_one_capture): Set LAMBDA_CAPTURE_EXPLICIT_P.
3730 (tsubst_lambda_expr): Pass LAMBDA_CAPTURE_EXPLICIT_P to
3731 prepend_one_capture.
3733 2023-02-18 Jason Merrill <jason@redhat.com>
3743 * semantics.cc (finish_static_assert): Don't diagnose in
3746 2023-02-17 Patrick Palka <ppalka@redhat.com>
3750 * cp-gimplify.cc (enum fold_flags): Define.
3751 (fold_flags_t): Declare.
3752 (cp_fold_data::genericize): Replace this data member with ...
3753 (cp_fold_data::fold_flags): ... this.
3754 (cp_fold_r): Adjust use of cp_fold_data and calls to cp_fold.
3755 (cp_fold_function): Likewise.
3756 (cp_fold_maybe_rvalue): Add an internal overload that
3757 additionally takes and propagates a fold_flags_t parameter, and
3758 define the existing public overload in terms of it.
3759 (cp_fold_rvalue): Likewise.
3760 (cp_fully_fold_init): Adjust use of cp_fold_data.
3761 (fold_cache): Replace with ...
3762 (fold_caches): ... this 2-element array of caches.
3763 (get_fold_cache): Define.
3764 (clear_fold_cache): Adjust.
3765 (cp_fold): Add fold_flags_t parameter. Use get_fold_cache.
3766 Pass flags to calls to cp_fold, cp_fold_rvalue and
3767 cp_fold_maybe_rvalue.
3768 <case CALL_EXPR>: If ff_mce_false is set, fold
3769 __builtin_is_constant_evaluated to false and pass mce_false to
3770 maybe_constant_value.
3772 2023-02-17 Patrick Palka <ppalka@redhat.com>
3774 * constexpr.cc (constexpr_call::manifestly_const_eval): Give
3775 it type int instead of bool.
3776 (constexpr_ctx::manifestly_const_eval): Give it type mce_value
3778 (cxx_eval_builtin_function_call): Adjust after making
3779 manifestly_const_eval tri-state.
3780 (cxx_eval_call_expression): Likewise.
3781 (cxx_eval_binary_expression): Likewise.
3782 (cxx_eval_conditional_expression): Likewise.
3783 (cxx_eval_constant_expression): Likewise.
3784 (cxx_eval_outermost_constant_expr): Likewise.
3785 (cxx_constant_value): Likewise.
3786 (cxx_constant_dtor): Likewise.
3787 (maybe_constant_value): Give manifestly_const_eval parameter
3788 type mce_value instead of bool and adjust accordingly.
3789 (fold_non_dependent_expr_template): Adjust call
3790 to cxx_eval_outermost_constant_expr.
3791 (fold_non_dependent_expr): Likewise.
3792 (maybe_constant_init_1): Likewise.
3793 * constraint.cc (satisfy_atom): Adjust call to
3794 maybe_constant_value.
3795 * cp-tree.h (enum class mce_value): Define.
3796 (maybe_constant_value): Adjust manifestly_const_eval parameter
3797 type and default argument.
3798 * decl.cc (compute_array_index_type_loc): Adjust call to
3799 maybe_constant_value.
3800 * pt.cc (convert_nontype_argument): Likewise.
3802 2023-02-16 Patrick Palka <ppalka@redhat.com>
3805 * cp-tree.h (enum tsubst_flags): New flag tf_qualifying_scope.
3806 * decl.cc (make_typename_type): Use lookup_member instead of
3807 lookup_field. If tf_qualifying_scope is set, pass want_type=true
3808 instead of =false to lookup_member. Generalize format specifier
3809 in diagnostic to handle both type and non-type bindings.
3810 * pt.cc (tsubst_aggr_type_1): Clear tf_qualifying_scope. Tidy
3812 (tsubst_decl) <case USING_DECL>: Set tf_qualifying_scope when
3813 substituting USING_DECL_SCOPE.
3814 (tsubst): Clear tf_qualifying_scope right away and remember if
3815 it was set. Do the same for tf_tst_ok sooner.
3816 <case TYPENAME_TYPE>: Set tf_qualifying_scope when substituting
3817 TYPE_CONTEXT. Pass tf_qualifying_scope to make_typename_type
3819 (tsubst_qualified_id): Set tf_qualifying_scope when substituting
3821 (tsubst_copy): Clear tf_qualifying_scope and remember if it was
3823 <case SCOPE_REF>: Set tf_qualifying_scope when substituting the
3825 <case *_TYPE>: Pass tf_qualifying_scope to tsubst if it was set.
3826 * search.cc (lookup_member): Document default argument.
3828 2023-02-16 Patrick Palka <ppalka@redhat.com>
3830 * cp-tree.h: Mechanically drop static from static inline
3831 functions via s/^static inline/inline/g.
3833 2023-02-15 Marek Polacek <polacek@redhat.com>
3836 * call.cc (joust_maybe_elide_copy): Return false for ck_ambig.
3838 2023-02-10 Marek Polacek <polacek@redhat.com>
3841 * call.cc (set_up_extended_ref_temp): Pass var to maybe_constant_init.
3843 2023-02-09 Tobias Burnus <tobias@codesourcery.com>
3845 * parser.cc (cp_parser_omp_allocate): Parse align
3846 clause and check for restrictions.
3848 2023-02-09 Jakub Jelinek <jakub@redhat.com>
3851 * mangle.cc (write_expression, write_template_arg): Handle
3852 EXCESS_PRECISION_EXPR with REAL_CST operand as
3853 write_template_arg_literal on fold_convert of the REAL_CST
3854 to EXCESS_PRECISION_EXPR type.
3856 2023-02-06 Patrick Palka <ppalka@redhat.com>
3859 * cp-tree.h (call_expr_dependent_name): Declare.
3860 * pt.cc (iterative_hash_template_arg) <case CALL_EXPR>: Use
3861 call_expr_dependent_name instead of dependent_name.
3862 * tree.cc (call_expr_dependent_name): Define.
3863 (called_fns_equal): Adjust to take two CALL_EXPRs instead of
3864 CALL_EXPR_FNs thereof. Use call_expr_dependent_name instead
3866 (cp_tree_equal) <case CALL_EXPR>: Adjust call to called_fns_equal.
3868 2023-02-03 Marek Polacek <polacek@redhat.com>
3871 * constexpr.cc (cxx_eval_array_reference): Don't replace
3874 2023-02-03 Patrick Palka <ppalka@redhat.com>
3877 * semantics.cc (finish_call_expr): Strip ADDR_EXPR from
3878 the selected callee during overload set pruning.
3880 2023-02-03 Patrick Palka <ppalka@redhat.com>
3883 * class.cc (check_methods): Diagnose an unviable OVERLOAD
3884 set for CLASSTYPE_DESTRUCTOR differently from an ambiguous one.
3885 Then prune the OVERLOAD to a single function.
3886 (check_bases_and_members): Handle CLASSTYPE_DESTRUCTOR being
3887 an OVERLOAD when calling deduce_noexcept_on_destructor.
3888 Document why it has to be called before check_methods.
3890 2023-02-03 Patrick Palka <ppalka@redhat.com>
3893 * class.cc (check_methods): Swap order of constraints_satisfied_p
3894 and copy/move_fn_p tests.
3896 2023-02-01 Marek Polacek <polacek@redhat.com>
3899 * call.cc (build_new_op): Don't call warn_logical_operator when
3900 processing a template.
3902 2023-02-01 Jakub Jelinek <jakub@redhat.com>
3905 * constexpr.cc (cxx_eval_constant_expression): Handle OMP_*
3906 and OACC_* constructs as non-constant.
3907 (potential_constant_expression_1): Handle OMP_SCAN and OMP_SCOPE.
3909 2023-02-01 Jason Merrill <jason@redhat.com>
3911 * class.cc (note_name_declared_in_class): Change from permerror to
3912 -Wchanges-meaning pedwarn, forcing -pedantic-errors for most cases.
3914 2023-01-31 Jason Merrill <jason@redhat.com>
3917 * cp-gimplify.cc (any_non_eliding_target_exprs): New.
3918 (cp_genericize_init): Check it.
3920 2023-01-31 Marek Polacek <polacek@redhat.com>
3924 * cp-tree.h (instantiation_dependent_expression_p): Don't
3927 2023-01-26 Marek Polacek <polacek@redhat.com>
3930 * parser.cc: Remove unnecessary forward declarations.
3931 (cp_parser_string_literal): New wrapper.
3932 (cp_parser_string_literal_common): Renamed from
3933 cp_parser_string_literal. Add a bool parameter. Give an error when
3934 UDLs are not permitted.
3935 (cp_parser_userdef_string_literal): New wrapper.
3936 (finish_userdef_string_literal): Renamed from
3937 cp_parser_userdef_string_literal.
3938 (cp_parser_primary_expression): Call cp_parser_userdef_string_literal
3939 instead of cp_parser_string_literal.
3940 (cp_parser_linkage_specification): Move a variable declaration closer
3942 (cp_parser_static_assert): Likewise.
3943 (cp_parser_operator): Call cp_parser_userdef_string_literal instead of
3944 cp_parser_string_literal.
3945 (cp_parser_asm_definition): Move a variable declaration closer to its
3947 (cp_parser_asm_specification_opt): Move variable declarations closer to
3949 (cp_parser_asm_operand_list): Likewise.
3950 (cp_parser_asm_clobber_list): Likewise.
3952 2023-01-26 Jakub Jelinek <jakub@redhat.com>
3955 * parser.cc (cp_convert_omp_range_for): If cp_finish_decomp has been
3956 called in !processing_template_decl with processing_template_decl
3957 temporarily set, clear DECL_HAS_VALUE_EXPR_P on the vars temporarily.
3958 (cp_finish_omp_range_for): And set it back again here.
3960 2023-01-25 Jakub Jelinek <jakub@redhat.com>
3963 * mangle.cc (write_closure_type_name): Don't assume all
3964 lambda operator() fns are methods.
3966 2023-01-24 Jason Merrill <jason@redhat.com>
3969 * parser.cc (cp_lexer_new_main): Pass C_LEX_STRING_NO_JOIN for first
3972 2023-01-24 Jason Merrill <jason@redhat.com>
3975 * pt.cc (tsubst_function_decl): Handle static lambda.
3977 2023-01-24 Jakub Jelinek <jakub@redhat.com>
3980 * cp-gimplify.cc (cp_fold_r): Revert 2023-01-19 changes.
3982 2023-01-24 Jason Merrill <jason@redhat.com>
3986 * cp-gimplify.cc (cp_fold_r) [TARGET_EXPR]: In case of double
3987 TARGET_EXPR, keep the outer one instead of the inner one.
3988 (maybe_replace_decl): New.
3990 2023-01-23 Jason Merrill <jason@redhat.com>
3993 * cp-gimplify.cc (cp_gimplify_init_expr): Allow unexpected elision
3996 2023-01-23 Marek Polacek <polacek@redhat.com>
3999 * cvt.cc (ocp_convert): copy_warning when creating a new
4001 * init.cc (build_new_1): Suppress -Wunused-value on
4002 compiler-generated COMPOUND_EXPRs.
4004 2023-01-23 Jason Merrill <jason@redhat.com>
4007 * call.cc (build_user_type_conversion_1): Check whether the
4008 iterators also find a list ctor.
4010 2023-01-23 Jason Merrill <jason@redhat.com>
4013 * decl.cc (grokdeclarator): Check whether DECL_RESULT is already
4016 2023-01-23 Jason Merrill <jason@redhat.com>
4020 * call.cc (extend_ref_init_temps_1): Handle ptrmem expression.
4022 2023-01-19 Jakub Jelinek <jakub@redhat.com>
4025 * cp-tree.h (keep_unused_object_arg): Declare.
4026 * call.cc (keep_unused_object_arg): No longer static.
4027 * tree.cc (build_min_non_dep_op_overload): Handle ARRAY_REF
4028 with overload being static member function.
4030 2023-01-19 Jakub Jelinek <jakub@redhat.com>
4033 * cp-gimplify.cc (cp_fold_r): During cp_fully_fold_init replace
4034 DECL_ANON_UNION_VAR_P VAR_DECLs with their corresponding
4037 2023-01-16 Jakub Jelinek <jakub@redhat.com>
4040 * decl.cc (cp_finish_decl): Check warning_enabled_at
4041 at the DECL_SOURCE_LOCATION (decl) for OPT_Winit_self instead
4044 2023-01-14 Jakub Jelinek <jakub@redhat.com>
4047 * typeck.cc (cp_build_binary_op): Use may_shorten_divmod for integral
4050 2023-01-13 Jakub Jelinek <jakub@redhat.com>
4053 * cvt.cc (cp_convert_and_check): For EXCESS_PRECISION_EXPR
4054 use its operand except that for warning purposes use the original
4055 EXCESS_PRECISION_EXPR.
4056 * call.cc (convert_like_internal): Only look through
4057 EXCESS_PRECISION_EXPR when calling cp_convert, not when calling
4058 cp_convert_and_check.
4060 2023-01-09 Jakub Jelinek <jakub@redhat.com>
4065 * call.cc (maybe_init_list_as_range): Always return NULL_TREE if
4066 processing_template_decl.
4068 2023-01-05 Patrick Palka <ppalka@redhat.com>
4071 * parser.cc (cp_parser_class_head): Use dk_deferred instead of
4072 dk_no_check when parsing the class name.
4074 2023-01-05 Jakub Jelinek <jakub@redhat.com>
4077 * semantics.cc (finish_omp_target_clauses): Ignore clauses other than
4080 2023-01-04 Patrick Palka <ppalka@redhat.com>
4083 * decl2.cc (mark_single_function): Ignore mark_used failure
4084 only in a non-SFINAE context rather than in a SFINAE one.
4086 2023-01-04 Jakub Jelinek <jakub@redhat.com>
4089 * decl.cc (merge_default_template_args): Return false if either
4090 new_parm or old_parm are erroneous.
4093 Copyright (C) 2023 Free Software Foundation, Inc.
4095 Copying and distribution of this file, with or without modification,
4096 are permitted in any medium without royalty provided the copyright
4097 notice and this notice are preserved.