1 2023-12-20 Jason Merrill <jason@redhat.com>
5 * except.cc (maybe_splice_retval_cleanup): Handle an empty block.
7 2023-12-20 Jason Merrill <jason@redhat.com>
10 * typeck.cc (cp_build_array_ref): Handle swapped operands.
12 2023-12-19 Patrick Palka <ppalka@redhat.com>
15 * method.cc (synthesize_method): Use maybe_push_to_top_level
16 and maybe_pop_from_top_level.
18 2023-12-19 Patrick Palka <ppalka@redhat.com>
20 * name-lookup.cc (struct local_state_t): Define.
21 (local_state_stack): Define.
22 (maybe_push_to_top_level): Use them.
23 (maybe_pop_from_top_level): Likewise.
24 * pt.cc (instantiate_decl): Remove dead code for saving/restoring
25 cp_unevaluated_operand and c_inhibit_evaluation_warnings.
27 2023-12-19 Nathaniel Shead <nathanieloshead@gmail.com>
30 * constexpr.cc (cxx_bind_parameters_in_call): Check for calling
31 non-static member functions with a null pointer.
33 2023-12-19 Sandra Loosemore <sandra@codesourcery.com>
35 * decl.cc (omp_declare_variant_finalize_one): Adjust for new
37 * parser.cc (omp_construct_selectors): Delete.
38 (omp_device_selectors): Delete.
39 (omp_implementation_selectors): Delete.
40 (omp_user_selectors): Delete.
41 (cp_parser_omp_context_selector): Adjust for new representations
42 and simplify dispatch logic. Uniformly warn instead of sometimes
43 error when an unknown selector is found. Adjust error messages
44 for extraneous/incorrect score.
45 (cp_parser_omp_context_selector_specification): Likewise.
46 * pt.cc (tsubst_attribute): Adjust for new representations.
48 2023-12-19 Sandra Loosemore <sandra@codesourcery.com>
50 * parser.cc (cp_parser_omp_context_selector): Adjust for new
51 namelist property representation.
52 * pt.cc (tsubst_attribute): Likewise.
54 2023-12-19 Sandra Loosemore <sandra@codesourcery.com>
56 * parser.cc (cp_parser_omp_context_selector): Use new constructors.
57 * pt.cc: Include omp-general.h.
58 (tsubst_attribute): Use new context selector accessors and
61 2023-12-19 Patrick Palka <ppalka@redhat.com>
64 * cp-tree.h (comp_template_args): Remove partial_order parameter.
65 (template_args_equal): Likewise.
66 * pt.cc (comparing_for_partial_ordering): New global flag.
67 (iterative_hash_template_arg) <case tcc_type>: Hash the template
68 and arguments for specializations that use structural equality.
69 (template_args_equal): Remove partial order parameter and
70 use comparing_for_partial_ordering instead.
71 (comp_template_args): Likewise.
72 (comp_template_args_porder): Set comparing_for_partial_ordering
74 (any_template_arguments_need_structural_equality_p): Return true
75 for an argument that's a dependent alias template specialization
76 or a class template specialization that itself needs structural
78 * tree.cc (cp_tree_equal) <case TREE_VEC>: Adjust call to
81 2023-12-19 Patrick Palka <ppalka@redhat.com>
84 * cp-tree.h (TEMPLATE_DECL_COMPLEX_ALIAS_P): Remove.
85 (most_general_template): Constify parameter.
86 * pt.cc (push_template_decl): Adjust after removing
87 TEMPLATE_DECL_COMPLEX_ALIAS_P.
88 (complex_alias_tmpl_info): New hash_map.
89 (uses_all_template_parms_data::seen): Change type to
91 (complex_alias_template_r): Adjust accordingly.
92 (complex_alias_template_p): Add 'seen_out' out parameter.
93 Call most_general_template and check PRIMARY_TEMPLATE_P.
94 Use complex_alias_tmpl_info to cache the result and set
95 '*seen_out' accordigly.
96 (dependent_alias_template_spec_p): Add !processing_template_decl
97 early exit test. Consider dependence of only template arguments
98 corresponding to seen template parameters as per
100 2023-12-19 Thomas Schwinge <thomas@codesourcery.com>
103 * parser.cc (cp_parser_oacc_declare): For "more than once", check
104 the DECL that we're actually setting the attribute on.
106 2023-12-16 Nathaniel Shead <nathanieloshead@gmail.com>
109 * module.cc (module_state::write_cluster): Don't skip first
112 2023-12-16 Nathaniel Shead <nathanieloshead@gmail.com>
115 * constexpr.cc (cxx_fold_indirect_ref_1): Check for CLASS_TYPE
116 before using CLASSTYPE_AS_BASE.
118 2023-12-16 Andrew Carlotti <andrew.carlotti@arm.com>
120 * decl2.cc (check_classfn): Update comment to include
121 target_version attributes.
123 2023-12-15 Patrick Palka <ppalka@redhat.com>
127 * pt.cc (tsubst_function_decl): Propagate DECL_SECTION_NAME
128 via set_decl_section_name.
129 (tsubst_decl) <case VAR_DECL>: Likewise.
131 2023-12-15 Patrick Palka <ppalka@redhat.com>
134 * mangle.cc (get_abi_tags): Strip TEMPLATE_DECL before looking
135 up the abi_tag attribute.
137 2023-12-14 Marek Polacek <polacek@redhat.com>
140 * decl.cc (grokdeclarator): Do not issue the auto parameter error while
141 tentatively parsing a function parameter.
142 * parser.cc (cp_parser_parameter_declaration_clause): Check it here.
144 2023-12-14 Marek Polacek <polacek@redhat.com>
147 * cp-gimplify.cc (cp_fold_immediate_r): Check cp_unevaluated_operand
148 and DECL_IMMEDIATE_FUNCTION_P rather than in_immediate_context.
150 2023-12-14 Patrick Palka <ppalka@redhat.com>
152 * cp-tree.h (type_targs_deducible_from): Adjust return type.
153 * pt.cc (alias_ctad_tweaks): Also handle C++23 inherited CTAD.
154 (inherited_ctad_tweaks): Define.
155 (type_targs_deducible_from): Return the deduced arguments or
156 NULL_TREE instead of a bool. Handle 'tmpl' being a TREE_LIST
157 representing a synthetic alias template.
158 (ctor_deduction_guides_for): Do inherited_ctad_tweaks for each
159 USING_DECL in C++23 mode.
160 (deduction_guides_for): Add FIXME for stale cache entries in
161 light of inherited CTAD.
163 2023-12-14 Jakub Jelinek <jakub@redhat.com>
166 * pt.cc (freelist<tree_node>::reinit): Make whole obj->common
167 defined for valgrind annotations rather than just obj->base,
168 and do it even for ENABLE_GC_CHECKING. If not ENABLE_GC_CHECKING,
169 clear TREE_CHAIN (obj) and TREE_TYPE (obj).
171 2023-12-13 Patrick Palka <ppalka@redhat.com>
173 * call.cc (print_z_candidates): Only print ignored candidates
174 when -fdiagnostics-all-candidates is set, otherwise suggest
176 (build_over_call): When diagnosing deletedness, note
177 other candidates only if -fdiagnostics-all-candidates is
178 set, otherwise suggest the flag.
180 2023-12-13 Patrick Palka <ppalka@redhat.com>
182 * call.cc (enum rejection_reason_code): Add rr_ignored.
183 (add_ignored_candidate): Define.
184 (ignored_candidate_p): Define.
185 (add_template_candidate_real): Do add_ignored_candidate
186 instead of returning NULL.
187 (splice_viable): Put ignored (non-viable) candidates last.
188 (print_z_candidate): Handle ignored candidates.
189 (build_new_function_call): Refine shortcut that calls
190 cp_build_function_call_vec now that non-templates can
191 appear in the candidate list for a template-id call.
192 (add_candidates): Replace 'bad_fns' overload with 'bad_cands'
193 candidate list. When not considering a candidate, add it
194 to the list as an ignored candidate. Add all 'bad_cands'
195 to the overload set as well.
197 2023-12-13 Patrick Palka <ppalka@redhat.com>
199 * call.cc: Include "tristate.h".
200 (splice_viable): Sort the candidate list according to viability.
201 Don't remove non-viable candidates from the list.
202 (print_z_candidates): Add defaulted only_viable_p parameter.
203 By default only print non-viable candidates if there is no
205 (tourney): Ignore non-viable candidates. Move the true champ to
206 the front of the candidates list, and update 'candidates' to
207 point to the front. Rename champ_compared_to_predecessor to
208 previous_worse_champ.
210 2023-12-13 Patrick Palka <ppalka@redhat.com>
214 * pt.cc (unify) <case INTEGER_CST>: Compare types as well.
216 2023-12-13 Patrick Palka <ppalka@redhat.com>
219 * pt.cc (unify) <case FUNCTION_DECL>: Handle it like FIELD_DECL
222 2023-12-13 Jason Merrill <jason@redhat.com>
224 * call.cc (convert_for_arg_passing)
225 * typeck.cc (convert_for_assignment): Adjust call to
226 warn_for_address_of_packed_member.
228 2023-12-13 Julian Brown <julian@codesourcery.com>
230 * parser.cc (cp_parser_oacc_all_clauses): Add TARGET_P parameter. Use
231 to select region type for finish_omp_clauses call.
232 (cp_parser_omp_target_data, cp_parser_omp_target_enter_data): Support
233 GOMP_MAP_ATTACH kind.
234 (cp_parser_omp_target_exit_data): Support GOMP_MAP_DETACH kind.
235 (cp_parser_oacc_declare): Update call to cp_parser_oacc_all_clauses.
236 (cp_parser_oacc_loop): Update calls to cp_parser_oacc_all_clauses.
237 (cp_parser_oacc_compute): Likewise.
238 * pt.cc (tsubst_expr): Use C_ORT_ACC_TARGET for call to
239 tsubst_omp_clauses for OpenACC compute regions.
240 * semantics.cc (cp_omp_address_inspector): New class, derived from
241 c_omp_address_inspector.
242 (handle_omp_array_sections_1, handle_omp_array_sections,
243 finish_omp_clauses): Use cp_omp_address_inspector class and OMP address
244 tokenizer to analyze and expand OpenMP map clause expressions. Fix
245 some diagnostics. Support C_ORT_ACC_TARGET.
246 (finish_omp_target): Handle GOMP_MAP_POINTER.
248 2023-12-13 Julian Brown <julian@codesourcery.com>
250 * semantics.cc (finish_omp_clause): Add braces and reindent
251 OMP_CLAUSE_TO/OMP_CLAUSE_FROM/OMP_CLAUSE__CACHE_ stanza.
253 2023-12-13 Jason Merrill <jason@redhat.com>
256 * tree.cc (bot_manip): Check data.clear_location for TARGET_EXPR.
258 2023-12-13 Nathaniel Shead <nathanieloshead@gmail.com>
261 * constexpr.cc (constexpr_global_ctx::get_value_ptr): Don't
262 return NULL_TREE for objects we're initializing.
263 (constexpr_global_ctx::destroy_value): Rename from remove_value.
264 Only mark real variables as outside lifetime.
265 (constexpr_global_ctx::clear_value): New function.
266 (destroy_value_checked): New function.
267 (cxx_eval_call_expression): Defer complaining about non-constant
268 arg0 for operator delete. Use remove_value_safe.
269 (cxx_fold_indirect_ref_1): Handle conversion to 'as base' type.
270 (outside_lifetime_error): Include name of object we're
272 (cxx_eval_store_expression): Handle clobbers. Improve error
274 (cxx_eval_constant_expression): Use remove_value_safe. Clear
275 bind variables before entering body.
277 2023-12-13 Jason Merrill <jason@redhat.com>
279 * constexpr.cc (cxx_eval_call_expression): Handle missing in-charge
282 2023-12-13 Jason Merrill <jason@redhat.com>
285 * constexpr.cc (cxx_eval_outermost_constant_expr): Turn
286 a constructor CALL_EXPR into a TARGET_EXPR.
288 2023-12-13 Jason Merrill <jason@redhat.com>
290 * tree.cc (build_aggr_init_expr): Copy EXPR_LOCATION.
292 2023-12-12 Jason Merrill <jason@redhat.com>
293 Jason Xu <rxu@DRWHoldings.com>
295 * class.cc (propagate_class_warmth_attribute): Handle
298 2023-12-12 Jason Merrill <jason@redhat.com>
299 Nathaniel Shead <nathanieloshead@gmail.com>
301 * call.cc (build_trivial_dtor_call): Use CLOBBER_OBJECT_END.
302 * decl.cc (build_clobber_this): Take clobber_kind argument.
303 (start_preparsed_function): Pass CLOBBER_OBJECT_BEGIN.
304 (begin_destructor_body): Pass CLOBBER_OBJECT_END.
306 2023-12-11 Patrick Palka <ppalka@redhat.com>
308 * pt.cc (alias_ctad_tweaks): Pass use_spec_table=false to
311 2023-12-11 Tobias Burnus <tobias@codesourcery.com>
313 * parser.cc (cp_parser_omp_requires): Handle acquires/release
314 in atomic_default_mem_order clause.
315 (cp_parser_omp_atomic): Update.
317 2023-12-11 Nathaniel Shead <nathanieloshead@gmail.com>
321 * call.cc (build_over_call): Prevent folding of trivial special
322 members when checking for noexcept.
323 * method.cc (constructible_expr): Perform value-initialisation
324 for empty parameter lists.
325 (is_nothrow_xible): Treat as noexcept operator.
327 2023-12-11 Nathaniel Shead <nathanieloshead@gmail.com>
331 * pt.cc (tsubst_template_decl): Clear
332 DECL_UNINSTANTIATED_TEMPLATE_FRIEND_P.
334 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
336 * cp-trait.def: Define __remove_pointer.
337 * semantics.cc (finish_trait_type): Handle CPTK_REMOVE_POINTER.
339 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
341 * cp-trait.def: Define __is_object.
342 * constraint.cc (diagnose_trait_expr): Handle CPTK_IS_OBJECT.
343 * semantics.cc (trait_expr_value): Likewise.
344 (finish_trait_expr): Likewise.
346 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
348 * cp-trait.def: Define __is_function.
349 * constraint.cc (diagnose_trait_expr): Handle CPTK_IS_FUNCTION.
350 * semantics.cc (trait_expr_value): Likewise.
351 (finish_trait_expr): Likewise.
353 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
355 * cp-trait.def: Define __is_reference.
356 * constraint.cc (diagnose_trait_expr): Handle CPTK_IS_REFERENCE.
357 * semantics.cc (trait_expr_value): Likewise.
358 (finish_trait_expr): Likewise.
360 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
362 * cp-trait.def: Define __is_member_object_pointer.
363 * constraint.cc (diagnose_trait_expr): Handle
364 CPTK_IS_MEMBER_OBJECT_POINTER.
365 * semantics.cc (trait_expr_value): Likewise.
366 (finish_trait_expr): Likewise.
368 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
370 * cp-trait.def: Define __is_member_function_pointer.
371 * constraint.cc (diagnose_trait_expr): Handle
372 CPTK_IS_MEMBER_FUNCTION_POINTER.
373 * semantics.cc (trait_expr_value): Likewise.
374 (finish_trait_expr): Likewise.
376 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
378 * cp-trait.def: Define __is_member_pointer.
379 * constraint.cc (diagnose_trait_expr): Handle
380 CPTK_IS_MEMBER_POINTER.
381 * semantics.cc (trait_expr_value): Likewise.
382 (finish_trait_expr): Likewise.
384 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
386 * cp-trait.def: Define __is_scoped_enum.
387 * constraint.cc (diagnose_trait_expr): Handle CPTK_IS_SCOPED_ENUM.
388 * semantics.cc (trait_expr_value): Likewise.
389 (finish_trait_expr): Likewise.
391 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
393 * cp-trait.def: Define __is_bounded_array.
394 * constraint.cc (diagnose_trait_expr): Handle
395 CPTK_IS_BOUNDED_ARRAY.
396 * semantics.cc (trait_expr_value): Likewise.
397 (finish_trait_expr): Likewise.
399 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
401 * cp-trait.def: Define __is_array.
402 * constraint.cc (diagnose_trait_expr): Handle CPTK_IS_ARRAY.
403 * semantics.cc (trait_expr_value): Likewise.
404 (finish_trait_expr): Likewise.
406 2023-12-10 Jason Merrill <jason@redhat.com>
408 * parser.cc (cp_parser_simple_type_specifier): Move trait
409 handling to default label.
411 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
413 * parser.cc (cp_lexer_lookup_trait): Rename to ...
414 (cp_lexer_peek_trait): ... this. Handle a subsequent token for
415 the corresponding built-in trait.
416 (cp_lexer_lookup_trait_expr): Rename to ...
417 (cp_lexer_peek_trait_expr): ... this.
418 (cp_lexer_lookup_trait_type): Rename to ...
419 (cp_lexer_peek_trait_type): ... this.
420 (cp_lexer_next_token_is_decl_specifier_keyword): Call
421 cp_lexer_peek_trait_type.
422 (cp_parser_simple_type_specifier): Likewise.
423 (cp_parser_primary_expression): Call cp_lexer_peek_trait_expr.
425 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
426 Patrick Palka <ppalka@redhat.com>
428 * cp-objcp-common.cc (names_builtin_p): Remove all RID value
429 cases for built-in traits. Check for built-in traits via
430 the new cik_trait kind.
431 * cp-tree.h (enum cp_trait_kind): Set its underlying type to
433 (struct cp_trait): New struct to hold trait information.
434 (cp_traits): New array to hold a mapping to all traits.
435 (cik_reserved_for_udlit): Rename to ...
436 (cik_trait): ... this.
437 (IDENTIFIER_ANY_OP_P): Exclude cik_trait.
438 (IDENTIFIER_TRAIT_P): New macro to detect cik_trait.
439 * lex.cc (cp_traits): Define its values, declared in cp-tree.h.
440 (init_cp_traits): New function to set cik_trait and
441 IDENTIFIER_CP_INDEX for all built-in trait identifiers.
442 (cxx_init): Call init_cp_traits function.
443 * parser.cc (cp_lexer_lookup_trait): New function to look up a
444 built-in trait by IDENTIFIER_CP_INDEX.
445 (cp_lexer_lookup_trait_expr): Likewise, look up an
446 expression-yielding built-in trait.
447 (cp_lexer_lookup_trait_type): Likewise, look up a type-yielding
449 (cp_keyword_starts_decl_specifier_p): Remove all RID value cases
451 (cp_lexer_next_token_is_decl_specifier_keyword): Handle
452 type-yielding built-in traits.
453 (cp_parser_primary_expression): Remove all RID value cases for
454 built-in traits. Handle expression-yielding built-in traits.
455 (cp_parser_trait): Handle cp_trait instead of enum rid.
456 (cp_parser_simple_type_specifier): Remove all RID value cases
457 for built-in traits. Handle type-yielding built-in traits.
459 2023-12-10 Ken Matsui <kmatsui@gcc.gnu.org>
461 * constraint.cc (diagnose_trait_expr): Sort built-in traits
463 * cp-trait.def: Likewise.
464 * semantics.cc (trait_expr_value): Likewise.
465 (finish_trait_expr): Likewise.
466 (finish_trait_type): Likewise.
468 2023-12-09 Jakub Jelinek <jakub@redhat.com>
470 * parser.cc (cp_parser_statement, cp_parser_expression_statement,
471 cp_parser_declaration, cp_parser_asm_definition): Don't diagnose
472 ignored attributes if !any_nonignored_attribute_p.
473 * decl.cc (grokdeclarator): Likewise.
474 * name-lookup.cc (handle_namespace_attrs, finish_using_directive):
475 Don't diagnose ignoring of attr_ignored_p attributes.
477 2023-12-08 Patrick Palka <ppalka@redhat.com>
480 * semantics.cc (capture_decltype): Inline into its only caller ...
481 (finish_decltype_type): ... here. Update nearby comment to refer
482 to recent standard. Add FIXME. Restrict uncaptured variable type
483 transformation to happen only for lambdas with a by-copy
486 2023-12-08 Jakub Jelinek <jakub@redhat.com>
488 * parser.cc (cp_parser_std_attribute_spec): Return void_list_node
489 rather than NULL_TREE if token is neither CPP_OPEN_SQUARE nor
490 RID_ALIGNAS CPP_KEYWORD.
491 (cp_parser_std_attribute_spec_seq): For attr_spec == void_list_node
492 break, for attr_spec == NULL_TREE continue.
494 2023-12-08 Jakub Jelinek <jakub@redhat.com>
497 * cp-gimplify.cc (cp_fold): If SAVE_EXPR has been previously
498 folded, unshare_expr what is returned.
500 2023-12-08 Patrick Palka <ppalka@redhat.com>
503 * parser.cc (cp_parser_expression_statement): If the statement
504 is error_mark_node, make sure we've seen_error().
506 2023-12-08 Patrick Palka <ppalka@redhat.com>
510 * typeck.cc (cp_build_c_cast): If we're committed to a const_cast
511 and the result is erroneous, call build_const_cast_1 a second
512 time to issue errors. Use complain=tf_none instead of =false.
514 2023-12-06 David Malcolm <dmalcolm@redhat.com>
516 * cp-tree.h (cxx_print_error_function): Make diagnostic_info param
518 * error.cc (cxx_print_error_function): Likewise.
519 (cp_diagnostic_starter): Likewise.
520 (cp_print_error_function): Likewise.
522 2023-12-06 Jason Merrill <jason@redhat.com>
526 * pt.cc (more_specialized_fn): Fix object parameter handling.
528 2023-12-05 Jakub Jelinek <jakub@redhat.com>
531 * cp-tree.h (cp_check_pragma_unroll): Declare.
532 * semantics.cc (cp_check_pragma_unroll): New function.
533 * parser.cc (cp_parser_pragma_unroll): Use cp_check_pragma_unroll.
534 * pt.cc (tsubst_expr) <case ANNOTATE_EXPR>: Likewise.
535 (tsubst_stmt) <case RANGE_FOR_STMT>: Likwsie.
537 2023-12-05 Richard Sandiford <richard.sandiford@arm.com>
539 * tree.cc (cxx_gnu_attribute_table): Add extra braces to work
540 around PR 16333 in older compilers.
542 2023-12-05 Jakub Jelinek <jakub@redhat.com>
545 * parser.cc (cp_parser_block_declaration): Implement C++ DR 2262
546 - Attributes for asm-definition. Call cp_parser_asm_definition
547 even if RID_ASM token is only seen after sequence of standard
549 (cp_parser_asm_definition): Parse standard attributes before
550 RID_ASM token and warn for them with -Wattributes.
552 2023-12-05 Marek Polacek <polacek@redhat.com>
556 * call.cc (in_immediate_context): No longer static.
557 * constexpr.cc (cxx_eval_call_expression): Adjust assert.
558 * cp-gimplify.cc (deferred_escalating_exprs): New vec.
559 (remember_escalating_expr): New.
560 (enum fold_flags): Remove ff_fold_immediate.
561 (immediate_escalating_function_p): New.
562 (unchecked_immediate_escalating_function_p): New.
563 (promote_function_to_consteval): New.
564 (cp_fold_immediate): Move above. Return non-null if any errors were
566 (maybe_explain_promoted_consteval): New.
567 (cp_gimplify_expr) <case CALL_EXPR>: Assert we've handled all
568 immediate invocations.
569 (taking_address_of_imm_fn_error): New.
570 (cp_fold_immediate_r): Merge ADDR_EXPR and PTRMEM_CST cases. Implement
571 P2564 - promoting functions to consteval.
572 <case CALL_EXPR>: Implement P2564 - promoting functions to consteval.
573 (cp_fold_r): If an expression turns into a CALL_EXPR after cp_fold,
574 call cp_fold_immediate_r on the CALL_EXPR.
575 (cp_fold_function): Set DECL_ESCALATION_CHECKED_P if
576 deferred_escalating_exprs does not contain current_function_decl.
577 (process_and_check_pending_immediate_escalating_fns): New.
578 * cp-tree.h (struct lang_decl_fn): Add escalated_p bit-field.
579 (DECL_ESCALATION_CHECKED_P): New.
580 (immediate_invocation_p): Declare.
581 (process_pending_immediate_escalating_fns): Likewise.
582 * decl2.cc (c_parse_final_cleanups): Set at_eof to 2 after all
583 templates have been instantiated; and to 3 at the end of the function.
584 Call process_pending_immediate_escalating_fns.
585 * error.cc (dump_template_bindings): Check at_eof against an updated
587 * module.cc (trees_out::lang_decl_bools): Stream escalated_p.
588 (trees_in::lang_decl_bools): Likewise.
589 * pt.cc (push_tinst_level_loc): Set at_eof to 3, not 2.
590 * typeck.cc (cp_build_addr_expr_1): Don't check
591 DECL_IMMEDIATE_FUNCTION_P.
593 2023-12-04 Jason Merrill <jason@redhat.com>
595 * constexpr.cc (potential_constant_expression_1): Fix
596 check for loading volatile lvalue.
598 2023-12-04 Jakub Jelinek <jakub@redhat.com>
601 * cp-tree.h (cp_convert_range_for): Change UNROLL type from
602 unsigned short to tree.
603 (finish_while_stmt_cond, finish_do_stmt, finish_for_cond): Likewise.
604 * parser.cc (cp_parser_statement): Pass NULL_TREE rather than 0 to
605 cp_parser_iteration_statement UNROLL argument.
606 (cp_parser_for, cp_parser_c_for): Change UNROLL type from
607 unsigned short to tree.
608 (cp_parser_range_for): Likewise. Set RANGE_FOR_UNROLL to just UNROLL
609 rather than build_int_cst from it.
610 (cp_convert_range_for, cp_parser_iteration_statement): Change UNROLL
611 type from unsigned short to tree.
612 (cp_parser_omp_loop_nest): Pass NULL_TREE rather than 0 to
613 cp_parser_range_for UNROLL argument.
614 (cp_parser_pragma_unroll): Return tree rather than unsigned short.
615 If parsed expression is type dependent, just return it, don't diagnose
616 issues with value if it is value dependent.
617 (cp_parser_pragma): Change UNROLL type from unsigned short to tree.
618 * semantics.cc (finish_while_stmt_cond): Change UNROLL type from
619 unsigned short to tree. Build ANNOTATE_EXPR with UNROLL as its last
620 operand rather than build_int_cst from it.
621 (finish_do_stmt, finish_for_cond): Likewise.
622 * pt.cc (tsubst_stmt) <case RANGE_FOR_STMT>: Change UNROLL type from
623 unsigned short to tree and set it to RECUR on RANGE_FOR_UNROLL (t).
624 (tsubst_expr) <case ANNOTATE_EXPR>: For annot_expr_unroll_kind repeat
625 checks on UNROLL value from cp_parser_pragma_unroll.
627 2023-12-02 Richard Sandiford <richard.sandiford@arm.com>
629 * cp-tree.h (cxx_attribute_table): Delete.
630 (cxx_gnu_attribute_table, std_attribute_table): Declare.
631 * cp-objcp-common.h (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): Delete.
632 (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Delete.
633 (cp_objcp_attribute_table): New table.
634 (LANG_HOOKS_ATTRIBUTE_TABLE): Redefine.
635 * tree.cc (cxx_attribute_table): Replace with...
636 (cxx_gnu_attributes, cxx_gnu_attribute_table): ...these globals.
637 (std_attribute_table): Change type to scoped_attribute_specs, using...
638 (std_attributes): ...this as the underlying array.
639 (init_tree): Remove call to register_scoped_attributes.
641 2023-12-01 Jason Merrill <jason@redhat.com>
643 * mangle.cc (write_type): Mangle placeholder as its template.
645 2023-12-01 Jason Merrill <jason@redhat.com>
647 * cp-tree.h (TEMPLATE_ARGS_TYPE_CONSTRAINT_P): New.
648 (get_concept_check_template): Declare.
649 * constraint.cc (combine_constraint_expressions)
650 (finish_shorthand_constraint): Use UNKNOWN_LOCATION.
651 * pt.cc (convert_generic_types_to_packs): Likewise.
652 * mangle.cc (write_constraint_expression)
653 (write_tparms_constraints, write_type_constraint)
654 (template_parm_natural_p, write_requirement)
655 (write_requires_expr): New.
656 (write_encoding): Mangle trailing requires-clause.
657 (write_name): Pass parms to write_template_args.
658 (write_template_param_decl): Factor out from...
659 (write_closure_template_head): ...here.
660 (write_template_args): Mangle non-natural parms
662 (write_expression): Handle REQUIRES_EXPR.
664 2023-12-01 Jason Merrill <jason@redhat.com>
666 * semantics.cc (finish_non_static_data_member)
667 (finish_decltype_type, capture_decltype):
668 Handle deduced closure parameter.
670 2023-11-30 Marek Polacek <polacek@redhat.com>
673 * typeck.cc (finish_class_member_access_expr): When accessing
674 a static data member, use ba_any for lookup_base.
676 2023-11-30 Jakub Jelinek <jakub@redhat.com>
679 * cp-tree.h: Implement C++26 P2169R4 - Placeholder variables with no
681 (OVL_NAME_INDEPENDENT_DECL_P): Define.
682 (add_capture): Add unsigned * argument.
683 (name_independent_decl_p): New inline function.
684 * name-lookup.cc (class name_lookup): Make ambiguous and
685 add_value members public.
686 (name_independent_linear_search): New function.
687 (get_class_binding_direct): Handle member_vec_binary_search
688 returning OVL_NAME_INDEPENDENT_DECL_P OVERLOAD. Use
689 name_independent_linear_search rather than fields_linear_search
690 for linear lookup of _ name if !want_type.
691 (member_name_cmp): Sort name-independent declarations first.
692 (member_vec_dedup): Handle name-independent declarations.
693 (pop_local_binding): Handle binding->value being a TREE_LIST for
694 ambiguous name-independent declarations.
695 (supplement_binding): Handle name-independent declarations.
696 (update_binding): Likewise.
697 (check_local_shadow): Return tree rather than void, normally
698 NULL_TREE but old for name-independent declarations which used
699 to conflict with outer scope declaration. Don't emit -Wshadow*
700 warnings for name-independent declarations.
701 (pushdecl): Handle name-independent declarations.
702 * search.cc (lookup_field_r): Handle nval being a TREE_LIST.
703 * lambda.cc (build_capture_proxy): Adjust for ___.<number>
705 (add_capture): Add NAME_INDEPENDENT_CNT argument. Use ___.<number>
706 name rather than ___ for second and following capture with
708 (add_default_capture): Adjust add_capture caller.
709 * decl.cc (poplevel): Don't warn about name-independent declarations.
710 (duplicate_decls): If in C++26 a _ named declaration conflicts with
711 earlier declarations, emit explaining note why the new declaration
712 is not name-independent.
713 (reshape_init_class): If field is a TREE_LIST, emit an ambiguity
714 error with list of candidates rather than error about non-existing
715 non-static data member.
716 * parser.cc (cp_parser_lambda_introducer): Adjust add_capture callers.
717 Allow name-independent capture redeclarations.
718 (cp_parser_decomposition_declaration): Set decl_specs.storage_class
719 to sc_static for static structured bindings.
720 * pt.cc (tsubst_lambda_expr): Adjust add_capture caller.
722 2023-11-30 Alexandre Oliva <oliva@adacore.com>
724 * decl.cc (finish_enum_value_list): Set TYPE_PACKED if
725 use_short_enum, and propagate it to variants.
727 2023-11-30 Jason Merrill <jason@redhat.com>
729 * cp-tree.h (LAMBDA_EXPR_MUTABLE_P): Remove.
730 * cp-tree.def: Remove documentation.
731 * lambda.cc (build_lambda_expr): Remove reference.
732 * parser.cc (cp_parser_lambda_declarator_opt): Likewise.
733 * pt.cc (tsubst_lambda_expr): Likewise.
734 * ptree.cc (cxx_print_lambda_node): Likewise.
735 * semantics.cc (capture_decltype): Get the object quals
736 from the object instead.
738 2023-11-29 Marek Polacek <polacek@redhat.com>
741 * constexpr.cc (cxx_eval_constant_expression) <case PARM_DECL>: Allow
742 reference to unknown/this as per P2280.
743 <case VAR_DECL>: Allow reference to unknown as per P2280.
745 2023-11-29 Patrick Palka <ppalka@redhat.com>
748 * pt.cc (tsubst_expr) <case MODOP_EXPR>: Look through implicit
749 INDIRECT_REF when propagating -Wparentheses warning suppression.
750 * semantics.cc (maybe_warn_unparenthesized_assignment): Replace
751 REFERENCE_REF_P handling with STRIP_REFERENCE_REF.
752 (finish_parenthesized_expr): Likewise.
754 2023-11-29 Jakub Jelinek <jakub@redhat.com>
756 * semantics.cc (finish_static_assert): Free buf on error return.
758 2023-11-29 Alexandre Oliva <oliva@adacore.com>
760 * decl.cc (maybe_prepare_return_this): Split out of...
761 (maybe_return_this): ... this.
762 * cp-tree.h (maybe_prepare_return_this): Declare.
763 * class.cc (build_clone): Call it.
765 2023-11-29 Alexandre Oliva <oliva@adacore.com>
767 * contracts.cc (check_postcondition_result): Cope with
770 2023-11-28 Jason Merrill <jason@redhat.com>
774 * call.cc (convert_like_internal): Remove obsolete comment.
775 * typeck.cc (decay_conversion): Allow array prvalue.
776 (maybe_warn_about_returning_address_of_local): Check
777 for returning pointer to temporary.
779 2023-11-28 Jakub Jelinek <jakub@redhat.com>
781 * cp-objcp-common.cc (cp_feature_table): Evaluate
782 __has_extension (cxx_init_captures) to 1 even for -std=c++11.
784 2023-11-27 Alex Coplan <alex.coplan@arm.com>
785 Iain Sandoe <iain@sandoe.co.uk>
788 * cp-lang.cc (c_family_register_lang_features): New.
789 * cp-objcp-common.cc (struct cp_feature_selector): New.
790 (cp_feature_selector::has_feature): New.
791 (struct cp_feature_info): New.
792 (cp_register_features): New.
793 * cp-objcp-common.h (cp_register_features): New.
795 2023-11-25 Nathaniel Shead <nathanieloshead@gmail.com>
797 * name-lookup.cc (check_can_export_using_decl): New.
798 (do_nonmember_using_decl): Use above to check if names can be
801 2023-11-25 Nathaniel Shead <nathanieloshead@gmail.com>
804 * decl.cc (duplicate_decls): Allow exporting a redeclaration of
807 2023-11-24 Tobias Burnus <tobias@codesourcery.com>
809 * parser.cc (cp_parser_omp_clause_dist_schedule,
810 cp_parser_omp_scan_loop_body, cp_parser_omp_assumption_clauses,
811 cp_parser_omp_depobj): Add OPT_Wopenmp to warning_at.
812 * semantics.cc (finish_omp_clauses): Likewise.
814 2023-11-24 Tobias Burnus <tobias@codesourcery.com>
816 * parser.cc (cp_parser_omp_depobj): Accept optionally an argument
817 to the destroy clause.
819 2023-11-24 Nathaniel Shead <nathanieloshead@gmail.com>
822 * decl.cc (grokvardecl): Don't mark variables attached to
825 2023-11-24 Nathaniel Shead <nathanieloshead@gmail.com>
828 * module.cc (trees_out::get_merge_kind): Handle lambdas in class
830 (maybe_key_decl): Remove assertion and fix whitespace.
832 2023-11-24 Nathaniel Shead <nathanieloshead@gmail.com>
835 * decl.cc (duplicate_decls): Adjust error message.
836 (xref_tag): Adjust error message. Check exporting decl that is
837 already declared as non-exporting.
839 2023-11-23 Jakub Jelinek <jakub@redhat.com>
842 * parser.cc: Implement C++26 P2741R3 - user-generated static_assert
844 (cp_parser_static_assert): Parse message argument as
845 conditional-expression if it is not a pure string literal or
846 several of them concatenated followed by closing paren.
847 * semantics.cc (finish_static_assert): Handle message which is not
848 STRING_CST. For condition with bare parameter packs return early.
849 * pt.cc (tsubst_expr) <case STATIC_ASSERT>: Also tsubst_expr
850 message and make sure that if it wasn't originally STRING_CST, it
851 isn't after tsubst_expr either.
853 2023-11-22 Patrick Palka <ppalka@redhat.com>
856 * pt.cc (tsubst_aggr_type): Handle empty TYPE_TEMPLATE_INFO
857 in the entering_scope adjustment.
859 2023-11-22 Jason Merrill <jason@redhat.com>
861 * decl.cc (start_preparsed_function): Clarify ctype logic.
863 2023-11-20 Marc Poulhiès <dkm@kataplop.net>
865 * lambda.cc (compare_lambda_sig): Fix typo in variadic.
867 2023-11-20 Jason Merrill <jason@redhat.com>
869 * pt.cc (comp_template_parms): Just one level.
870 (template_parameter_lists_equivalent_p): Likewise.
872 2023-11-20 Jason Merrill <jason@redhat.com>
874 * cp-tree.h (DECL_TEMPLATE_PARM_CHECK): New.
875 (DECL_IMPLICIT_TEMPLATE_PARM_P): New.
876 (decl_template_parm_check): New.
877 * mangle.cc (write_closure_template_head): Use it.
878 * parser.cc (synthesize_implicit_template_parm): Likewise.
879 * pt.cc (template_parameters_equivalent_p): Likewise.
881 2023-11-19 Nathaniel Shead <nathanieloshead@gmail.com>
884 * cp-tree.h (enum cp_tree_index): Add CPTI_THREAD_ATEXIT.
885 (thread_atexit_node): New.
886 * decl.cc (get_thread_atexit_node): Cache in thread_atexit_node.
888 2023-11-19 David Malcolm <dmalcolm@redhat.com>
890 * mapper-client.cc: Include "rich-location.h".
892 2023-11-16 Jakub Jelinek <jakub@redhat.com>
895 * class.cc (layout_class_type): Don't
896 SET_DECL_FIELD_CXX_ZERO_WIDTH_BIT_FIELD on FIELD_DECLs with
897 error_mark_node type.
899 2023-11-16 Patrick Palka <ppalka@redhat.com>
903 * constexpr.cc (potential_constant_expression_1) <case CALL_EXPR>:
904 Fix FUNCTION_POINTER_TYPE_P test.
906 2023-11-16 Marek Polacek <polacek@redhat.com>
909 * parser.cc (cp_parser_direct_declarator): Maybe call
910 abort_fully_implicit_template if it turned out the parameter list was
913 2023-11-15 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
915 * tree.cc (build_cplus_array_type): Revert using the macro
918 2023-11-15 Patrick Palka <ppalka@redhat.com>
921 * decl.cc (is_direct_enum_init): Check type-dependence of the
924 2023-11-15 Patrick Palka <ppalka@redhat.com>
927 * tree.cc (strip_typedefs_expr) <case TREE_LIST>: Handle
928 non-empty TREE_PURPOSE.
930 2023-11-15 Patrick Palka <ppalka@redhat.com>
933 * tree.cc (build_min_non_dep): Propagate TREE_SIDE_EFFECTS from
934 the original arguments.
935 (build_min_non_dep_call_vec): Likewise.
936 * typeck2.cc (build_m_component_ref): Use cp_convert, build2 and
937 cp_fully_fold instead of fold_build_pointer_plus and fold_convert.
938 Don't build the POINTER_PLUS_EXPR in a template context.
940 2023-11-15 Patrick Palka <ppalka@redhat.com>
944 * constexpr.cc (potential_constant_expression_1) <case VAR_DECL>:
945 Only consider var_in_maybe_constexpr_fn if 'now' is false.
946 <case INDIRECT_REF>: Likewise.
948 2023-11-15 Jakub Jelinek <jakub@redhat.com>
950 * typeck.cc: Implement C++26 P2864R2 - Remove Deprecated Arithmetic
951 Conversion on Enumerations From C++26.
952 (do_warn_enum_conversions): Return bool rather than void, add COMPLAIN
953 argument. Use pedwarn rather than warning_at for C++26 and remove
954 " is deprecated" part of the diagnostics in that case. For SFINAE
955 in C++26 return true on newly erroneous cases.
956 (cp_build_binary_op): For C++26 call do_warn_enum_conversions
957 unconditionally, pass complain argument to it and if it returns true,
958 return error_mark_node.
959 * call.cc (build_conditional_expr): Use pedwarn rather than warning_at
960 for C++26 and remove " is deprecated" part of the diagnostics in that
961 case and check for complain & tf_warning_or_error. Use emit_diagnostic
962 with cxx_dialect >= cxx26 ? DK_PEDWARN : DK_WARNING. For SFINAE in
963 C++26 return error_mark_node on newly erroneous cases.
964 (build_new_op): Use emit_diagnostic with cxx_dialect >= cxx26
965 ? DK_PEDWARN : DK_WARNING and complain & tf_warning_or_error check
966 for C++26. For SFINAE in C++26 return error_mark_node on newly
969 2023-11-14 Nathaniel Shead <nathanieloshead@gmail.com>
972 * module.cc (trees_out::decl_node): Write DECL_VINDEX for
974 (trees_in::tree_node): Read DECL_VINDEX for virtual clones.
976 2023-11-14 Nathaniel Shead <nathanieloshead@gmail.com>
979 * name-lookup.cc (do_nonmember_using_decl): Handle
980 TEMPLATE_DECLs when checking module attachment.
982 2023-11-14 David Malcolm <dmalcolm@redhat.com>
984 * decl.cc (finish_function): Update call to
985 global_dc->m_option_enabled to use option_enabled_p.
987 2023-11-14 David Malcolm <dmalcolm@redhat.com>
989 * contracts.cc (build_comment): Use global_dc's file_cache.
991 2023-11-14 Jonathan Wakely <jwakely@redhat.com>
995 * call.cc (convert_like_internal): Use OPT_Wnarrowing for
996 pedwarns about illformed conversions involving extended
997 floating-point types. Clarify that ISO C++ requires these
1000 2023-11-14 Jakub Jelinek <jakub@redhat.com>
1003 * call.cc (magic_varargs_p): Return 4 for
1004 BUILT_IN_{CLZ,CTZ,CLRSB,FFS,PARITY,POPCOUNT}G.
1005 (build_over_call): Don't promote first argument of
1006 BUILT_IN_{CLZ,CTZ,CLRSB,FFS,PARITY,POPCOUNT}G.
1007 * cp-gimplify.cc (cp_gimplify_expr): For BUILT_IN_C{L,T}ZG use
1010 2023-11-10 Patrick Palka <ppalka@redhat.com>
1013 * cp-tree.h (STRIP_REFERENCE_REF): Define.
1014 * semantics.cc (outer_var_p): Assert REFERENCE_REF_P is false.
1015 (finish_decltype_type): Look through implicit INDIRECT_REF when
1016 deciding whether to call capture_decltype.
1018 2023-11-10 Patrick Palka <ppalka@redhat.com>
1022 * semantics.cc (finish_decltype_type): Handle an id-expression
1023 naming a capture proxy specially.
1025 2023-11-07 Kwok Cheung Yeung <kcy@codesourcery.com>
1027 * cp-tree.h (cp_omp_declare_target_attr): Add indirect field.
1028 * decl2.cc (cplus_decl_attributes): Add attribute for indirect
1030 * parser.cc (cp_parser_omp_clause_name): Handle indirect clause.
1031 (cp_parser_omp_clause_indirect): New.
1032 (cp_parser_omp_all_clauses): Handle indirect clause.
1033 (handle_omp_declare_target_clause): Add extra parameter. Add
1034 indirect attribute for indirect functions.
1035 (OMP_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
1036 (cp_parser_omp_declare_target): Handle indirect clause. Emit error
1037 message if device_type or indirect clauses used alone. Emit error
1038 if indirect clause used with device_type that is not 'any'.
1039 (OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
1040 (cp_parser_omp_begin): Handle indirect clause.
1041 * semantics.cc (finish_omp_clauses): Handle indirect clause.
1043 2023-11-04 Jakub Jelinek <jakub@redhat.com>
1045 * parser.h (struct cp_parser): Adjust comment on omp_attrs_forbidden_p
1047 * parser.cc (cp_parser_omp_section_scan): Allow __directive__ spelling.
1049 2023-11-04 David Malcolm <dmalcolm@redhat.com>
1051 * call.cc: Update for changes to diagnostic_context.
1052 * class.cc: Likewise.
1053 * decl.cc: Likewise.
1054 * error.cc: Likewise.
1055 * except.cc: Likewise.
1058 2023-11-02 Jason Merrill <jason@redhat.com>
1060 * semantics.cc (nrv_data): Change visited to hash_set.
1061 (finalize_nrv_r): Reorganize.
1063 2023-11-02 Jason Merrill <jason@redhat.com>
1068 * except.cc (maybe_splice_retval_cleanup): Clear
1069 current_retval_sentinel when destroying retval.
1070 * semantics.cc (nrv_data): Add in_nrv_cleanup.
1071 (finalize_nrv): Set it.
1072 (finalize_nrv_r): Fix handling of throwing cleanups.
1074 2023-11-02 Jakub Jelinek <jakub@redhat.com>
1077 * parser.cc: Implement C++26 P2361R6 - Unevaluated strings.
1078 (uneval_string_attr): New enumerator.
1079 (cp_parser_string_literal_common): Add UNEVAL argument. If true,
1080 pass CPP_UNEVAL_STRING rather than CPP_STRING to
1081 cpp_interpret_string_notranslate.
1082 (cp_parser_string_literal, cp_parser_userdef_string_literal): Adjust
1083 callers of cp_parser_string_literal_common.
1084 (cp_parser_unevaluated_string_literal): New function.
1085 (cp_parser_parenthesized_expression_list): Handle uneval_string_attr.
1086 (cp_parser_linkage_specification): Use
1087 cp_parser_unevaluated_string_literal for C++26.
1088 (cp_parser_static_assert): Likewise.
1089 (cp_parser_std_attribute): Use uneval_string_attr for standard
1090 deprecated and nodiscard attributes.
1092 2023-10-31 David Malcolm <dmalcolm@redhat.com>
1094 * module.cc (ordinary_loc_of): Update for removal of
1095 MACRO_MAP_EXPANSION_POINT_LOCATION.
1096 (module_state::note_location): Update for renaming of field.
1097 (module_state::write_macro_maps): Likewise.
1099 2023-10-27 Patrick Palka <ppalka@redhat.com>
1102 * init.cc (build_new_1): Remove unnecessary call to convert
1103 on 'nelts'. Use build2 instead of fold_build2 for
1104 'outer_nelts_checks'.
1106 2023-10-27 Patrick Palka <ppalka@redhat.com>
1108 * cp-tree.h (maybe_warn_unparenthesized_assignment): Declare.
1109 * semantics.cc (is_assignment_op_expr_p): Generalize to return
1110 true for any assignment operator expression, not just one that
1111 has been resolved to an operator overload.
1112 (maybe_warn_unparenthesized_assignment): Factored out from ...
1113 (maybe_convert_cond): ... here.
1114 (finish_parenthesized_expr): Mention
1115 maybe_warn_unparenthesized_assignment.
1116 * typeck.cc (convert_for_assignment): Replace -Wparentheses
1117 warning logic with maybe_warn_unparenthesized_assignment.
1119 2023-10-27 Lewis Hyatt <lhyatt@gmail.com>
1121 PR preprocessor/87299
1122 * parser.cc (cp_lexer_new_main): Call c_reset_target_pragmas ()
1123 after preprocessing is complete, before starting compilation.
1125 2023-10-26 liuhongt <hongtao.liu@intel.com>
1127 * typeck.cc (build_vec_cmp): Pass type of arg0 to
1130 2023-10-25 Jason Merrill <jason@redhat.com>
1132 * cp-tree.def: Improve OFFSET_REF comment.
1133 * cp-gimplify.cc (cp_fold_immediate): Add to comment.
1135 2023-10-25 Thomas Schwinge <thomas@codesourcery.com>
1137 * parser.cc (cp_parser_omp_clause_name): Return
1138 'PRAGMA_OACC_CLAUSE_SELF' for "self".
1139 (cp_parser_oacc_data_clause, OACC_UPDATE_CLAUSE_MASK): Adjust.
1140 (cp_parser_oacc_all_clauses): Remove 'bool compute_p' formal
1141 parameter, and instead locally determine whether we're called for
1142 an OpenACC compute construct or OpenACC 'update' directive.
1143 (cp_parser_oacc_compute): Adjust.
1145 2023-10-25 Chung-Lin Tang <cltang@codesourcery.com>
1147 * parser.cc (cp_parser_oacc_compute_clause_self): New function.
1148 (cp_parser_oacc_all_clauses): Add new 'bool compute_p = false'
1149 parameter, add parsing of self clause when compute_p is true.
1150 (OACC_KERNELS_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_SELF.
1151 (OACC_PARALLEL_CLAUSE_MASK): Likewise,
1152 (OACC_SERIAL_CLAUSE_MASK): Likewise.
1153 (cp_parser_oacc_compute): Adjust call to c_parser_oacc_all_clauses to
1154 set compute_p argument to true.
1155 * pt.cc (tsubst_omp_clauses): Add OMP_CLAUSE_SELF case.
1156 * semantics.cc (c_finish_omp_clauses): Add OMP_CLAUSE_SELF case, merged
1157 with OMP_CLAUSE_IF case.
1159 2023-10-25 Marek Polacek <polacek@redhat.com>
1162 * typeck.cc (build_static_cast_1): Call decay_conversion.
1164 2023-10-24 Patrick Palka <ppalka@redhat.com>
1167 * init.cc (build_new_1): Use convert, build2, build3 and
1168 cp_fully_fold instead of fold_convert, size_binop and
1169 fold_build3 when building up 'size'.
1171 2023-10-24 Patrick Palka <ppalka@redhat.com>
1174 * tree.cc (cp_stabilize_reference): Do nothing when
1175 processing_template_decl.
1177 2023-10-22 Patrick Palka <ppalka@redhat.com>
1180 * pt.cc (tsubst_expr) <case AT_ENCODE_EXPR>: Use tsubst instead
1183 2023-10-20 Jason Merrill <jason@redhat.com>
1185 * call.cc (implicit_conversion_1): Rename...
1186 (implicit_conversion): ...to this. Remove the old wrapper.
1188 2023-10-20 Jason Merrill <jason@redhat.com>
1190 * call.cc (tourney): Only skip champ_compared_to_predecessor.
1192 2023-10-20 Nathan Sidwell <nathan@acm.org>
1195 * module.cc (trees_out::core_vals): Stream CONSTRUCTOR operands
1197 (trees_in::core_vals): Likewise.
1199 2023-10-20 Patrick Palka <ppalka@redhat.com>
1201 * cp-lang.cc (objcp_tsubst_copy_and_build): Rename to ...
1202 (objcp_tsubst_expr): ... this.
1203 * cp-objcp-common.h (objcp_tsubst_copy_and_build): Rename to ...
1204 (objcp_tsubst_expr): ... this.
1205 * cp-tree.h (tsubst_copy_and_build): Remove declaration.
1206 * init.cc (maybe_instantiate_nsdmi_init): Use tsubst_expr
1207 instead of tsubst_copy_and_build.
1208 * pt.cc (expand_integer_pack): Likewise.
1209 (instantiate_non_dependent_expr_internal): Likewise.
1210 (instantiate_class_template): Use tsubst_stmt instead of
1211 tsubst_expr for STATIC_ASSERT.
1212 (tsubst_function_decl): Adjust tsubst_copy_and_build uses.
1213 (tsubst_arg_types): Likewise.
1214 (tsubst_exception_specification): Likewise.
1215 (tsubst_tree_list): Likewise.
1217 (tsubst_name): Likewise.
1218 (tsubst_omp_clause_decl): Use tsubst_stmt instead of tsubst_expr.
1219 (tsubst_omp_clauses): Likewise.
1220 (tsubst_copy_asm_operands): Adjust tsubst_copy_and_build use.
1221 (tsubst_omp_for_iterator): Use tsubst_stmt instead of tsubst_expr.
1222 (tsubst_expr): Rename to ...
1223 (tsubst_stmt): ... this.
1224 <case CO_YIELD_EXPR, CO_AWAIT_EXPR>: Move to tsubst_expr.
1225 (tsubst_omp_udr): Use tsubst_stmt instead of tsubst_expr.
1226 (tsubst_non_call_postfix_expression): Adjust tsubst_copy_and_build
1228 (tsubst_lambda_expr): Likewise. Use tsubst_stmt instead of
1229 tsubst_expr for the body of a lambda.
1230 (tsubst_copy_and_build_call_args): Rename to ...
1231 (tsubst_call_args): ... this. Adjust tsubst_copy_and_build use.
1232 (tsubst_copy_and_build): Rename to tsubst_expr. Adjust
1233 tsubst_copy_and_build and tsubst_copy_and_build_call_args use.
1234 <case TRANSACTION_EXPR>: Use tsubst_stmt instead of tsubst_expr.
1235 (maybe_instantiate_noexcept): Adjust tsubst_copy_and_build use.
1236 (instantiate_body): Use tsubst_stmt instead of tsubst_expr for
1237 substituting the function body.
1238 (tsubst_initializer_list): Adjust tsubst_copy_and_build use.
1240 2023-10-20 Patrick Palka <ppalka@redhat.com>
1242 * cp-tree.h (enum tsubst_flags): Add tf_no_name_lookup.
1243 * pt.cc (tsubst_pack_expansion): Use tsubst for substituting
1245 (tsubst_decl) <case USING_DECL>: Use tsubst_name instead of
1247 (tsubst) <case TEMPLATE_TYPE_PARM>: Use tsubst_copy_and_build
1248 instead of tsubst_copy for substituting
1249 CLASS_PLACEHOLDER_TEMPLATE.
1250 <case TYPENAME_TYPE>: Use tsubst_name instead of tsubst_copy for
1251 substituting TYPENAME_TYPE_FULLNAME.
1252 (tsubst_name): Define.
1253 (tsubst_qualified_id): Use tsubst_name instead of tsubst_copy
1254 for substituting the component name of a SCOPE_REF.
1255 (tsubst_copy): Remove.
1256 (tsubst_copy_and_build): Clear tf_no_name_lookup at the start,
1257 and remember if it was set. Call maybe_dependent_member_ref if
1258 tf_no_name_lookup was not set.
1259 <case IDENTIFIER_NODE>: Don't do name lookup if tf_no_name_lookup
1261 <case TEMPLATE_ID_EXPR>: If tf_no_name_lookup was set, use
1262 tsubst_name instead of tsubst_copy_and_build to substitute the
1263 template and don't finish the template-id.
1264 <case BIT_NOT_EXPR>: Handle identifier and type operand (if
1265 tf_no_name_lookup was set).
1266 <case SCOPE_REF>: Avoid trying to resolve a SCOPE_REF if
1267 tf_no_name_lookup was set by calling build_qualified_name directly
1268 instead of tsubst_qualified_id.
1269 <case SIZEOF_EXPR>: Handling of sizeof... copied from tsubst_copy.
1270 <case CALL_EXPR>: Use tsubst_name instead of tsubst_copy to
1271 substitute a TEMPLATE_ID_EXPR callee naming an unresolved template.
1272 <case COMPONENT_REF>: Likewise to substitute the member.
1273 <case FUNCTION_DECL>: Copied from tsubst_copy and merged with ...
1274 <case VAR_DECL, PARM_DECL>: ... these. Initial handling copied
1275 from tsubst_copy. Optimize local variable substitution by
1276 trying retrieve_local_specialization before checking
1277 uses_template_parms.
1278 <case CONST_DECL>: Copied from tsubst_copy.
1279 <case FIELD_DECL>: Likewise.
1280 <case NAMESPACE_DECL>: Likewise.
1281 <case OVERLOAD>: Likewise.
1282 <case TEMPLATE_DECL>: Likewise.
1283 <case TEMPLATE_PARM_INDEX>: Likewise.
1284 <case TYPE_DECL>: Likewise.
1285 <case CLEANUP_POINT_EXPR>: Likewise.
1286 <case OFFSET_REF>: Likewise.
1287 <case EXPR_PACK_EXPANSION>: Likewise.
1288 <case NONTYPE_ARGUMENT_PACK>: Likewise.
1289 <case *_CST>: Likewise.
1290 <case *_*_FOLD_EXPR>: Likewise.
1291 <case DEBUG_BEGIN_STMT>: Likewise.
1292 <case CO_AWAIT_EXPR>: Likewise.
1293 <case TRAIT_EXPR>: Use tsubst and tsubst_copy_and_build instead
1295 <default>: Copied from tsubst_copy.
1296 (tsubst_initializer_list): Use tsubst and tsubst_copy_and_build
1297 instead of tsubst_copy.
1299 2023-10-20 Patrick Palka <ppalka@redhat.com>
1302 * parser.cc (cp_parser_postfix_expression): Consolidate three
1303 calls to finish_call_expr, one to build_new_method_call and
1304 one to build_min_nt_call_vec into one call to finish_call_expr.
1305 Don't call maybe_generic_this_capture here.
1306 * pt.cc (tsubst_copy_and_build) <case CALL_EXPR>: Remove
1307 COMPONENT_REF callee handling.
1308 (type_dependent_expression_p): Use t_d_object_e_p instead of
1309 t_d_e_p for COMPONENT_REF and OFFSET_REF.
1310 * semantics.cc (finish_call_expr): In the type-dependent case,
1311 call maybe_generic_this_capture here instead.
1313 2023-10-20 Patrick Palka <ppalka@redhat.com>
1315 * call.cc (build_new_method_call): Remove calls to
1316 build_non_dependent_expr and/or make_args_non_dependent.
1317 * coroutines.cc (finish_co_return_stmt): Likewise.
1318 * cp-tree.h (build_non_dependent_expr): Remove.
1319 (make_args_non_dependent): Remove.
1320 * decl2.cc (grok_array_decl): Remove calls to
1321 build_non_dependent_expr and/or make_args_non_dependent.
1322 (build_offset_ref_call_from_tree): Likewise.
1323 * init.cc (build_new): Likewise.
1324 * pt.cc (make_args_non_dependent): Remove.
1325 (test_build_non_dependent_expr): Remove.
1326 (cp_pt_cc_tests): Adjust.
1327 * semantics.cc (finish_expr_stmt): Remove calls to
1328 build_non_dependent_expr and/or make_args_non_dependent.
1329 (finish_for_expr): Likewise.
1330 (finish_call_expr): Likewise.
1331 (finish_omp_atomic): Likewise.
1332 * typeck.cc (finish_class_member_access_expr): Likewise.
1333 (build_x_indirect_ref): Likewise.
1334 (build_x_binary_op): Likewise.
1335 (build_x_array_ref): Likewise.
1336 (build_x_vec_perm_expr): Likewise.
1337 (build_x_shufflevector): Likewise.
1338 (build_x_unary_op): Likewise.
1339 (cp_build_addressof): Likewise.
1340 (build_x_conditional_expr): Likewise.
1341 (build_x_compound_expr): Likewise.
1342 (build_static_cast): Likewise.
1343 (build_x_modify_expr): Likewise.
1344 (check_return_expr): Likewise.
1345 * typeck2.cc (build_x_arrow): Likewise.
1347 2023-10-20 Patrick Palka <ppalka@redhat.com>
1349 * class.cc (instantiate_type): Remove NON_DEPENDENT_EXPR
1351 * constexpr.cc (cxx_eval_constant_expression): Likewise.
1352 (potential_constant_expression_1): Likewise.
1353 * coroutines.cc (coro_validate_builtin_call): Don't
1354 expect ALIGNOF_EXPR to be wrapped in NON_DEPENDENT_EXPR.
1355 * cp-objcp-common.cc (cp_common_init_ts): Remove
1356 NON_DEPENDENT_EXPR handling.
1357 * cp-tree.def (NON_DEPENDENT_EXPR): Remove.
1358 * cp-tree.h (build_non_dependent_expr): Temporarily redefine as
1359 the identity function.
1360 * cvt.cc (maybe_warn_nodiscard): Handle type-dependent and
1361 variable callee of CALL_EXPR.
1362 * cxx-pretty-print.cc (cxx_pretty_printer::expression): Remove
1363 NON_DEPENDENT_EXPR handling.
1364 * error.cc (dump_decl): Likewise.
1365 (dump_expr): Likewise.
1366 * expr.cc (mark_use): Likewise.
1367 (mark_exp_read): Likewise.
1368 * pt.cc (build_non_dependent_expr): Remove.
1369 * tree.cc (lvalue_kind): Remove NON_DEPENDENT_EXPR handling.
1370 (cp_stabilize_reference): Likewise.
1371 * typeck.cc (warn_for_null_address): Likewise.
1372 (cp_build_binary_op): Handle type-dependent SIZEOF_EXPR operands.
1373 (cp_build_unary_op) <case TRUTH_NOT_EXPR>: Don't fold inside a
1376 2023-10-20 Alexandre Oliva <oliva@adacore.com>
1378 * decl.cc (push_throw_library_fn): Mark with ECF_XTHROW.
1379 * except.cc (build_throw): Likewise __cxa_throw,
1380 _ITM_cxa_throw, __cxa_rethrow.
1382 2023-10-20 Nathaniel Shead <nathanieloshead@gmail.com>
1386 * call.cc (build_over_call): Fold more indirect refs for trivial
1388 * class.cc (type_has_non_deleted_trivial_default_ctor): Create.
1389 * constexpr.cc (cxx_eval_call_expression): Start lifetime of
1390 union member before entering constructor.
1391 (cxx_eval_component_reference): Check against first member of
1392 value-initialised union.
1393 (cxx_eval_store_expression): Activate member for
1394 value-initialised union. Check for accessing inactive union
1396 * cp-tree.h (type_has_non_deleted_trivial_default_ctor):
1399 2023-10-20 Nathaniel Shead <nathanieloshead@gmail.com>
1401 * constexpr.cc (is_std_source_location_current): New.
1402 (cxx_eval_constant_expression): Only ignore cast from void* for
1403 specific cases and improve other diagnostics.
1405 2023-10-19 Marek Polacek <polacek@redhat.com>
1407 * cp-gimplify.cc (cp_fold_r): Don't call maybe_constant_value.
1409 2023-10-19 Jason Merrill <jason@redhat.com>
1411 * typeck2.cc (check_narrowing): Adjust.
1413 2023-10-19 Jason Merrill <jason@redhat.com>
1415 * parser.cc (cp_parser_primary_expression): Use G_.
1416 (cp_parser_using_enum): Likewise.
1417 * decl.cc (identify_goto): Likewise.
1419 2023-10-18 Jason Merrill <jason@redhat.com>
1421 * typeck2.cc (check_narrowing): Use permerror.
1423 2023-10-17 Marek Polacek <polacek@redhat.com>
1426 * parser.cc (cp_parser_simple_declaration): Do cp_parser_error
1429 2023-10-17 Marek Polacek <polacek@redhat.com>
1432 * cp-gimplify.cc (cp_fold_immediate_r) <case COND_EXPR>: Don't
1434 (cp_fold_r): Handle COND_EXPR here.
1436 2023-10-17 Jason Merrill <jason@redhat.com>
1438 * mangle.cc (abi_check): New.
1439 (write_prefix, write_unqualified_name, write_discriminator)
1440 (write_type, write_member_name, write_expression)
1441 (write_template_arg, write_template_param): Use it.
1442 (start_mangling): Assign from {}.
1443 * cp-tree.h: Update comment.
1445 2023-10-17 Nathaniel Shead <nathanieloshead@gmail.com>
1447 * constexpr.cc (cxx_eval_dynamic_cast_fn): Add missing
1448 auto_diagnostic_group.
1449 (cxx_eval_call_expression): Likewise.
1450 (diag_array_subscript): Likewise.
1451 (outside_lifetime_error): Likewise.
1452 (potential_constant_expression_1): Likewise.
1454 2023-10-16 Jason Merrill <jason@redhat.com>
1456 * parser.cc (cp_parser_fold_expression): Track location range.
1457 * semantics.cc (finish_unary_fold_expr)
1458 (finish_left_unary_fold_expr, finish_right_unary_fold_expr)
1459 (finish_binary_fold_expr): Add location parm.
1460 * constraint.cc (finish_shorthand_constraint): Pass it.
1461 * pt.cc (convert_generic_types_to_packs): Likewise.
1462 * cp-tree.h: Adjust.
1464 2023-10-16 Marek Polacek <polacek@redhat.com>
1467 * constexpr.cc (explain_invalid_constexpr_fn): Also check the body of
1468 a constructor in C++14 and up.
1470 2023-10-14 Jakub Jelinek <jakub@redhat.com>
1473 * module.cc (trees_out::start, trees_in::start): Remove
1474 TREE_INT_CST_OFFSET_NUNITS handling.
1476 2023-10-10 Jason Merrill <jason@redhat.com>
1479 * mangle.cc (write_template_param): Also mangle level.
1481 2023-10-08 David Malcolm <dmalcolm@redhat.com>
1483 * module.cc (module_state::read_location): Update for renaming of
1484 get_combined_adhoc_loc.
1486 2023-10-03 David Malcolm <dmalcolm@redhat.com>
1488 * error.cc (print_instantiation_partial_context_line): Call
1489 diagnostic_show_locus.
1491 2023-10-03 David Malcolm <dmalcolm@redhat.com>
1493 * error.cc: Update for "m_" prefixes to text_info fields.
1495 2023-09-30 Eugene Rozenfeld <erozen@microsoft.com>
1497 * Make-lang.in: Make create_fdas_for_cc1plus target not .PHONY
1499 2023-09-28 Richard Sandiford <richard.sandiford@arm.com>
1501 * constexpr.cc (cxx_fold_indirect_ref): Remove unused variables.
1503 2023-09-22 Jason Merrill <jason@redhat.com>
1506 * pt.cc (expand_integer_pack): Use IMPLICIT_CONV_EXPR.
1508 2023-09-22 Jason Merrill <jason@redhat.com>
1510 * constexpr.cc (free_constructor): Handle null ce->value.
1512 2023-09-22 Jason Merrill <jason@redhat.com>
1515 * parser.cc (cp_parser_lambda_declarator_opt): Don't suggest
1516 -std=c++14 for lambda templates.
1517 * pt.cc (tsubst_expr): Move ANNOTATE_EXPR handling...
1518 (tsubst_copy_and_build): ...here.
1520 2023-09-22 Patrick Palka <ppalka@redhat.com>
1523 * decl2.cc (grok_array_decl): Guard diagnostic and backward
1524 compatibility fallback code paths with tf_error.
1526 2023-09-22 Patrick Palka <ppalka@redhat.com>
1529 * pt.cc (is_compatible_template_arg): New parameter 'args'.
1530 Add the outer template arguments 'args' to 'new_args'.
1531 (convert_template_argument): Pass 'args' to
1532 is_compatible_template_arg.
1534 2023-09-20 Jakub Jelinek <jakub@redhat.com>
1536 * parser.cc (cp_parser_postfix_expression): Parse
1537 __builtin_classify_type call with typename as argument.
1538 * pt.cc (tsubst_copy_and_build): Handle __builtin_classify_type
1539 with dependent typename as argument.
1541 2023-09-20 Patrick Palka <ppalka@redhat.com>
1544 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
1545 <case VAR_DECL>: Handle class NTTP objects by printing
1546 their type and value.
1547 <case VIEW_CONVERT_EXPR>: Strip const VIEW_CONVERT_EXPR
1548 wrappers for class NTTPs.
1549 (pp_cxx_template_argument_list): Don't handle class NTTP
1552 2023-09-20 Patrick Palka <ppalka@redhat.com>
1554 * pt.cc (tsubst_function_decl): Don't bother computing 'argvec'
1555 when 'lambda_fntype' is set.
1556 (tsubst_template_decl): Make sure we return a TEMPLATE_DECL
1557 during specialization lookup. In the non-class non-function
1558 template case, use tsubst_decl directly with use_spec_table=false,
1559 update DECL_TI_ARGS and call register_specialization like
1560 tsubst_decl would have done if use_spec_table=true.
1562 2023-09-20 Jakub Jelinek <jakub@redhat.com>
1565 * parser.h (struct cp_lexer): Add in_omp_decl_attribute member.
1566 * cp-tree.h (cp_maybe_parse_omp_decl): Declare.
1567 * parser.cc (cp_parser_handle_statement_omp_attributes): Diagnose
1568 omp::decl attribute on statements. Adjust diagnostic wording for
1570 (cp_parser_omp_directive_args): Add DECL_P argument, set TREE_PUBLIC
1571 to it on the DEFERRED_PARSE tree.
1572 (cp_parser_omp_sequence_args): Adjust caller.
1573 (cp_parser_std_attribute): Handle omp::decl attribute.
1574 (cp_parser_omp_var_list): If parser->lexer->in_omp_decl_attribute
1575 don't expect any arguments, instead create clause or TREE_LIST for
1577 (cp_parser_late_parsing_omp_declare_simd): Adjust diagnostic wording
1579 (cp_maybe_parse_omp_decl): New function.
1580 (cp_parser_omp_declare_target): If
1581 parser->lexer->in_omp_decl_attribute and first token isn't name or
1582 comma invoke cp_parser_omp_var_list.
1583 * decl2.cc (cplus_decl_attributes): Adjust diagnostic wording for
1584 omp::decl. Handle omp::decl on declarations.
1585 * name-lookup.cc (finish_using_directive): Adjust diagnostic wording
1588 2023-09-19 Ben Boeckel <ben.boeckel@kitware.com>
1590 * mapper-client.cc, mapper-client.h (open_module_client): Accept
1591 dependency tracking and track module mapper files as
1593 * module.cc (make_mapper, get_mapper): Pass the dependency
1594 tracking class down.
1596 2023-09-19 Ben Boeckel <ben.boeckel@kitware.com>
1598 * module.cc (do_import): Report imported CMI files as
1601 2023-09-19 Ben Boeckel <ben.boeckel@kitware.com>
1603 * module.cc (preprocessed_module): Pass whether the module is
1604 exported to dependency tracking.
1606 2023-09-19 Javier Martinez <javier.martinez.bugzilla@gmail.com>
1608 * class.cc (propagate_class_warmth_attribute): New function.
1609 (check_bases_and_members): propagate hot and cold attributes
1610 to all FUNCTION_DECL when the record is marked hot or cold.
1611 * cp-tree.h (maybe_propagate_warmth_attributes): New function.
1612 * decl2.cc (maybe_propagate_warmth_attributes): New function.
1613 * method.cc (lazily_declare_fn): propagate hot and cold
1614 attributes to lazily declared functions when the record is
1617 2023-09-19 Patrick Palka <ppalka@redhat.com>
1619 * ptree.cc (cxx_print_type): Remove TYPE_LANG_SPECIFIC
1620 test guarding TYPE_TEMPLATE_INFO.
1622 2023-09-19 Jason Merrill <jason@redhat.com>
1625 * class.cc (add_implicit_default_ctor): Split out...
1626 (add_implicitly_declared_members): ...from here.
1627 Also call it when inheriting a default ctor.
1629 2023-09-19 Marek Polacek <polacek@redhat.com>
1631 * call.cc (build_over_call): Set ADDR_EXPR_DENOTES_CALL_P. Don't handle
1632 immediate_invocation_p here.
1633 * constexpr.cc (cxx_eval_call_expression): Use mce_true for
1634 DECL_IMMEDIATE_FUNCTION_P.
1635 (cxx_eval_conditional_expression): Call cp_fold_immediate.
1636 * cp-gimplify.cc (enum fold_flags): Add ff_fold_immediate.
1637 (maybe_replace_decl): Make static.
1638 (cp_fold_r): Expand immediate invocations.
1639 (cp_fold_immediate_r): New.
1640 (cp_fold_immediate): New.
1641 * cp-tree.h (ADDR_EXPR_DENOTES_CALL_P): Define.
1642 (cp_fold_immediate): Declare.
1643 * tree.cc (bot_replace): Don't handle immediate invocations here.
1645 2023-09-19 Patrick Palka <ppalka@redhat.com>
1648 * cvt.cc (convert_to_void) <case INDIRECT_REF>: Only call
1649 complete_type if the type is volatile.
1650 <case VAR_DECL>: Likewise.
1652 2023-09-19 Patrick Palka <ppalka@redhat.com>
1655 * semantics.cc (finish_decltype_type): For an NTTP object,
1656 return its type modulo cv-quals.
1658 2023-09-18 Patrick Palka <ppalka@redhat.com>
1661 * pt.cc (try_class_unification): Strengthen TI_TEMPLATE equality
1662 test by not calling most_general_template. Only unify the
1663 innermost levels of template arguments.
1664 (unify) <case CLASS_TYPE>: Only unify the innermost levels of
1665 template arguments, and only if the template is primary.
1667 2023-09-18 Patrick Palka <ppalka@redhat.com>
1671 * semantics.cc (maybe_convert_cond): Look through implicit
1672 INDIRECT_REF when deciding whether to issue a -Wparentheses
1673 warning, and consider templated assignment expressions as well.
1674 (finish_parenthesized_expr): Look through implicit INDIRECT_REF
1675 when suppressing -Wparentheses warning.
1676 * typeck.cc (build_x_modify_expr): Check simple assignments
1677 ahead time too, not just compound assignments. Give the second
1678 operand of MODOP_EXPR a non-null type so that it's not considered
1679 always instantiation-dependent. Don't call suppress_warning.
1681 2023-09-18 Patrick Palka <ppalka@redhat.com>
1684 * pt.cc (unify): Return unify_success for identical dependent
1685 DECL_P 'arg' and 'parm'.
1686 <case CONST_DECL>: Remove handling.
1688 2023-09-18 Patrick Palka <ppalka@redhat.com>
1690 * call.cc (add_template_candidate_real): Check arity even
1691 when there are no explicit template arguments. Combine the
1692 two adjacent '!obj' tests into one.
1694 2023-09-18 Patrick Palka <ppalka@redhat.com>
1696 * pt.cc (register_specialization): Remove now-unnecessary
1697 early exit for FUNCTION_DECL partial instantiation.
1698 (tsubst_template_decl): Pass use_spec_table=false to
1699 tsubst_function_decl. Set DECL_TI_ARGS of a non-lambda
1700 FUNCTION_DECL specialization to the full set of arguments.
1701 Simplify register_specialization call accordingly.
1703 2023-09-18 Jason Merrill <jason@redhat.com>
1705 * class.cc (check_subobject_offset): Use similar_type_p.
1707 2023-09-12 Jason Merrill <jason@redhat.com>
1710 * pt.cc (expand_integer_pack): Convert argument to int.
1712 2023-09-12 Jason Merrill <jason@redhat.com>
1715 * typeck2.cc (process_init_constructor_array): Use VEC_INIT_EXPR
1716 regardless of seen_error.
1718 2023-09-08 Patrick Palka <ppalka@redhat.com>
1721 * pt.cc (check_non_deducible_conversions): Add bool parameter
1722 passed down to check_non_deducible_conversion.
1723 (fn_type_unification): Call check_non_deducible_conversions
1724 an extra time before satisfaction with noninst_only_p=true.
1725 (conversion_may_instantiate_p): Define.
1726 (check_non_deducible_conversion): Add bool parameter controlling
1727 whether to compute only conversions that are guaranteed to
1728 not induce template instantiation.
1730 2023-09-07 Sandra Loosemore <sandra@codesourcery.com>
1733 * parser.cc (fixup_blocks_walker): Check for null BIND_EXPR_BLOCK.
1735 2023-09-06 Jason Merrill <jason@redhat.com>
1737 * class.cc (check_subobject_offset): Check
1738 same_type_ignoring_top_level_qualifiers_p.
1740 2023-09-05 Marek Polacek <polacek@redhat.com>
1743 * constexpr.cc (verify_constant_explain_r): New.
1744 (verify_constant): Call it.
1746 2023-09-05 Jakub Jelinek <jakub@redhat.com>
1749 * name-lookup.cc (check_local_shadow): Don't punt early for
1750 DECL_EXTERNAL decls, instead just disable the shadowing of namespace
1751 decls check for those and emit a pedwarn rather than error_at or
1752 permerror for those. Formatting fix.
1754 2023-09-05 Jakub Jelinek <jakub@redhat.com>
1757 * name-lookup.h (struct cp_binding_level): Add artificial bit-field.
1759 * name-lookup.cc (check_local_shadow): Skip artificial bindings when
1760 checking if parameter scope is parent scope. Don't special case
1761 FUNCTION_NEEDS_BODY_BLOCK. Diagnose the in_function_try_handler
1762 cases in the b->kind == sk_function_parms test and verify no
1763 non-artificial intervening scopes. Add missing auto_diagnostic_group.
1764 * decl.cc (begin_function_body): Set
1765 current_binding_level->artificial.
1766 * semantics.cc (begin_function_try_block): Likewise.
1768 2023-09-05 Patrick Palka <ppalka@redhat.com>
1770 * parser.cc (cp_parser_parenthesized_expression_list_elt): Pass
1771 nullptr as non_constant_p to cp_parser_braced_list if our
1772 non_constant_p is null.
1773 (cp_parser_initializer_list): Likewise to
1774 cp_parser_initializer_clause. Avoid inspecting
1775 clause_non_constant_p if it's uninitialized.
1777 2023-09-05 Patrick Palka <ppalka@redhat.com>
1779 * call.cc (build_user_type_conversion): Free allocated
1781 (build_converted_constant_expr_internal): Use
1782 conversion_obstack_sentinel instead.
1783 (perform_dguide_overload_resolution): Likewise.
1784 (build_new_function_call): Likewise.
1785 (build_operator_new_call): Free allocated conversions.
1786 (build_op_call): Use conversion_obstack_sentinel instead.
1787 (build_conditional_expr): Use conversion_obstack_sentinel
1788 instead, and hoist it out to the outermost scope.
1789 (build_new_op): Use conversion_obstack_sentinel instead
1790 and set it up before the first goto. Remove second unneeded goto.
1791 (build_op_subscript): Use conversion_obstack_sentinel instead.
1792 (ref_conv_binds_to_temporary): Likewise.
1793 (build_new_method_call): Likewise.
1794 (can_convert_arg): Likewise.
1795 (can_convert_arg_bad): Likewise.
1796 (perform_implicit_conversion_flags): Likewise.
1797 (perform_direct_initialization_if_possible): Likewise.
1798 (initialize_reference): Likewise.
1800 2023-09-01 Jakub Jelinek <jakub@redhat.com>
1803 * cp-tree.h (determine_local_discriminator): Add NAME argument with
1805 (struct cp_decomp): New type.
1806 (cp_finish_decl): Add DECOMP argument defaulted to nullptr.
1807 (cp_maybe_mangle_decomp): Remove declaration.
1808 (cp_finish_decomp): Add cp_decomp * argument, remove tree and unsigned
1810 (cp_convert_range_for): Likewise.
1811 * decl.cc (determine_local_discriminator): Add NAME argument, use it
1812 if non-NULL, otherwise compute it the old way.
1813 (maybe_commonize_var): Don't return early for structured bindings.
1814 (cp_finish_decl): Add DECOMP argument, if non-NULL, call
1815 cp_maybe_mangle_decomp.
1816 (cp_maybe_mangle_decomp): Make it static with a forward declaration.
1817 Call determine_local_discriminator. Replace FIRST and COUNT arguments
1818 with DECOMP argument.
1819 (cp_finish_decomp): Replace FIRST and COUNT arguments with DECOMP
1821 * mangle.cc (find_decomp_unqualified_name): Remove.
1822 (write_unqualified_name): Don't call find_decomp_unqualified_name.
1823 (mangle_decomp): Handle mangling of static function/block scope
1824 structured bindings. Don't call decl_mangling_context twice. Call
1825 check_abi_tags, call write_abi_tags for abi version >= 19 and emit
1826 -Wabi warnings if needed.
1827 (write_guarded_var_name): Handle structured bindings.
1828 (mangle_ref_init_variable): Use write_guarded_var_name.
1829 * parser.cc (cp_parser_range_for): Adjust do_range_for_auto_deduction
1830 and cp_convert_range_for callers.
1831 (do_range_for_auto_deduction): Replace DECOMP_FIRST_NAME and
1832 DECOMP_CNT arguments with DECOMP. Adjust cp_finish_decomp caller.
1833 (cp_convert_range_for): Replace DECOMP_FIRST_NAME and
1834 DECOMP_CNT arguments with DECOMP. Don't call cp_maybe_mangle_decomp,
1835 adjust cp_finish_decl and cp_finish_decomp callers.
1836 (cp_parser_decomposition_declaration): Don't call
1837 cp_maybe_mangle_decomp, adjust cp_finish_decl and cp_finish_decomp
1839 (cp_convert_omp_range_for): Adjust do_range_for_auto_deduction
1840 and cp_finish_decomp callers.
1841 (cp_finish_omp_range_for): Don't call cp_maybe_mangle_decomp,
1842 adjust cp_finish_decl and cp_finish_decomp callers.
1843 * pt.cc (tsubst_omp_for_iterator): Adjust tsubst_decomp_names
1845 (tsubst_decomp_names): Replace FIRST and CNT arguments with DECOMP.
1846 (tsubst_expr): Don't call cp_maybe_mangle_decomp, adjust
1847 tsubst_decomp_names, cp_finish_decl, cp_finish_decomp and
1848 cp_convert_range_for callers.
1850 2023-08-30 Marek Polacek <polacek@redhat.com>
1853 * parser.cc (cp_parser_initializer_list): Set CONSTRUCTOR_IS_DIRECT_INIT
1854 when the designated initializer is of the .x{} form.
1856 2023-08-30 Marek Polacek <polacek@redhat.com>
1859 * decl.cc (grokdeclarator): Disallow constinit on functions.
1861 2023-08-29 Marek Polacek <polacek@redhat.com>
1863 * call.cc (convert_like_internal): Show where the conversion function
1865 (maybe_show_nonconverting_candidate): New.
1866 * cp-tree.h (maybe_show_nonconverting_candidate): Declare.
1867 * typeck.cc (convert_for_assignment): Call it.
1869 2023-08-25 Sandra Loosemore <sandra@codesourcery.com>
1871 * cp-tree.h (cp_convert_omp_range_for): Adjust declaration.
1872 * parser.cc (struct omp_for_parse_data): New.
1873 (cp_parser_postfix_expression): Diagnose calls to OpenMP runtime
1874 in intervening code.
1875 (check_omp_intervening_code): New.
1876 (cp_parser_statement_seq_opt): Special-case nested loops, blocks,
1877 and other constructs for OpenMP loops.
1878 (cp_parser_iteration_statement): Reject loops in intervening code.
1879 (cp_parser_omp_for_loop_init): Expand comments and tweak the
1880 interface slightly to better distinguish input/output parameters.
1881 (cp_convert_omp_range_for): Likewise.
1882 (cp_parser_omp_loop_nest): New, split from cp_parser_omp_for_loop
1883 and largely rewritten. Add more comments.
1884 (insert_structured_blocks): New.
1885 (find_structured_blocks): New.
1886 (struct sit_data, substitute_in_tree_walker, substitute_in_tree):
1888 (fixup_blocks_walker): New.
1889 (cp_parser_omp_for_loop): Rewrite to use recursive descent instead
1890 of a loop. Add logic to reshuffle the bits of code collected
1891 during parsing so intervening code gets moved to the loop body.
1892 (cp_parser_omp_loop): Remove call to finish_omp_for_block, which
1894 (cp_parser_omp_simd): Likewise.
1895 (cp_parser_omp_for): Likewise.
1896 (cp_parser_omp_distribute): Likewise.
1897 (cp_parser_oacc_loop): Likewise.
1898 (cp_parser_omp_taskloop): Likewise.
1899 (cp_parser_pragma): Reject OpenMP pragmas in intervening code.
1900 * parser.h (struct cp_parser): Add omp_for_parse_state field.
1901 * pt.cc (tsubst_omp_for_iterator): Adjust call to
1902 cp_convert_omp_range_for.
1903 * semantics.cc (finish_omp_for): Try harder to preserve location
1904 of loop variable init expression for use in diagnostics.
1905 (struct fofb_data, finish_omp_for_block_walker): New.
1906 (finish_omp_for_block): Allow variables to be bound in a BIND_EXPR
1907 nested inside BIND instead of directly in BIND itself.
1909 2023-08-25 Sandra Loosemore <sandra@codesourcery.com>
1911 * constexpr.cc (cxx_eval_constant_expression): Handle
1912 OMP_STRUCTURED_BLOCK.
1913 * pt.cc (tsubst_expr): Likewise.
1915 2023-08-25 Uros Bizjak <ubizjak@gmail.com>
1917 * call.cc (build_conditional_expr):
1918 Rename TRUE/FALSE to true/false.
1919 (build_new_op): Ditto.
1921 2023-08-22 Jason Merrill <jason@redhat.com>
1923 * pt.cc (outer_template_args): Handle non-template argument.
1924 * constraint.cc (maybe_substitute_reqs_for): Pass decl to it.
1925 * cp-tree.h (outer_template_args): Adjust.
1927 2023-08-22 Jason Merrill <jason@redhat.com>
1930 * cp-tree.h (member_like_constrained_friend_p): Declare.
1931 * decl.cc (member_like_constrained_friend_p): New.
1932 (function_requirements_equivalent_p): Check it.
1933 (duplicate_decls): Check it.
1934 (grokfndecl): Check friend template constraints.
1935 * mangle.cc (decl_mangling_context): Check it.
1936 (write_unqualified_name): Check it.
1937 * pt.cc (uses_outer_template_parms_in_constraints): Fix for friends.
1938 (tsubst_friend_function): Don't check satisfaction.
1940 2023-08-22 Tobias Burnus <tobias@codesourcery.com>
1942 * parser.cc (cp_parser_omp_clause_defaultmap): Parse
1945 2023-08-15 Chung-Lin Tang <cltang@codesourcery.com>
1946 Thomas Schwinge <thomas@codesourcery.com>
1948 * parser.cc (OACC_DATA_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_DEFAULT.
1950 2023-08-14 gnaggnoyil <gnaggnoyil@gmail.com>
1954 * decl.cc (get_tuple_size): Update implementation for DR 2386.
1956 2023-08-14 Jason Merrill <jason@redhat.com>
1958 * parser.cc (cp_parser_simple_type_specifier): Handle -std=c++14
1961 2023-08-12 Patrick Palka <ppalka@redhat.com>
1962 Jason Merrill <jason@redhat.com>
1965 * decl.cc (redeclaration_error_message): Remove special handling
1966 for deduction guides.
1967 (grokfndecl): Give deduction guides a dummy DECL_INITIAL.
1969 2023-08-11 Patrick Palka <ppalka@redhat.com>
1972 * parser.cc (cp_parser_type_requirement): Pass
1973 check_dependency_p=true instead of =false.
1975 2023-08-11 Patrick Palka <ppalka@redhat.com>
1978 * decl.cc (grokdeclarator): Pass 'dname' instead of
1979 'unqualified_id' as the name when building the VAR_DECL for a
1980 static data member. Call check_explicit_specialization for a
1981 TEMPLATE_ID_EXPR such member.
1982 * pt.cc (finish_member_template_decl): Return NULL_TREE
1983 instead of 'decl' when DECL_TEMPLATE_SPECIALIZATION is not
1986 2023-08-11 Patrick Palka <ppalka@redhat.com>
1988 * ptree.cc (cxx_print_decl): Check for DECL_LANG_SPECIFIC and
1989 TS_DECL_COMMON only when necessary. Print DECL_TEMPLATE_INFO
1990 for all decls that have it, not just VAR_DECL or FUNCTION_DECL.
1991 Also print DECL_USE_TEMPLATE.
1992 (cxx_print_type): Print TYPE_TEMPLATE_INFO.
1993 <case BOUND_TEMPLATE_TEMPLATE_PARM>: Don't print TYPE_TI_ARGS
1995 <case TEMPLATE_TYPE/TEMPLATE_PARM>: Print TEMPLATE_TYPE_PARM_INDEX
1996 instead of printing the index, level and original level
1999 2023-08-08 Marek Polacek <polacek@redhat.com>
2001 * parser.cc (cp_parser_postfix_expression): Adjust the call to
2002 cp_parser_braced_list.
2003 (cp_parser_postfix_open_square_expression): Likewise.
2004 (cp_parser_new_initializer): Likewise.
2005 (cp_parser_assignment_expression): Adjust the call to
2006 cp_parser_initializer_clause.
2007 (cp_parser_lambda_introducer): Adjust the call to cp_parser_initializer.
2008 (cp_parser_range_for): Adjust the call to cp_parser_braced_list.
2009 (cp_parser_jump_statement): Likewise.
2010 (cp_parser_mem_initializer): Likewise.
2011 (cp_parser_template_argument): Likewise.
2012 (cp_parser_default_argument): Adjust the call to cp_parser_initializer.
2013 (cp_parser_initializer): Handle null is_direct_init and non_constant_p
2015 (cp_parser_initializer_clause): Handle null non_constant_p argument.
2016 (cp_parser_braced_list): Likewise.
2017 (cp_parser_initializer_list): Likewise.
2018 (cp_parser_member_declaration): Adjust the call to
2019 cp_parser_initializer_clause and cp_parser_initializer.
2020 (cp_parser_yield_expression): Adjust the call to cp_parser_braced_list.
2021 (cp_parser_functional_cast): Likewise.
2022 (cp_parser_late_parse_one_default_arg): Adjust the call to
2023 cp_parser_initializer.
2024 (cp_parser_omp_for_loop_init): Likewise.
2025 (cp_parser_omp_declare_reduction_exprs): Likewise.
2027 2023-08-08 Nathaniel Shead <nathanieloshead@gmail.com>
2030 * parser.cc (cp_parser_decltype_expr): Report errors raised by
2031 finish_id_expression.
2033 2023-08-04 Tamar Christina <tamar.christina@arm.com>
2035 * cp-tree.h (RANGE_FOR_NOVECTOR): New.
2036 (cp_convert_range_for, finish_while_stmt_cond, finish_do_stmt,
2037 finish_for_cond): Add novector param.
2038 * init.cc (build_vec_init): Default novector to false.
2039 * method.cc (build_comparison_op): Likewise.
2040 * parser.cc (cp_parser_statement): Likewise.
2041 (cp_parser_for, cp_parser_c_for, cp_parser_range_for,
2042 cp_convert_range_for, cp_parser_iteration_statement,
2043 cp_parser_omp_for_loop, cp_parser_pragma): Support novector.
2044 (cp_parser_pragma_novector): New.
2045 * pt.cc (tsubst_expr): Likewise.
2046 * semantics.cc (finish_while_stmt_cond, finish_do_stmt,
2047 finish_for_cond): Likewise.
2049 2023-08-01 Lewis Hyatt <lhyatt@gmail.com>
2051 * parser.cc (c_init_preprocess): New function.
2052 (maybe_read_tokens_for_pragma_lex): New function.
2053 (pragma_lex): Support preprocess-only mode.
2054 (pragma_lex_discard_to_eol): New function.
2056 2023-07-31 Chung-Lin Tang <cltang@codesourcery.com>
2058 * parser.cc (cp_parser_oacc_host_data): Add checking requiring OpenACC
2059 host_data construct to have an use_device clause.
2061 2023-07-28 Ng YongXiang <yongxiangng@gmail.com>
2065 * init.cc (build_vec_delete_1): Devirtualize array destruction.
2067 2023-07-27 Patrick Palka <ppalka@redhat.com>
2070 * constexpr.cc (cxx_eval_array_reference): Allow synthesizing an
2071 empty subobject even if CONSTRUCTOR_NO_CLEARING is set.
2072 (cxx_eval_bare_aggregate): Set 'no_slot' to true more generally
2073 whenever new_ctx.ctor is set to NULL_TREE by init_subob_ctx,
2074 i.e. whenever initializing an subobject of empty type.
2075 (cxx_eval_vec_init_1): Define 'no_slot' as above and use it
2078 2023-07-27 Nathaniel Shead <nathanieloshead@gmail.com>
2081 * pt.cc (type_uses_auto): Check inside parameter packs.
2083 2023-07-26 Patrick Palka <ppalka@redhat.com>
2087 * pt.cc (reduce_template_parm_level): Set DECL_TEMPLATE_INFO
2088 on the DECL_TEMPLATE_RESULT of the new ttp.
2089 (add_defaults_to_ttp): Make a copy of the original ttp's
2090 DECL_TEMPLATE_RESULT, and update this copy's DECL_TEMPLATE_INFO
2092 (coerce_template_template_parms): Make sure 'scope_args' has
2093 the right amount of levels for the ttp argument.
2094 (most_general_template): Handle template template parameters.
2095 (rewrite_template_parm): Set DECL_TEMPLATE_RESULT on the
2096 DECL_TEMPLATE_RESULT of the new ttp.
2098 2023-07-26 Patrick Palka <ppalka@redhat.com>
2102 * pt.cc (coerce_template_template_parms): Simplify by using
2103 DECL_INNERMOST_TEMPLATE_PARMS and removing redundant asserts.
2104 Always pass the parameters of the most general template to
2105 coerce_template_parms.
2107 2023-07-26 Patrick Palka <ppalka@redhat.com>
2110 * pt.cc (unify) <case INTEGER_CST>: Generalize to handle
2113 2023-07-26 Marek Polacek <polacek@redhat.com>
2115 * parser.cc (cp_parser_constant_expression): Allow non_constant_p to be
2116 nullptr even when allow_non_constant_p is true. Don't call
2117 _rvalue_constant_expression when not necessary. Move local variable
2118 declarations closer to their first use.
2119 (cp_parser_static_assert): Don't pass a dummy down to
2120 cp_parser_constant_expression.
2122 2023-07-26 Jason Merrill <jason@redhat.com>
2125 * parser.cc (cp_parser_template_name): Skip non-member
2126 lookup after the template keyword.
2127 (cp_parser_lookup_name): Pass down template_keyword_p.
2129 2023-07-26 Nathaniel Shead <nathanieloshead@gmail.com>
2134 * constexpr.cc (constexpr_global_ctx::is_outside_lifetime): New
2136 (constexpr_global_ctx::get_value): Don't return expired values.
2137 (constexpr_global_ctx::get_value_ptr): Likewise.
2138 (constexpr_global_ctx::remove_value): Mark value outside
2140 (outside_lifetime_error): New function.
2141 (cxx_eval_call_expression): No longer track save_exprs.
2142 (cxx_eval_loop_expr): Likewise.
2143 (cxx_eval_constant_expression): Add checks for outside lifetime
2144 values. Remove local variables at end of bind exprs, and
2145 temporaries after cleanup points.
2147 2023-07-26 Nathaniel Shead <nathanieloshead@gmail.com>
2150 * cp-gimplify.cc (cp_genericize_r): Transform RETURN_EXPRs to
2151 not return dangling pointers.
2152 * cp-tree.h (RETURN_EXPR_LOCAL_ADDR_P): New flag.
2153 (check_return_expr): Add a new parameter.
2154 * semantics.cc (finish_return_stmt): Set flag on RETURN_EXPR
2155 when referring to dangling pointer.
2156 * typeck.cc (check_return_expr): Disable transformation of
2157 dangling pointers, instead pass this information to caller.
2159 2023-07-26 Nathaniel Shead <nathanieloshead@gmail.com>
2161 * constexpr.cc (modifying_const_object_error): Find the source
2162 location of the const object's declaration.
2163 (cxx_eval_constant_expression): Update input_location to the
2164 location of the currently evaluated expression, if possible.
2166 2023-07-25 Marek Polacek <polacek@redhat.com>
2169 * pt.cc (lookup_and_finish_template_variable): Don't clear tf_partial
2171 (instantiate_template): Reset all complain flags except
2172 tf_warning_or_error.
2174 2023-07-25 Marek Polacek <polacek@redhat.com>
2177 * constexpr.cc (cxx_eval_array_reference): Create a new constructor
2178 only when we don't already have a matching one. Clear the object
2179 when the type is non-scalar.
2181 2023-07-21 Marek Polacek <polacek@redhat.com>
2184 * constexpr.cc (potential_constant_expression_1): Try to complete the
2185 type when !processing_template_decl.
2187 2023-07-20 Marek Polacek <polacek@redhat.com>
2190 * call.cc (implicit_conversion_1): Return early if the type isn't
2193 2023-07-19 Marek Polacek <polacek@redhat.com>
2196 * error.cc (dump_simple_decl): Print base class name.
2198 2023-07-19 Marek Polacek <polacek@redhat.com>
2201 * typeck2.cc (process_init_constructor_record): Don't emit
2202 -Wmissing-field-initializers for empty classes.
2204 2023-07-19 Patrick Palka <ppalka@redhat.com>
2206 * pt.cc (type_unification_real): Test for PARM_DECL instead
2207 of TEMPLATE_PARM_INDEX to distinguish a type vs non-type
2208 template parameter pack.
2209 (type_targs_deducible_from): Likewise.
2211 2023-07-19 Patrick Palka <ppalka@redhat.com>
2213 * pt.cc (tsubst_function_decl): Add defaulted 'use_spec_table'
2214 flag parameter. Don't look up or insert into the specializations
2215 table if 'use_spec_table' is false.
2216 (tsubst_decl): Add defaulted 'use_spec_table' flag parameter.
2217 Check for error_mark_node.
2218 <case FUNCTION_DECL>: Pass 'use_spec_table' to
2219 tsubst_function_decl.
2220 <case TYPE/VAR_DECL>: Don't call coerce_template_parms.
2221 Don't look up or insert into the specializations table if
2222 'use_spec_table' is false. Exit earlier if the substituted
2223 type is erroneous and we're not complaining, and do so for
2224 alias specializations as well.
2225 (instantiate_template): Pass false as 'use_spec_table'
2226 to tsubst_decl. Call register_specialization afterwards.
2228 2023-07-18 Jason Merrill <jason@redhat.com>
2230 * constexpr.cc (cxx_eval_bit_cast): Check that the result of
2231 native_interpret_aggregate doesn't need more evaluation.
2233 2023-07-18 Patrick Palka <ppalka@redhat.com>
2235 * call.cc (add_template_conv_candidate): Don't check for
2236 non-empty 'candidates' here.
2237 (build_op_call): Check it here, before we've considered any
2238 conversion functions.
2240 2023-07-18 Patrick Palka <ppalka@redhat.com>
2243 * call.cc (add_conv_candidate): Check constraints.
2245 2023-07-17 Jason Merrill <jason@redhat.com>
2247 * constexpr.cc (cxx_eval_call_expression): Only cache
2248 reduced_constant_expression_p results.
2249 (reduced_constant_expression_p): Handle CONSTRUCTOR of scalar type.
2250 (cxx_eval_constant_expression): Fold vectors here.
2251 (cxx_eval_bare_aggregate): Not here.
2253 2023-07-15 Patrick Palka <ppalka@redhat.com>
2256 * call.cc (keep_unused_object_arg): Use cp_build_compound_expr
2257 instead of building a COMPOUND_EXPR directly.
2259 2023-07-15 Patrick Palka <ppalka@redhat.com>
2262 * mangle.cc (write_expression): Handle TEMPLATE_ID_EXPR
2263 whose template is already an IDENTIFIER_NODE.
2265 2023-07-14 Nathaniel Shead <nathanieloshead@gmail.com>
2267 * constexpr.cc (cxx_eval_constant_expression): Pass t to get_value.
2269 2023-07-14 Jason Merrill <jason@redhat.com>
2272 * constexpr.cc (cxx_eval_constant_expression): Move P2738 handling
2273 after heap handling.
2274 * name-lookup.cc (get_cxx_dialect_name): Add C++26.
2276 2023-07-14 Marek Polacek <polacek@redhat.com>
2277 Jason Merrill <jason@redhat.com>
2280 * decl.cc (cp_finish_decl): Set TREE_CONSTANT when initializing
2281 an object of empty class type.
2282 * pt.cc (value_dependent_expression_p) <case VAR_DECL>: Treat a
2283 constexpr-declared non-constant variable as value-dependent.
2285 2023-07-11 Patrick Palka <ppalka@redhat.com>
2288 * pt.cc (lookup_template_variable): Pass all levels of arguments
2289 to coerce_template_parms, and use the parameters from the most
2292 2023-07-10 Patrick Palka <ppalka@redhat.com>
2295 * pt.cc (redeclare_class_template): Relax the ttp DECL_CONTEXT
2296 assert, and downgrade it to a checking assert.
2298 2023-06-30 Patrick Palka <ppalka@redhat.com>
2300 * cp-tree.h (TEMPLATE_PARM_DESCENDANTS): Harden.
2301 (TEMPLATE_TYPE_DESCENDANTS): Define.
2302 (TEMPLATE_TEMPLATE_PARM_SIMPLE_P): Define.
2303 * pt.cc (reduce_template_parm_level): Revert
2304 r14-418-g0bc2a1dc327af9 change.
2305 (process_template_parm): Set TEMPLATE_TEMPLATE_PARM_SIMPLE_P
2307 (uses_outer_template_parms): Determine the outer depth of
2308 a template template parm without relying on DECL_CONTEXT.
2309 (tsubst) <case TEMPLATE_TEMPLATE_PARM>: Cache lowering a
2310 simple template template parm. Consistently use 'code'.
2312 2023-06-29 Patrick Palka <ppalka@redhat.com>
2315 * init.cc (maybe_instantiate_nsdmi_init): Mask out all
2316 tsubst flags except for tf_warning_or_error.
2318 2023-06-29 Patrick Palka <ppalka@redhat.com>
2321 * cp-gimplify.cc (cp_fold) <case CONSTRUCTOR>: Propagate
2322 CONSTRUCTOR_MUTABLE_POISON.
2324 2023-06-29 Patrick Palka <ppalka@redhat.com>
2326 * cp-tree.h (tree_template_info::partial): New data member.
2327 (TI_PARTIAL_INFO): New tree accessor.
2328 (most_specialized_partial_spec): Add defaulted bool parameter.
2329 * module.cc (trees_out::core_vals) <case TEMPLATE_INFO>: Stream
2331 (trees_in::core_vals) <case TEMPLATE_INFO>: Likewise.
2332 * parser.cc (specialization_of): Adjust after making
2333 most_specialized_partial_spec return TEMPLATE_INFO instead
2335 * pt.cc (process_partial_specialization): Set TI_PARTIAL_INFO
2336 of 'decl' to point back to the partial TEMPLATE_DECL. Likewise
2337 (and pass rechecking=true to most_specialization_partial_spec).
2338 (instantiate_class_template): Likewise.
2339 (instantiate_template): Set TI_PARTIAL_INFO to the result of
2340 most_specialization_partial_spec after forming a variable
2341 template specialization.
2342 (most_specialized_partial_spec): Add 'rechecking' parameter.
2343 Exit early if the template is not primary. Use the TI_PARTIAL_INFO
2344 of the corresponding TEMPLATE_INFO as a cache unless 'rechecking'
2345 is true. Don't bother setting TREE_TYPE of each TREE_LIST.
2346 (instantiate_decl): Adjust after making
2347 most_specialized_partial_spec return TEMPLATE_INFO instead of
2349 * ptree.cc (cxx_print_xnode) <case TEMPLATE_INFO>: Dump
2352 2023-06-29 Eugene Rozenfeld <erozen@microsoft.com>
2354 * Make-lang.in: Pass correct stage cc1plus when processing
2355 profile data collected while building target libraries
2357 2023-06-28 Patrick Palka <ppalka@redhat.com>
2361 * cp-tree.h (lookup_template_variable): Add complain parameter.
2362 * parser.cc (cp_parser_template_id): Pass tf_warning_or_error
2363 to lookup_template_variable.
2364 * pt.cc (lookup_template_variable): Add complain parameter.
2365 Coerce template arguments here ...
2366 (finish_template_variable): ... instead of here.
2367 (lookup_and_finish_template_variable): Check for error_mark_node
2368 result from lookup_template_variable.
2369 (tsubst_copy) <case TEMPLATE_ID_EXPR>: Pass complain to
2370 lookup_template_variable.
2371 (instantiate_template): Use build2 instead of
2372 lookup_template_variable to build a TEMPLATE_ID_EXPR
2373 for most_specialized_partial_spec.
2375 2023-06-28 Marek Polacek <polacek@redhat.com>
2378 * typeck.cc (cp_build_unary_op): Check tf_warning before warning.
2380 2023-06-28 Jason Merrill <jason@redhat.com>
2383 * cp-tree.h (clone_attrs): Declare.
2384 * method.cc (implicitly_declare_fn): Use it for inherited
2386 * optimize.cc (clone_attrs): New.
2387 (maybe_clone_body): Use it.
2389 2023-06-28 Jason Merrill <jason@redhat.com>
2392 * constexpr.cc (cxx_eval_constant_expression): In C++26, allow cast
2393 from void* to the type of a pointed-to object.
2395 2023-06-23 David Malcolm <dmalcolm@redhat.com>
2398 * cp-name-hint.h (maybe_suggest_missing_header): New decl.
2399 * decl.cc: Define INCLUDE_MEMORY. Add include of
2400 "cp/cp-name-hint.h".
2401 (start_decl_1): Call maybe_suggest_missing_header.
2402 * name-lookup.cc (maybe_suggest_missing_header): Remove "static".
2404 2023-06-16 Alex Coplan <alex.coplan@arm.com>
2406 * parser.cc (cp_parser_enum_specifier): Don't reject
2407 elaborated-type-specifier with enum-base, instead emit new
2408 Welaborated-enum-base warning.
2410 2023-06-14 Jason Merrill <jason@redhat.com>
2414 * call.cc (joust_maybe_elide_copy): Don't change cand.
2415 (joust): Move the elided tiebreaker later.
2417 2023-06-13 David Malcolm <dmalcolm@redhat.com>
2420 * name-lookup.cc (missing_std_header::~missing_std_header): Reword
2421 note to avoid negative tone of "forgetting".
2423 2023-06-13 Jason Merrill <jason@redhat.com>
2425 * tree.cc (build_target_expr): Check TYPE_HAS_MUTABLE_P.
2427 2023-06-12 Tobias Burnus <tobias@codesourcery.com>
2429 * parser.cc (cp_parser_omp_clause_map): Reword error message for
2430 clearness especially with 'omp target (enter/exit) data.'
2431 * semantics.cc (handle_omp_array_sections): Handle
2432 GOMP_MAP_{ALWAYS_,}PRESENT_{TO,TOFROM,FROM,ALLOC} enum values.
2434 2023-06-12 Jason Merrill <jason@redhat.com>
2437 * call.cc (convert_like_internal) [ck_list]: Use
2438 maybe_init_list_as_array.
2439 * constexpr.cc (cxx_eval_vec_init_1): Init might have
2441 * tree.cc (build_vec_init_elt): Likewise.
2442 * init.cc (build_vec_init): Handle from_array from a
2443 TARGET_EXPR. Retain TARGET_EXPR of a different type.
2445 2023-06-11 Patrick Palka <ppalka@redhat.com>
2448 * constexpr.cc (cxx_eval_call_expression): Synthesize defaulted
2449 functions needed for constant evaluation.
2450 (instantiate_cx_fn_r): Likewise.
2452 2023-06-11 Patrick Palka <ppalka@redhat.com>
2455 * pt.cc (lookup_template_class): Extend shortcut for looking up the
2456 current class scope to consider outer class scopes too, and use
2457 current_nonlambda_class_type instead of current_class_type. Only
2458 call coerce_template_parms when specializing a primary template.
2460 2023-06-10 Nathan Sidwell <nathan@acm.org>
2463 * pt.cc (maybe_adjust_types_for_deduction): Implement DR976.
2465 2023-06-09 Jason Merrill <jason@redhat.com>
2469 * method.cc (build_comparison_op): Give retval a name.
2470 * typeck.cc (check_return_expr): Fix for nameless variables.
2472 2023-06-09 Jason Merrill <jason@redhat.com>
2474 * parser.cc (cp_parser_simple_type_specifier): Check for auto
2475 in template argument.
2476 (cp_parser_template_type_arg): Remove auto checking.
2478 2023-06-09 Jason Merrill <jason@redhat.com>
2481 * call.cc (maybe_init_list_as_array): Check that the element type is
2484 2023-06-07 Jason Merrill <jason@redhat.com>
2488 * cp-tree.h (INIT_EXPR_NRV_P): New.
2489 * semantics.cc (finalize_nrv_r): Check it.
2490 * name-lookup.h (decl_in_scope_p): Declare.
2491 * name-lookup.cc (decl_in_scope_p): New.
2492 * typeck.cc (check_return_expr): Allow non-NRV
2493 returns if the NRV is no longer in scope.
2495 2023-06-07 Jason Merrill <jason@redhat.com>
2498 * typeck.cc (want_nrvo_p): New.
2499 (check_return_expr): Handle -Wnrvo.
2501 2023-06-07 Jason Merrill <jason@redhat.com>
2505 * decl.cc (finish_function): Simplify NRV handling.
2506 * except.cc (maybe_set_retval_sentinel): Also set if NRV.
2507 (maybe_splice_retval_cleanup): Don't add the cleanup region
2508 if we don't need it.
2509 * semantics.cc (nrv_data): Add simple field.
2510 (finalize_nrv): Set it.
2511 (finalize_nrv_r): Check it and retval sentinel.
2512 * cp-tree.h (finalize_nrv): Adjust declaration.
2513 * typeck.cc (check_return_expr): Remove named_labels check.
2515 2023-06-07 Jason Merrill <jason@redhat.com>
2518 * typeck.cc (check_return_expr): Prevent NRV in the presence of
2521 2023-06-07 Jason Merrill <jason@redhat.com>
2524 * except.cc (maybe_splice_retval_cleanup): Change
2525 recognition of function body and try scopes.
2526 * semantics.cc (do_poplevel): Call it after poplevel.
2527 (at_try_scope): New.
2528 * cp-tree.h (maybe_splice_retval_cleanup): Adjust.
2530 2023-06-07 Jason Merrill <jason@redhat.com>
2532 * semantics.cc (finalize_nrv_r): [RETURN_EXPR]: Only replace the
2535 2023-06-06 Kwok Cheung Yeung <kcy@codesourcery.com>
2536 Tobias Burnus <tobias@codesourcery.com>
2538 * parser.cc (cp_parser_omp_clause_defaultmap,
2539 cp_parser_omp_clause_map): Parse 'present'.
2540 (cp_parser_omp_clause_from_to): New; parse to/from
2541 clauses with optional 'present' modifier.
2542 (cp_parser_omp_all_clauses): Update call.
2543 (cp_parser_omp_target_data, cp_parser_omp_target_enter_data,
2544 cp_parser_omp_target_exit_data): Handle new enum value for
2546 * semantics.cc (finish_omp_target): Likewise.
2548 2023-06-04 Jason Merrill <jason@redhat.com>
2551 * cp-tree.h (enum cp_tree_index): Add CPTI_CALL_TERMINATE_FN.
2552 (call_terminate_fn): New macro.
2553 * cp-gimplify.cc (gimplify_must_not_throw_expr): Use it.
2554 * except.cc (init_exception_processing): Set it.
2555 (cp_protect_cleanup_actions): Return it.
2557 2023-06-03 Patrick Palka <ppalka@redhat.com>
2560 * pt.cc (is_specialization_of_friend): Fix overbroad check for
2561 a non-template member function of a class template.
2563 2023-06-03 Patrick Palka <ppalka@redhat.com>
2565 * pt.cc (iterative_hash_template_arg): Don't hash
2566 TEMPLATE_TEMPLATE_PARM specially.
2568 2023-06-03 Patrick Palka <ppalka@redhat.com>
2570 * class.cc (build_base_path): Check in_template_context instead
2571 of in_template_function.
2572 (resolves_to_fixed_type_p): Likewise.
2573 * cp-tree.h (in_template_context): Define.
2574 (in_template_function): Remove.
2575 * decl.cc (cp_make_fname_decl): Check current_function_decl
2576 and in_template_context instead of in_template_function.
2577 * decl2.cc (mark_used): Check in_template_context instead of
2578 in_template_function.
2579 * pt.cc (in_template_function): Remove.
2580 * semantics.cc (enforce_access): Check in_template_context
2581 instead of current_template_parms directly.
2583 2023-06-03 Patrick Palka <ppalka@redhat.com>
2586 * mangle.cc (write_expression): Handle NOEXCEPT_EXPR.
2588 2023-06-02 Jason Merrill <jason@redhat.com>
2592 * call.cc (sfk_copy_or_move): New.
2593 (joust): Add tiebreaker for explicit conv and copy ctor.
2595 2023-06-02 Jason Merrill <jason@redhat.com>
2599 * call.cc (maybe_init_list_as_array): Set DECL_MERGEABLE.
2600 (convert_like_internal) [ck_list]: Set it.
2601 (set_up_extended_ref_temp): Copy it.
2602 * tree.cc (handle_no_unique_addr_attribute): Set it.
2604 2023-06-01 Jason Merrill <jason@redhat.com>
2606 * typeck2.cc (check_narrowing): Check flag_permissive.
2608 2023-05-30 Tobias Burnus <tobias@codesourcery.com>
2611 * parser.cc (cp_parser_oacc_all_clauses,
2612 cp_parser_omp_all_clauses): Improve error wording.
2614 2023-05-19 Andrew Pinski <apinski@marvell.com>
2617 * lang-specs.h ("@c++-header"): Add %w after
2619 ("@c++-system-header"): Likewise.
2620 ("@c++-user-header"): Likewise.
2622 2023-05-19 Patrick Palka <ppalka@redhat.com>
2624 * constraint.cc (normalize_concept_check): Avoid having to do
2625 two norm_cache lookups. Remove unnecessary early exit for an
2626 ill-formed concept definition.
2628 2023-05-19 Patrick Palka <ppalka@redhat.com>
2631 * pt.cc (lookup_and_finish_template_variable): Don't call
2632 convert_from_reference.
2633 (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Call
2634 convert_from_reference on the result of
2635 lookup_and_finish_template_variable.
2637 2023-05-18 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
2639 * call.cc (promoted_arithmetic_type_p): Use _P defines from tree.h.
2640 (build_conditional_expr): Ditto.
2641 (convert_like_internal): Ditto.
2642 (convert_arg_to_ellipsis): Ditto.
2643 (build_over_call): Ditto.
2644 (compare_ics): Ditto.
2645 * class.cc (is_empty_base_ref): Ditto.
2646 * coroutines.cc (rewrite_param_uses): Ditto.
2647 * cp-tree.h (DECL_DISCRIMINATOR_P): Ditto.
2648 (ARITHMETIC_TYPE_P): Ditto.
2649 * cvt.cc (ocp_convert): Ditto.
2650 * cxx-pretty-print.cc (pp_cxx_template_argument_list): Ditto.
2651 * decl.cc (layout_var_decl): Ditto.
2652 (get_tuple_size): Ditto.
2653 * error.cc (dump_simple_decl): Ditto.
2654 * lambda.cc (start_lambda_scope): Ditto.
2655 * mangle.cc (write_template_arg): Ditto.
2656 * method.cc (spaceship_comp_cat): Ditto.
2657 * module.cc (node_template_info): Ditto.
2658 (trees_out::start): Ditto.
2659 (trees_out::decl_node): Ditto.
2660 (trees_in::read_var_def): Ditto.
2661 (set_instantiating_module): Ditto.
2662 * name-lookup.cc (maybe_record_mergeable_decl): Ditto.
2663 (consider_decl): Ditto.
2664 (maybe_add_fuzzy_decl): Ditto.
2665 * pt.cc (convert_nontype_argument): Ditto.
2666 * semantics.cc (handle_omp_array_sections_1): Ditto.
2667 (finish_omp_clauses): Ditto.
2668 (finish_omp_target_clauses_r): Ditto.
2669 (is_this_parameter): Ditto.
2670 * tree.cc (build_cplus_array_type): Ditto.
2671 (is_this_expression): Ditto.
2672 * typeck.cc (do_warn_enum_conversions): Ditto.
2673 * typeck2.cc (store_init_value): Ditto.
2674 (check_narrowing): Ditto.
2676 2023-05-17 Jakub Jelinek <jakub@redhat.com>
2679 * init.cc (build_zero_init_1): Don't initialize zero-width bitfields.
2680 For unions only initialize the first FIELD_DECL.
2682 2023-05-16 Marek Polacek <polacek@redhat.com>
2685 * typeck.cc (check_return_expr): In a template, return only after
2686 suppressing -Wdangling-reference.
2688 2023-05-16 Patrick Palka <ppalka@redhat.com>
2691 * call.cc (add_list_candidates): Check for invalid designated
2692 initialization sooner and even for types that have a list
2695 2023-05-11 Patrick Palka <ppalka@redhat.com>
2698 * typeck2.cc (poison_mutable_constructors): Define.
2699 (store_init_value): Use it instead of setting
2700 CONSTRUCTOR_MUTABLE_POISON directly.
2702 2023-05-11 Patrick Palka <ppalka@redhat.com>
2703 Jonathan Wakely <jwakely@redhat.com>
2708 * pt.cc (convert_nontype_argument_function): Remove linkage
2709 requirement for C++17 and later.
2710 (invalid_tparm_referent_p) <case ADDR_EXPR>: Restrict
2711 DECL_ARTIFICIAL rejection test to VAR_DECL.
2713 2023-05-10 Marek Polacek <polacek@redhat.com>
2716 * method.cc (build_trait_object): New.
2717 (assignable_expr): Use it.
2718 (ref_xes_from_temporary): Likewise.
2719 (is_convertible_helper): Likewise. Check FUNC_OR_METHOD_TYPE_P.
2721 2023-05-10 Jason Merrill <jason@redhat.com>
2723 * call.cc (convert_like_internal): Share ck_ref_bind handling
2724 between all bad conversions.
2726 2023-05-10 Jason Merrill <jason@redhat.com>
2729 * constexpr.cc (cxx_eval_outermost_constant_expr): Preserve
2731 (potential_constant_expression_1): Check TARGET_EXPR_ELIDING_P.
2732 * typeck2.cc (store_init_value): Diagnose constinit sooner.
2734 2023-05-10 Jason Merrill <jason@redhat.com>
2736 * constexpr.cc (cxx_eval_outermost_constant_expr): Always check
2737 for address of immediate fn.
2738 (maybe_constant_init_1): Evaluate PTRMEM_CST.
2740 2023-05-10 Jakub Jelinek <jakub@redhat.com>
2743 * parser.cc (cp_parser_std_attribute): For unknown attributes with
2744 arguments set TREE_VALUE (attribute) to error_mark_node after skipping
2745 the balanced tokens.
2746 (cp_parser_std_attribute_list): If ... is used after attribute without
2747 arguments, diagnose it and return error_mark_node. If
2748 TREE_VALUE (attribute) is error_mark_node, don't call
2749 make_pack_expansion nor return early error_mark_node.
2751 2023-05-09 Patrick Palka <ppalka@redhat.com>
2754 * constraint.cc (satisfaction_cache::satisfaction_cache): In the
2755 unexpected case of evaluating an atom for the first time noisily,
2756 remove the cache slot that we inserted.
2758 2023-05-09 Patrick Palka <ppalka@redhat.com>
2761 * parser.cc (cp_parser_class_specifier): Don't pass a class
2762 context to noexcept_override_late_checks.
2763 (noexcept_override_late_checks): Remove 'type' parameter
2764 and use DECL_CONTEXT of 'fndecl' instead.
2766 2023-05-09 Jakub Jelinek <jakub@redhat.com>
2769 * cp-gimplify.cc (process_stmt_assume_attribute): Diagnose pack
2770 expansion of assume attribute.
2772 2023-05-08 Patrick Palka <ppalka@redhat.com>
2776 * pt.cc (do_auto_deduction): Move up resolve_nondeduced_context
2777 calls to happen before do_class_deduction. Add some
2778 error_mark_node tests.
2780 2023-05-07 Patrick Palka <ppalka@redhat.com>
2783 * cxx-pretty-print.cc (cxx_pretty_printer::unary_expression)
2784 <case ALIGNOF_EXPR>: Consider ALIGNOF_EXPR_STD_P.
2785 * error.cc (dump_expr) <case ALIGNOF_EXPR>: Likewise.
2787 2023-05-07 Patrick Palka <ppalka@redhat.com>
2791 * decl.cc (decl_jump_unsafe): Return bool instead of int.
2792 Don't consider TYPE_HAS_NONTRIVIAL_DESTRUCTOR.
2793 (check_previous_goto_1): Simplify now that decl_jump_unsafe
2794 returns bool instead of int.
2795 (check_goto): Likewise.
2797 2023-05-07 Patrick Palka <ppalka@redhat.com>
2799 * pt.cc (instantiate_alias_template): Exit early upon
2800 error from coerce_template_parms. Remove dependence test
2801 guarding constraints_satisfied_p.
2803 2023-05-07 Patrick Palka <ppalka@redhat.com>
2805 * cp-tree.h (PLACEHOLDER_TYPE_CONSTRAINTS_INFO): Harden via
2806 TEMPLATE_TYPE_PARM_CHECK.
2807 (TPARMS_PRIMARY_TEMPLATE): Harden via TREE_VEC_CHECK.
2808 (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL): Harden via
2809 TEMPLATE_TEMPLATE_PARM_CHECK.
2810 * cxx-pretty-print.cc (cxx_pretty_printer::simple_type_specifier):
2811 Guard PLACEHOLDER_TYPE_CONSTRAINTS access.
2812 * error.cc (dump_type) <case TEMPLATE_TYPE_PARM>: Use separate
2813 variable to store CLASS_PLACEHOLDER_TEMPLATE result.
2814 * pt.cc (outer_template_args): Use strip_innermost_template_args.
2815 (any_type_dependent_arguments_p): Exit early if
2816 !processing_template_decl. Use range-based for.
2817 (any_dependent_template_arguments_p): Likewise.
2819 2023-05-07 Patrick Palka <ppalka@redhat.com>
2822 * pt.cc (tsubst_copy_and_build) <case COMPONENT_REF>: Propagate
2823 REF_PARENTHESIZED_P more generally via force_paren_expr.
2824 * semantics.cc (force_paren_expr): Document default argument.
2826 2023-05-07 Patrick Palka <ppalka@redhat.com>
2829 * pt.cc (coerce_template_args_for_ttp): Mention we can hit the
2830 current_template_parms fallback when level-lowering a bound ttp.
2831 (tsubst_template_decl): Add lambda_tparms parameter. Prefer to
2832 use lambda_tparms instead of substituting DECL_TEMPLATE_PARMS.
2833 (tsubst_decl) <case TEMPLATE_DECL>: Pass NULL_TREE as lambda_tparms
2834 to tsubst_template_decl.
2835 (tsubst_lambda_expr): For a generic lambda, substitute
2836 DECL_TEMPLATE_PARMS and set current_template_parms to it
2837 before substituting the function type. Pass the substituted
2838 DECL_TEMPLATE_PARMS as lambda_tparms to tsubst_template_decl.
2840 2023-05-07 Patrick Palka <ppalka@redhat.com>
2843 * semantics.cc (enforce_access): Check current_template_parms
2844 instead of processing_template_decl when deciding whether to
2845 defer the access check.
2847 2023-05-07 Patrick Palka <ppalka@redhat.com>
2850 * constexpr.cc (potential_constant_expression_1) <case CALL_EXPR>:
2851 Reorganize to call get_fns sooner. Remove special handling of
2852 the object argument of a non-static member function call. Remove
2853 dead store to 'fun'.
2855 2023-05-05 Jason Merrill <jason@redhat.com>
2858 2023-04-27 Jason Merrill <jason@redhat.com>
2861 * pt.cc (instantiate_decl): Assert !defer_ok for local
2864 2023-05-03 Jason Merrill <jason@redhat.com>
2868 * friend.cc (do_friend): Don't call check_explicit_specialization if
2869 DECL_TEMPLATE_INFO is already set.
2870 * decl2.cc (check_classfn): Set DECL_TEMPLATE_INFO.
2871 * name-lookup.cc (set_decl_namespace): Likewise.
2873 2023-05-03 Jakub Jelinek <jakub@redhat.com>
2875 * cp-gimplify.cc (cp_fold_data): Move definition earlier.
2876 (cp_gimplify_expr): Pass address of ff_genericize | ff_mce_false
2877 constructed data rather than &pset to cp_walk_tree with cp_fold_r.
2879 2023-05-03 Jason Merrill <jason@redhat.com>
2881 * pt.cc (reduce_template_parm_level): Fix comparison of
2882 template template parm to cached version.
2884 2023-05-02 Jason Merrill <jason@redhat.com>
2886 * pt.cc (instantiate_class_template): Skip the RECORD_TYPE
2887 of a class template.
2888 (tsubst_template_decl): Clear CLASSTYPE_USE_TEMPLATE.
2890 2023-05-02 Jason Merrill <jason@redhat.com>
2892 * name-lookup.cc (pop_from_top_level): Don't
2893 invalidate_class_lookup_cache.
2895 2023-05-02 Jason Merrill <jason@redhat.com>
2898 * cp-tree.h (lookup_base): Add offset parm.
2899 * constexpr.cc (cxx_fold_indirect_ref_1): Pass it.
2900 * search.cc (struct lookup_base_data_s): Add offset.
2901 (dfs_lookup_base): Handle it.
2902 (lookup_base): Pass it.
2904 2023-05-02 Jason Merrill <jason@redhat.com>
2907 * constexpr.cc (cxx_fold_indirect_ref_1): Handle empty base first.
2909 2023-05-01 Jason Merrill <jason@redhat.com>
2912 * name-lookup.cc (maybe_push_to_top_level)
2913 (maybe_pop_from_top_level): Split out...
2914 * pt.cc (instantiate_body): ...from here.
2915 * init.cc (maybe_instantiate_nsdmi_init): Use them.
2916 * name-lookup.h: Declare them..
2918 2023-04-28 Eugene Rozenfeld <erozen@microsoft.com>
2920 * Make-lang.in: Merge perf data collected when compiling cc1plus and runtime libraries
2922 2023-04-27 Jason Merrill <jason@redhat.com>
2924 * call.cc (print_conversion_rejection): Use iloc_sentinel.
2926 2023-04-27 Jason Merrill <jason@redhat.com>
2929 * pt.cc (instantiate_decl): Assert !defer_ok for local
2932 2023-04-26 Jason Merrill <jason@redhat.com>
2934 * init.cc (nsdmi_inst): Remove.
2935 (maybe_instantiate_nsdmi_init): Use DECL_INITIAL instead.
2937 2023-04-26 Jason Merrill <jason@redhat.com>
2940 * pt.cc (instantiate_class_template): Do partially instantiate.
2941 (tsubst_expr): Do call complete_type for partial instantiations.
2943 2023-04-26 Jason Merrill <jason@redhat.com>
2946 * pt.cc (regenerate_decl_from_template): Skip unique friends.
2948 2023-04-26 Patrick Palka <ppalka@redhat.com>
2950 * pt.cc (most_specialized_partial_spec): Exit early when
2951 DECL_TEMPLATE_SPECIALIZATIONS is empty. Move local variable
2952 declarations closer to their first use. Remove redundant
2953 flag_concepts test. Remove redundant forward declaration.
2955 2023-04-25 Patrick Palka <ppalka@redhat.com>
2958 * pt.cc (value_dependent_expression_p) <case VAR_DECL>:
2959 Suppress conservative early exit for reference variables
2960 when DECL_HAS_VALUE_EXPR_P.
2962 2023-04-25 Tobias Burnus <tobias@codesourcery.com>
2964 * parser.cc (cp_parser_omp_scan_loop_body): Handle
2965 zero exec statements before/after 'omp scan'.
2967 2023-04-24 Patrick Palka <ppalka@redhat.com>
2969 * cp-tree.h (cp_expr_location): Define here.
2970 * tree.cc (cp_expr_location): Don't define here.
2972 2023-04-21 Jason Merrill <jason@redhat.com>
2975 * decl.cc (grokdeclarator): Don't clear typedef_decl after 'unsigned
2976 typedef' pedwarn. Use c_common_signed_or_unsigned_type. Also
2977 handle 'signed typedef'.
2979 2023-04-21 Patrick Palka <ppalka@redhat.com>
2981 * tree.cc (cp_walk_subtrees): Avoid repeatedly dereferencing tp.
2982 <case DECLTYPE_TYPE>: Use cp_unevaluated and WALK_SUBTREE.
2983 <case ALIGNOF_EXPR etc>: Likewise.
2985 2023-04-20 Patrick Palka <ppalka@redhat.com>
2987 * pt.cc (tsubst) <case TEMPLATE_TYPE_PARM>: Don't recurse when
2988 level lowering a cv-qualified type template parameter. Remove
2989 recursive loop breaker in the level lowering case for constrained
2990 autos. Use the TEMPLATE_PARM_DESCENDANTS cache in this case as
2993 2023-04-20 Patrick Palka <ppalka@redhat.com>
2995 * constraint.cc (diagnose_trait_expr): Convert a TREE_VEC
2996 of arguments into a TREE_LIST for sake of pretty printing.
2997 * cxx-pretty-print.cc (pp_cxx_trait): Handle TREE_VEC
2998 instead of TREE_LIST of trailing variadic trait arguments.
2999 * method.cc (constructible_expr): Likewise.
3000 (is_xible_helper): Likewise.
3001 * parser.cc (cp_parser_trait): Represent trailing variadic trait
3002 arguments as a TREE_VEC instead of TREE_LIST.
3003 * pt.cc (value_dependent_expression_p): Handle TREE_VEC
3004 instead of TREE_LIST of trailing variadic trait arguments.
3005 * semantics.cc (finish_type_pack_element): Likewise.
3006 (check_trait_type): Likewise.
3008 2023-04-20 Patrick Palka <ppalka@redhat.com>
3010 * tree.cc (strip_typedefs): Move TREE_LIST handling to
3011 strip_typedefs_expr. Dispatch to strip_typedefs_expr for
3013 <case TYPENAME_TYPE>: Remove manual dispatching to
3014 strip_typedefs_expr.
3015 <case TRAIT_TYPE>: Likewise.
3016 (strip_typedefs_expr): Replaces calls to strip_typedefs_expr
3017 with strip_typedefs throughout. Don't dispatch to strip_typedefs
3019 <case TREE_LIST>: Replace this with the better version from
3022 2023-04-19 Patrick Palka <ppalka@redhat.com>
3023 Jonathan Wakely <jwakely@redhat.com>
3026 * cp-trait.def (TYPE_PACK_ELEMENT): Define.
3027 * cp-tree.h (finish_trait_type): Add complain parameter.
3028 * cxx-pretty-print.cc (pp_cxx_trait): Handle
3029 CPTK_TYPE_PACK_ELEMENT.
3030 * parser.cc (cp_parser_constant_expression): Document default
3032 (cp_parser_trait): Handle CPTK_TYPE_PACK_ELEMENT. Pass
3033 tf_warning_or_error to finish_trait_type.
3034 * pt.cc (tsubst) <case TRAIT_TYPE>: Handle non-type first
3035 argument. Pass complain to finish_trait_type.
3036 * semantics.cc (finish_type_pack_element): Define.
3037 (finish_trait_type): Add complain parameter. Handle
3038 CPTK_TYPE_PACK_ELEMENT.
3039 * tree.cc (strip_typedefs): Handle non-type first argument.
3040 Pass tf_warning_or_error to finish_trait_type.
3041 * typeck.cc (structural_comptypes) <case TRAIT_TYPE>: Use
3042 cp_tree_equal instead of same_type_p for the first argument.
3044 2023-04-19 Patrick Palka <ppalka@redhat.com>
3047 * pt.cc (try_class_unification): Don't ggc_free the copy of
3050 2023-04-19 Jason Merrill <jason@redhat.com>
3053 * decl.cc (grokdeclarator): Keep typedef_decl for __int128_t.
3055 2023-04-17 Patrick Palka <ppalka@redhat.com>
3058 * pt.cc (tsubst) <case BOUND_TEMPLATE_TEMPLATE_PARM>:
3059 In the level-lowering case just use lookup_template_class
3060 to rebuild the bound ttp.
3062 2023-04-15 Jason Merrill <jason@redhat.com>
3065 * constexpr.cc (cxx_eval_constant_expression) [TARGET_EXPR]:
3066 Check for complex initializer.
3068 2023-04-13 Patrick Palka <ppalka@redhat.com>
3071 * decl.cc (make_typename_type): Also ignore non-types during the
3072 lookup if tag_type corresponds to an elaborated-type-specifier.
3073 * pt.cc (tsubst) <case TYPENAME_TYPE>: Pass class_type or
3074 enum_type as tag_type to make_typename_type accordingly instead
3075 of always passing typename_type.
3077 2023-04-13 Jason Merrill <jason@redhat.com>
3080 * semantics.cc (check_trait_type): Handle incomplete type directly.
3081 * typeck2.cc (cxx_incomplete_type_diagnostic): Remove assert.
3083 2023-04-13 Jason Merrill <jason@redhat.com>
3085 * typeck2.cc (cxx_incomplete_type_diagnostic): Return bool.
3086 * cp-tree.h (cxx_incomplete_type_diagnostic): Adjust.
3088 2023-04-12 Jakub Jelinek <jakub@redhat.com>
3090 * Make-lang.in (s-cp-module-version): New target.
3091 (cp/module.o): Depend on it.
3092 (MODULE_VERSION): Remove variable.
3093 (CFLAGS-cp/module.o): For -DMODULE_VERSION= argument just
3094 cat s-cp-module-version.
3096 2023-04-09 Iain Sandoe <iain@sandoe.co.uk>
3098 * coroutines.cc (coro_rewrite_function_body): Ensure that added
3099 bind expressions have scope blocks.
3101 2023-04-04 Jason Merrill <jason@redhat.com>
3104 * decl2.cc (find_last_decl): Return early if DECL_USE_TEMPLATE.
3106 2023-04-03 Patrick Palka <ppalka@redhat.com>
3109 * decl.cc (cp_finish_decl): Diagnose ordinary auto deduction
3110 with no initializer, instead of asserting.
3112 2023-04-01 Patrick Palka <ppalka@redhat.com>
3115 * cp-tree.h (do_auto_deduction): Add defaulted tmpl parameter.
3116 * pt.cc (convert_template_argument): Pass 'in_decl' as 'tmpl' to
3118 (tsubst_decl) <case VAR_/TYPE_DECL>: Pass 'tmpl' instead of 't' as
3119 'in_decl' to coerce_template_parms.
3120 (unify) <case TEMPLATE_PARM_INDEX>: Pass TPARMS_PRIMARY_TEMPLATE
3121 as 'tmpl' to do_auto_deduction.
3122 (do_auto_deduction): Document default arguments. Rename local
3123 variable 'tmpl' to 'ctmpl'. Use 'tmpl' to obtain a full set of
3124 template arguments for satisfaction in the adc_unify case.
3126 2023-04-01 Patrick Palka <ppalka@redhat.com>
3130 * pt.cc (invalid_tparm_referent_p): Accept ADDR_EXPR of
3132 (instantiate_class_template): Call mark_template_arguments_used.
3133 (tsubst_copy_and_build) <case CALL_EXPR>: Revert r13-995 change.
3134 (mark_template_arguments_used): Define.
3135 (instantiate_body): Call mark_template_arguments_used.
3137 2023-04-01 Iain Sandoe <iain@sandoe.co.uk>
3140 * coroutines.cc (flatten_await_stmt): Use the current count of
3141 promoted temporaries to build a unique name for the frame entries.
3143 2023-03-30 Jason Merrill <jason@redhat.com>
3146 * search.cc (type_context_for_name_lookup): New.
3147 (accessible_p): Handle anonymous union.
3148 * init.cc (maybe_instantiate_nsdmi_init): Use
3149 type_context_for_name_lookup.
3150 * parser.cc (cp_parser_class_specifier): Likewise.
3151 * cp-tree.h (type_context_for_name_lookup): Declare.
3153 2023-03-30 Jason Merrill <jason@redhat.com>
3156 * pt.cc (unify) [FUNCTION_TYPE]: Handle function pointer
3159 2023-03-30 Jakub Jelinek <jakub@redhat.com>
3162 * decl2.cc (grok_array_decl): After emitting a pedwarn for
3163 -Wcomma-subscript, if processing_template_decl set orig_index_exp
3164 to compound expr from orig_index_exp_list.
3166 2023-03-30 Jason Merrill <jason@redhat.com>
3170 * decl2.cc (record_mangling): Use symtab_node::reset.
3172 2023-03-30 Jakub Jelinek <jakub@redhat.com>
3175 * call.cc (convert_like_internal): If pedwarn for extended float
3176 type conversions doesn't report anything, avoid calling
3177 maybe_inform_about_fndecl_for_bogus_argument_init.
3179 2023-03-29 Jason Merrill <jason@redhat.com>
3183 * pt.cc (alias_ctad_tweaks): Rewrite deduced args.
3184 (type_targs_deducible_from): Handle null pack deduction.
3186 2023-03-28 David Malcolm <dmalcolm@redhat.com>
3189 * parser.cc (cp_parser_binary_expression): Update for new param of
3190 check_for_xor_used_as_pow.
3192 2023-03-28 Jakub Jelinek <jakub@redhat.com>
3195 * contracts.cc: Include intl.h.
3196 (check_postcondition_result): Don't form diagnostics from two halves
3197 of an English message to allow translations.
3199 2023-03-24 Patrick Palka <ppalka@redhat.com>
3202 * parser.cc (cp_parser_class_specifier): Clear current_class_ptr
3203 and current_class_ref sooner, before parsing a class definition.
3205 2023-03-24 Jason Merrill <jason@redhat.com>
3208 * pt.cc (type_unification_real): Adjust for partial ordering.
3210 2023-03-23 Jason Merrill <jason@redhat.com>
3213 * typeck.cc (build_ptrmemfunc): Drop 0-offset optimization
3214 and location wrappers.
3216 2023-03-23 Marek Polacek <polacek@redhat.com>
3219 * call.cc (class_has_reference_member_p): New.
3220 (class_has_reference_member_p_r): New.
3221 (reference_like_class_p): Don't look for a specific constructor.
3222 Use a DFS walk with class_has_reference_member_p_r.
3224 2023-03-23 Jason Merrill <jason@redhat.com>
3227 * pt.cc (find_parameter_packs_r): Handle null TREE_BINFO.
3229 2023-03-22 Jason Merrill <jason@redhat.com>
3232 * pt.cc (unify): Use fold of build_nop instead of fold_convert.
3234 2023-03-22 Jason Merrill <jason@redhat.com>
3237 * semantics.cc (finish_id_expression_1): Check scope before
3238 returning id_expression.
3240 2023-03-22 Alex Coplan <alex.coplan@arm.com>
3243 * call.cc (build_over_call): Use make_temp_override to suppress
3244 both unavailable and deprecated warnings when calling
3247 2023-03-21 Jason Merrill <jason@redhat.com>
3250 * init.cc (maybe_instantiate_nsdmi_init): Don't leave
3251 current_function_decl set to a constructor.
3253 2023-03-20 Marek Polacek <polacek@redhat.com>
3256 * call.cc (add_template_candidate_real): Add explicit decls to the
3257 set of candidates when the initializer is a braced-init-list.
3259 2023-03-20 Jakub Jelinek <jakub@redhat.com>
3262 * cp-tree.h (var_needs_tls_wrapper): Declare.
3263 * decl2.cc (var_needs_tls_wrapper): No longer static.
3264 * decl.cc (cp_finish_decl): Clear TREE_READONLY on TLS variables
3265 for which a TLS wrapper will be needed.
3267 2023-03-17 Jason Merrill <jason@redhat.com>
3270 * lambda.cc (prune_lambda_captures): Don't bother in a template.
3272 2023-03-17 Jason Merrill <jason@redhat.com>
3275 * except.cc (build_throw): Check dtor access.
3277 2023-03-17 Jason Merrill <jason@redhat.com>
3280 * friend.cc (do_friend): Handle namespace as scope argument.
3281 * decl.cc (grokdeclarator): Pass down in_namespace.
3283 2023-03-16 Jason Merrill <jason@redhat.com>
3286 * init.cc (get_nsdmi): Split out...
3287 (maybe_instantiate_nsdmi_init): ...this function.
3288 * cp-tree.h: Declare it.
3289 * pt.cc (tsubst_expr): Use it.
3291 2023-03-16 Jason Merrill <jason@redhat.com>
3294 * pt.cc (tsubst_expr) [TAG_DEFN]: Handle partial instantiation.
3296 2023-03-16 Jason Merrill <jason@redhat.com>
3299 * semantics.cc (finish_qualified_id_expr): Don't try to build a
3300 pointer-to-member if the scope is an enumeration.
3302 2023-03-16 Patrick Palka <ppalka@redhat.com>
3305 * constexpr.cc (maybe_constant_init_1): For an unevaluated
3306 non-manifestly-constant operand, don't constant evaluate
3307 and instead call fold_to_constant as in maybe_constant_value.
3309 2023-03-16 Patrick Palka <ppalka@redhat.com>
3312 * constraint.cc (satisfaction_cache::get): Relax overly strict
3313 checking assert in the constraint recursion case.
3315 2023-03-16 Jason Merrill <jason@redhat.com>
3318 * coroutines.cc (build_co_await): Handle lvalue 'o'.
3320 2023-03-15 Jason Merrill <jason@redhat.com>
3324 * typeck.cc (cp_build_modify_expr): Allow array initialization of
3325 DECL_ARTIFICIAL variable.
3327 2023-03-15 Marek Polacek <polacek@redhat.com>
3330 * constexpr.cc (cxx_eval_store_expression): Strip location wrappers.
3332 2023-03-15 Jason Merrill <jason@redhat.com>
3335 * semantics.cc (check_template_template_default_arg): Check
3336 maybe_get_template_decl_from_type_decl.
3338 2023-03-15 Jason Merrill <jason@redhat.com>
3343 * pt.cc (coerce_template_template_parms): Use args from
3344 DECL_CONTEXT (arg_tmpl) instead of outer_args.
3346 2023-03-15 Jason Merrill <jason@redhat.com>
3349 * pt.cc (coerce_template_template_parms): Take the arg and parm
3351 (coerce_template_template_parm): Adjust.
3352 (template_template_parm_bindings_ok_p): Adjust.
3353 (convert_template_argument): Adjust.
3355 2023-03-14 Patrick Palka <ppalka@redhat.com>
3358 * pt.cc (push_inline_template_parms_recursive): Set
3359 TEMPLATE_PARMS_CONSTRAINTS.
3360 (push_template_decl): For an out-of-line declaration, verify
3361 constraints for each enclosing template scope match those of the
3362 original template declaratation.
3364 2023-03-14 Patrick Palka <ppalka@redhat.com>
3367 * pt.cc (redeclare_class_template): Add missing "of" in
3368 constraint mismatch diagnostic.
3369 (tsubst_friend_class): For an already declared class template,
3370 substitute and pass the friend declaration's constraints to
3371 redeclare_class_template instead of passing the existing
3372 template's constraints.
3374 2023-03-14 Jason Merrill <jason@redhat.com>
3377 * pt.cc (unify_pack_expansion): Check that TPARMS_PRIMARY_TEMPLATE
3380 2023-03-14 Jason Merrill <jason@redhat.com>
3383 * cp-gimplify.cc (genericize_if_stmt): Restore folding
3384 of constant conditions.
3386 2023-03-14 Jakub Jelinek <jakub@redhat.com>
3389 * tree.cc (record_has_unique_obj_representations): Ignore unnamed
3392 2023-03-13 Jason Merrill <jason@redhat.com>
3395 * parser.cc (cp_parser_set_decl_spec_type): Use
3396 redefined_builtin_type for extended_float_type_p.
3398 2023-03-13 Marek Polacek <polacek@redhat.com>
3401 * call.cc (reference_like_class_p): Check for std::span.
3403 2023-03-10 Jakub Jelinek <jakub@redhat.com>
3406 * decl.cc (cp_finish_decl): Don't clear TREE_READONLY on
3407 automatic non-aggregate variables just because of
3408 -fmerge-all-constants.
3410 2023-03-10 Jakub Jelinek <jakub@redhat.com>
3413 * class.cc (end_of_class): For bit-fields, instead of computing
3414 offset as sum of byte_position (field) and DECL_SIZE_UNIT (field),
3415 compute it as sum of bit_position (field) and DECL_SIZE (field)
3416 divided by BITS_PER_UNIT rounded up.
3418 2023-03-10 Jason Merrill <jason@redhat.com>
3421 * lambda.cc (compare_lambda_template_head): Check more
3422 for error_mark_node.
3424 2023-03-10 Jason Merrill <jason@redhat.com>
3427 * mangle.cc (anon_aggr_naming_decl): New.
3428 (write_unqualified_name): Use it.
3430 2023-03-10 Jakub Jelinek <jakub@redhat.com>
3433 * decl.cc (poplevel): Suppress OPT_Wunused_variable warning
3434 after diagnosing it.
3436 2023-03-10 Jason Merrill <jason@redhat.com>
3439 * decl.cc (grokdeclarator): Handle non-typedef typedef_decl.
3441 2023-03-10 Jason Merrill <jason@redhat.com>
3444 * class.cc (instantiate_type): Strip location wrapper.
3446 2023-03-09 Jason Merrill <jason@redhat.com>
3449 * init.cc (find_allocator_temps_r): New.
3450 (combine_allocator_temps): Replace find_allocator_temp.
3451 (build_vec_init): Adjust.
3453 2023-03-09 Jason Merrill <jason@redhat.com>
3457 * pt.cc (alias_ctad_tweaks): Continue after deduction failure.
3459 2023-03-09 Jason Merrill <jason@redhat.com>
3460 Michael Spertus <mike@spertus.com>
3463 * pt.cc (corresponding_template_parameter_list): Split out...
3464 (corresponding_template_parameter): ...from here.
3465 (find_template_parameters): Factor out...
3466 (find_template_parameter_info::find_in): ...this function.
3467 (find_template_parameter_info::find_in_recursive): New.
3468 (find_template_parameter_info::found): New.
3469 (alias_ctad_tweaks): Only add parms used in the deduced args.
3471 2023-03-09 Jason Merrill <jason@redhat.com>
3473 * cp-trait.def (IS_DEDUCIBLE): Add space to name.
3475 2023-03-09 Jason Merrill <jason@redhat.com>
3478 * cp-trait.def (IS_DEDUCIBLE): New.
3479 * cxx-pretty-print.cc (pp_cxx_trait): Handle non-type.
3480 * parser.cc (cp_parser_trait): Likewise.
3481 * tree.cc (cp_tree_equal): Likewise.
3482 * pt.cc (tsubst_copy_and_build): Likewise.
3483 (type_targs_deducible_from): New.
3484 (alias_ctad_tweaks): Use it.
3485 * semantics.cc (trait_expr_value): Handle CPTK_IS_DEDUCIBLE.
3486 (finish_trait_expr): Likewise.
3487 * constraint.cc (diagnose_trait_expr): Likewise.
3488 * cp-tree.h (type_targs_deducible_from): Declare.
3490 2023-03-07 Jason Merrill <jason@redhat.com>
3494 * pt.cc (tsubst_function_decl): Don't replace the closure
3495 parameter if DECL_STATIC_FUNCTION_P.
3497 2023-03-07 Marek Polacek <polacek@redhat.com>
3500 * call.cc (reference_like_class_p): New.
3501 (do_warn_dangling_reference): Add new bool parameter. See through
3502 reference_like_class_p.
3504 2023-03-07 Jakub Jelinek <jakub@redhat.com>
3507 * rtti.cc (emit_support_tinfo_1): Don't assert that last
3508 unemitted_tinfo_decls element is tinfo, instead pop from it only in
3510 * decl2.cc (c_parse_final_cleanups): Don't call emit_tinfo_decl
3511 for unemitted_tinfO_decls which have already non-NULL DECL_INITIAL.
3513 2023-03-07 Marek Polacek <polacek@redhat.com>
3516 * constexpr.cc (cxx_eval_call_expression): Relax assert.
3518 2023-03-07 Marek Polacek <polacek@redhat.com>
3521 * constexpr.cc (potential_constant_expression_1) <case CALL_EXPR>: Pass
3522 'any' when recursing on a VAR_DECL and not a pointer to function.
3524 2023-03-04 Jakub Jelinek <jakub@redhat.com>
3527 * constexpr.cc: Include toplev.h.
3528 (cxx_eval_constant_expression) <case DECL_EXPR>: When seeing a local
3529 static initialized by constant expression outside of a constexpr
3530 function which has been deferred by make_rtl_for_nonlocal_decl,
3531 call rest_of_decl_compilation on it.
3533 2023-03-03 Patrick Palka <ppalka@redhat.com>
3536 * pt.cc (el_data::skipped_trees): New data member.
3537 (extract_locals_r): Push to skipped_trees any unevaluated
3538 contexts that we skipped over.
3539 (extract_local_specs): For the second walk, start from each
3540 tree in skipped_trees.
3542 2023-03-03 Alexandre Oliva <oliva@adacore.com>
3544 * typeck.cc (cp_build_binary_op): Suppress redundant warning
3545 for pfn null test in pmfn test with vbit-in-delta.
3547 2023-03-02 Jakub Jelinek <jakub@redhat.com>
3550 * cp-tree.h (enum cp_tree_index): Remove CPTI_FALLBACK_DFLOAT*_TYPE
3552 (fallback_dfloat32_type, fallback_dfloat64_type,
3553 fallback_dfloat128_type): Remove.
3554 * rtti.cc (emit_support_tinfo_1): If not emitted already, call
3555 emit_tinfo_decl and remove from unemitted_tinfo_decls right away.
3556 (emit_support_tinfos): Move &dfloat*_type_node from fundamentals array
3557 into new fundamentals_with_fallback array. Call emit_support_tinfo_1
3558 on elements of that array too, with the difference that if
3559 the type is NULL, use a fallback REAL_TYPE for it temporarily.
3560 Drop the !targetm.decimal_float_supported_p () handling. Call
3561 targetm.emit_support_tinfos at the end.
3562 * mangle.cc (write_builtin_type): Remove references to
3563 fallback_dfloat*_type. Handle bfloat16_type_node mangling.
3565 2023-03-02 Patrick Palka <ppalka@redhat.com>
3569 * cp-gimplify.cc (cp_fully_fold): Add an internal overload that
3570 additionally takes and propagate an mce_value parameter, and
3571 define the existing public overload in terms of it.
3572 (cp_fully_fold_init): Pass mce_false to cp_fully_fold.
3574 2023-03-02 Patrick Palka <ppalka@redhat.com>
3577 * constexpr.cc (maybe_constant_init_1): Override
3578 manifestly_const_eval to true if is_static.
3580 2023-03-02 Jakub Jelinek <jakub@redhat.com>
3583 * cp-gimplify.cc (cp_genericize_r) <case USING_STMT>: Set
3584 DECL_SOURCE_LOCATION on IMPORTED_DECL to expression location
3585 of USING_STMT or input_location.
3587 2023-03-02 Marek Polacek <polacek@redhat.com>
3590 * parser.cc (class_decl_loc_t::diag_mismatched_tags): If the first
3591 lookup of SPEC didn't find anything, try to look for
3592 most_general_template.
3594 2023-03-02 Jakub Jelinek <jakub@redhat.com>
3597 * parser.cc (cp_convert_omp_range_for): Allow in assert
3598 decomp_first_name without DECL_HAS_VALUE_EXPR_P if it has
3599 error_mark_node type.
3600 (cp_finish_omp_range_for): Don't set DECL_HAS_VALUE_EXPR_P back
3601 on decls which have error_mark_node type.
3603 2023-03-01 Marek Polacek <polacek@redhat.com>
3606 * constexpr.cc (cxx_eval_constant_expression): Emit an error when
3607 a PTRMEM_CST cannot be evaluated.
3609 2023-03-01 Patrick Palka <ppalka@redhat.com>
3611 * pt.cc (tsubst_scope): Define.
3612 (tsubst_decl) <case USING_DECL>: Call tsubst_scope instead of
3613 calling tsubst_scope with tf_qualifying_scope set.
3614 (tsubst_qualified_id): Call tsubst_scope instead of
3615 calling tsubst with tf_qualifying_scope set.
3616 (tsubst_copy): Immediately delegate to tsubst for all TYPE_P
3617 trees. Remove tf_qualifying_scope manipulation.
3618 <case SCOPE_REF>: Call tsubst_scope instead of calling
3619 tsubst with tf_qualifying_scope set.
3621 2023-03-01 Patrick Palka <ppalka@redhat.com>
3622 Jason Merrill <jason@redhat.com>
3626 * constexpr.cc (fold_to_constant): Define.
3627 (maybe_constant_value): Move up early exit test for unevaluated
3628 operands. Try reducing an unevaluated operand to a constant via
3630 (fold_non_dependent_expr_template): Add early exit test for
3631 CONSTANT_CLASS_P nodes. Try reducing an unevaluated operand
3632 to a constant via fold_to_constant.
3633 * cp-tree.h (fold_to_constant): Declare.
3635 2023-03-01 Jakub Jelinek <jakub@redhat.com>
3638 * constexpr.cc (potential_constant_expression_1) <case DECL_EXPR>:
3639 Only recurse on DECL_INITIAL (tmp) if tmp is a VAR_DECL, otherwise
3642 2023-02-28 Patrick Palka <ppalka@redhat.com>
3645 * pt.cc (finish_template_variable): Move dependence check
3647 (lookup_and_finish_template_variable): ... here.
3648 * semantics.cc (finish_id_expression_1): Call
3649 finish_template_variable sooner, before (and regardless of) the
3650 type_dependent_expression_p test.
3652 2023-02-28 Marek Polacek <polacek@redhat.com>
3655 * pt.cc (lookup_and_finish_template_variable): Clear tf_partial.
3657 2023-02-20 Marek Polacek <polacek@redhat.com>
3660 * constexpr.cc (cxx_eval_call_expression): Replace shortcutting trivial
3661 constructor/op= with a checking assert.
3663 2023-02-20 Marek Polacek <polacek@redhat.com>
3666 * pt.cc (prepend_one_capture): Set LAMBDA_CAPTURE_EXPLICIT_P.
3667 (tsubst_lambda_expr): Pass LAMBDA_CAPTURE_EXPLICIT_P to
3668 prepend_one_capture.
3670 2023-02-18 Jason Merrill <jason@redhat.com>
3680 * semantics.cc (finish_static_assert): Don't diagnose in
3683 2023-02-17 Patrick Palka <ppalka@redhat.com>
3687 * cp-gimplify.cc (enum fold_flags): Define.
3688 (fold_flags_t): Declare.
3689 (cp_fold_data::genericize): Replace this data member with ...
3690 (cp_fold_data::fold_flags): ... this.
3691 (cp_fold_r): Adjust use of cp_fold_data and calls to cp_fold.
3692 (cp_fold_function): Likewise.
3693 (cp_fold_maybe_rvalue): Add an internal overload that
3694 additionally takes and propagates a fold_flags_t parameter, and
3695 define the existing public overload in terms of it.
3696 (cp_fold_rvalue): Likewise.
3697 (cp_fully_fold_init): Adjust use of cp_fold_data.
3698 (fold_cache): Replace with ...
3699 (fold_caches): ... this 2-element array of caches.
3700 (get_fold_cache): Define.
3701 (clear_fold_cache): Adjust.
3702 (cp_fold): Add fold_flags_t parameter. Use get_fold_cache.
3703 Pass flags to calls to cp_fold, cp_fold_rvalue and
3704 cp_fold_maybe_rvalue.
3705 <case CALL_EXPR>: If ff_mce_false is set, fold
3706 __builtin_is_constant_evaluated to false and pass mce_false to
3707 maybe_constant_value.
3709 2023-02-17 Patrick Palka <ppalka@redhat.com>
3711 * constexpr.cc (constexpr_call::manifestly_const_eval): Give
3712 it type int instead of bool.
3713 (constexpr_ctx::manifestly_const_eval): Give it type mce_value
3715 (cxx_eval_builtin_function_call): Adjust after making
3716 manifestly_const_eval tri-state.
3717 (cxx_eval_call_expression): Likewise.
3718 (cxx_eval_binary_expression): Likewise.
3719 (cxx_eval_conditional_expression): Likewise.
3720 (cxx_eval_constant_expression): Likewise.
3721 (cxx_eval_outermost_constant_expr): Likewise.
3722 (cxx_constant_value): Likewise.
3723 (cxx_constant_dtor): Likewise.
3724 (maybe_constant_value): Give manifestly_const_eval parameter
3725 type mce_value instead of bool and adjust accordingly.
3726 (fold_non_dependent_expr_template): Adjust call
3727 to cxx_eval_outermost_constant_expr.
3728 (fold_non_dependent_expr): Likewise.
3729 (maybe_constant_init_1): Likewise.
3730 * constraint.cc (satisfy_atom): Adjust call to
3731 maybe_constant_value.
3732 * cp-tree.h (enum class mce_value): Define.
3733 (maybe_constant_value): Adjust manifestly_const_eval parameter
3734 type and default argument.
3735 * decl.cc (compute_array_index_type_loc): Adjust call to
3736 maybe_constant_value.
3737 * pt.cc (convert_nontype_argument): Likewise.
3739 2023-02-16 Patrick Palka <ppalka@redhat.com>
3742 * cp-tree.h (enum tsubst_flags): New flag tf_qualifying_scope.
3743 * decl.cc (make_typename_type): Use lookup_member instead of
3744 lookup_field. If tf_qualifying_scope is set, pass want_type=true
3745 instead of =false to lookup_member. Generalize format specifier
3746 in diagnostic to handle both type and non-type bindings.
3747 * pt.cc (tsubst_aggr_type_1): Clear tf_qualifying_scope. Tidy
3749 (tsubst_decl) <case USING_DECL>: Set tf_qualifying_scope when
3750 substituting USING_DECL_SCOPE.
3751 (tsubst): Clear tf_qualifying_scope right away and remember if
3752 it was set. Do the same for tf_tst_ok sooner.
3753 <case TYPENAME_TYPE>: Set tf_qualifying_scope when substituting
3754 TYPE_CONTEXT. Pass tf_qualifying_scope to make_typename_type
3756 (tsubst_qualified_id): Set tf_qualifying_scope when substituting
3758 (tsubst_copy): Clear tf_qualifying_scope and remember if it was
3760 <case SCOPE_REF>: Set tf_qualifying_scope when substituting the
3762 <case *_TYPE>: Pass tf_qualifying_scope to tsubst if it was set.
3763 * search.cc (lookup_member): Document default argument.
3765 2023-02-16 Patrick Palka <ppalka@redhat.com>
3767 * cp-tree.h: Mechanically drop static from static inline
3768 functions via s/^static inline/inline/g.
3770 2023-02-15 Marek Polacek <polacek@redhat.com>
3773 * call.cc (joust_maybe_elide_copy): Return false for ck_ambig.
3775 2023-02-10 Marek Polacek <polacek@redhat.com>
3778 * call.cc (set_up_extended_ref_temp): Pass var to maybe_constant_init.
3780 2023-02-09 Tobias Burnus <tobias@codesourcery.com>
3782 * parser.cc (cp_parser_omp_allocate): Parse align
3783 clause and check for restrictions.
3785 2023-02-09 Jakub Jelinek <jakub@redhat.com>
3788 * mangle.cc (write_expression, write_template_arg): Handle
3789 EXCESS_PRECISION_EXPR with REAL_CST operand as
3790 write_template_arg_literal on fold_convert of the REAL_CST
3791 to EXCESS_PRECISION_EXPR type.
3793 2023-02-06 Patrick Palka <ppalka@redhat.com>
3796 * cp-tree.h (call_expr_dependent_name): Declare.
3797 * pt.cc (iterative_hash_template_arg) <case CALL_EXPR>: Use
3798 call_expr_dependent_name instead of dependent_name.
3799 * tree.cc (call_expr_dependent_name): Define.
3800 (called_fns_equal): Adjust to take two CALL_EXPRs instead of
3801 CALL_EXPR_FNs thereof. Use call_expr_dependent_name instead
3803 (cp_tree_equal) <case CALL_EXPR>: Adjust call to called_fns_equal.
3805 2023-02-03 Marek Polacek <polacek@redhat.com>
3808 * constexpr.cc (cxx_eval_array_reference): Don't replace
3811 2023-02-03 Patrick Palka <ppalka@redhat.com>
3814 * semantics.cc (finish_call_expr): Strip ADDR_EXPR from
3815 the selected callee during overload set pruning.
3817 2023-02-03 Patrick Palka <ppalka@redhat.com>
3820 * class.cc (check_methods): Diagnose an unviable OVERLOAD
3821 set for CLASSTYPE_DESTRUCTOR differently from an ambiguous one.
3822 Then prune the OVERLOAD to a single function.
3823 (check_bases_and_members): Handle CLASSTYPE_DESTRUCTOR being
3824 an OVERLOAD when calling deduce_noexcept_on_destructor.
3825 Document why it has to be called before check_methods.
3827 2023-02-03 Patrick Palka <ppalka@redhat.com>
3830 * class.cc (check_methods): Swap order of constraints_satisfied_p
3831 and copy/move_fn_p tests.
3833 2023-02-01 Marek Polacek <polacek@redhat.com>
3836 * call.cc (build_new_op): Don't call warn_logical_operator when
3837 processing a template.
3839 2023-02-01 Jakub Jelinek <jakub@redhat.com>
3842 * constexpr.cc (cxx_eval_constant_expression): Handle OMP_*
3843 and OACC_* constructs as non-constant.
3844 (potential_constant_expression_1): Handle OMP_SCAN and OMP_SCOPE.
3846 2023-02-01 Jason Merrill <jason@redhat.com>
3848 * class.cc (note_name_declared_in_class): Change from permerror to
3849 -Wchanges-meaning pedwarn, forcing -pedantic-errors for most cases.
3851 2023-01-31 Jason Merrill <jason@redhat.com>
3854 * cp-gimplify.cc (any_non_eliding_target_exprs): New.
3855 (cp_genericize_init): Check it.
3857 2023-01-31 Marek Polacek <polacek@redhat.com>
3861 * cp-tree.h (instantiation_dependent_expression_p): Don't
3864 2023-01-26 Marek Polacek <polacek@redhat.com>
3867 * parser.cc: Remove unnecessary forward declarations.
3868 (cp_parser_string_literal): New wrapper.
3869 (cp_parser_string_literal_common): Renamed from
3870 cp_parser_string_literal. Add a bool parameter. Give an error when
3871 UDLs are not permitted.
3872 (cp_parser_userdef_string_literal): New wrapper.
3873 (finish_userdef_string_literal): Renamed from
3874 cp_parser_userdef_string_literal.
3875 (cp_parser_primary_expression): Call cp_parser_userdef_string_literal
3876 instead of cp_parser_string_literal.
3877 (cp_parser_linkage_specification): Move a variable declaration closer
3879 (cp_parser_static_assert): Likewise.
3880 (cp_parser_operator): Call cp_parser_userdef_string_literal instead of
3881 cp_parser_string_literal.
3882 (cp_parser_asm_definition): Move a variable declaration closer to its
3884 (cp_parser_asm_specification_opt): Move variable declarations closer to
3886 (cp_parser_asm_operand_list): Likewise.
3887 (cp_parser_asm_clobber_list): Likewise.
3889 2023-01-26 Jakub Jelinek <jakub@redhat.com>
3892 * parser.cc (cp_convert_omp_range_for): If cp_finish_decomp has been
3893 called in !processing_template_decl with processing_template_decl
3894 temporarily set, clear DECL_HAS_VALUE_EXPR_P on the vars temporarily.
3895 (cp_finish_omp_range_for): And set it back again here.
3897 2023-01-25 Jakub Jelinek <jakub@redhat.com>
3900 * mangle.cc (write_closure_type_name): Don't assume all
3901 lambda operator() fns are methods.
3903 2023-01-24 Jason Merrill <jason@redhat.com>
3906 * parser.cc (cp_lexer_new_main): Pass C_LEX_STRING_NO_JOIN for first
3909 2023-01-24 Jason Merrill <jason@redhat.com>
3912 * pt.cc (tsubst_function_decl): Handle static lambda.
3914 2023-01-24 Jakub Jelinek <jakub@redhat.com>
3917 * cp-gimplify.cc (cp_fold_r): Revert 2023-01-19 changes.
3919 2023-01-24 Jason Merrill <jason@redhat.com>
3923 * cp-gimplify.cc (cp_fold_r) [TARGET_EXPR]: In case of double
3924 TARGET_EXPR, keep the outer one instead of the inner one.
3925 (maybe_replace_decl): New.
3927 2023-01-23 Jason Merrill <jason@redhat.com>
3930 * cp-gimplify.cc (cp_gimplify_init_expr): Allow unexpected elision
3933 2023-01-23 Marek Polacek <polacek@redhat.com>
3936 * cvt.cc (ocp_convert): copy_warning when creating a new
3938 * init.cc (build_new_1): Suppress -Wunused-value on
3939 compiler-generated COMPOUND_EXPRs.
3941 2023-01-23 Jason Merrill <jason@redhat.com>
3944 * call.cc (build_user_type_conversion_1): Check whether the
3945 iterators also find a list ctor.
3947 2023-01-23 Jason Merrill <jason@redhat.com>
3950 * decl.cc (grokdeclarator): Check whether DECL_RESULT is already
3953 2023-01-23 Jason Merrill <jason@redhat.com>
3957 * call.cc (extend_ref_init_temps_1): Handle ptrmem expression.
3959 2023-01-19 Jakub Jelinek <jakub@redhat.com>
3962 * cp-tree.h (keep_unused_object_arg): Declare.
3963 * call.cc (keep_unused_object_arg): No longer static.
3964 * tree.cc (build_min_non_dep_op_overload): Handle ARRAY_REF
3965 with overload being static member function.
3967 2023-01-19 Jakub Jelinek <jakub@redhat.com>
3970 * cp-gimplify.cc (cp_fold_r): During cp_fully_fold_init replace
3971 DECL_ANON_UNION_VAR_P VAR_DECLs with their corresponding
3974 2023-01-16 Jakub Jelinek <jakub@redhat.com>
3977 * decl.cc (cp_finish_decl): Check warning_enabled_at
3978 at the DECL_SOURCE_LOCATION (decl) for OPT_Winit_self instead
3981 2023-01-14 Jakub Jelinek <jakub@redhat.com>
3984 * typeck.cc (cp_build_binary_op): Use may_shorten_divmod for integral
3987 2023-01-13 Jakub Jelinek <jakub@redhat.com>
3990 * cvt.cc (cp_convert_and_check): For EXCESS_PRECISION_EXPR
3991 use its operand except that for warning purposes use the original
3992 EXCESS_PRECISION_EXPR.
3993 * call.cc (convert_like_internal): Only look through
3994 EXCESS_PRECISION_EXPR when calling cp_convert, not when calling
3995 cp_convert_and_check.
3997 2023-01-09 Jakub Jelinek <jakub@redhat.com>
4002 * call.cc (maybe_init_list_as_range): Always return NULL_TREE if
4003 processing_template_decl.
4005 2023-01-05 Patrick Palka <ppalka@redhat.com>
4008 * parser.cc (cp_parser_class_head): Use dk_deferred instead of
4009 dk_no_check when parsing the class name.
4011 2023-01-05 Jakub Jelinek <jakub@redhat.com>
4014 * semantics.cc (finish_omp_target_clauses): Ignore clauses other than
4017 2023-01-04 Patrick Palka <ppalka@redhat.com>
4020 * decl2.cc (mark_single_function): Ignore mark_used failure
4021 only in a non-SFINAE context rather than in a SFINAE one.
4023 2023-01-04 Jakub Jelinek <jakub@redhat.com>
4026 * decl.cc (merge_default_template_args): Return false if either
4027 new_parm or old_parm are erroneous.
4030 Copyright (C) 2023 Free Software Foundation, Inc.
4032 Copying and distribution of this file, with or without modification,
4033 are permitted in any medium without royalty provided the copyright
4034 notice and this notice are preserved.