1 2023-12-05 Jakub Jelinek <jakub@redhat.com>
4 * cp-tree.h (cp_check_pragma_unroll): Declare.
5 * semantics.cc (cp_check_pragma_unroll): New function.
6 * parser.cc (cp_parser_pragma_unroll): Use cp_check_pragma_unroll.
7 * pt.cc (tsubst_expr) <case ANNOTATE_EXPR>: Likewise.
8 (tsubst_stmt) <case RANGE_FOR_STMT>: Likwsie.
10 2023-12-05 Richard Sandiford <richard.sandiford@arm.com>
12 * tree.cc (cxx_gnu_attribute_table): Add extra braces to work
13 around PR 16333 in older compilers.
15 2023-12-05 Jakub Jelinek <jakub@redhat.com>
18 * parser.cc (cp_parser_block_declaration): Implement C++ DR 2262
19 - Attributes for asm-definition. Call cp_parser_asm_definition
20 even if RID_ASM token is only seen after sequence of standard
22 (cp_parser_asm_definition): Parse standard attributes before
23 RID_ASM token and warn for them with -Wattributes.
25 2023-12-05 Marek Polacek <polacek@redhat.com>
29 * call.cc (in_immediate_context): No longer static.
30 * constexpr.cc (cxx_eval_call_expression): Adjust assert.
31 * cp-gimplify.cc (deferred_escalating_exprs): New vec.
32 (remember_escalating_expr): New.
33 (enum fold_flags): Remove ff_fold_immediate.
34 (immediate_escalating_function_p): New.
35 (unchecked_immediate_escalating_function_p): New.
36 (promote_function_to_consteval): New.
37 (cp_fold_immediate): Move above. Return non-null if any errors were
39 (maybe_explain_promoted_consteval): New.
40 (cp_gimplify_expr) <case CALL_EXPR>: Assert we've handled all
41 immediate invocations.
42 (taking_address_of_imm_fn_error): New.
43 (cp_fold_immediate_r): Merge ADDR_EXPR and PTRMEM_CST cases. Implement
44 P2564 - promoting functions to consteval.
45 <case CALL_EXPR>: Implement P2564 - promoting functions to consteval.
46 (cp_fold_r): If an expression turns into a CALL_EXPR after cp_fold,
47 call cp_fold_immediate_r on the CALL_EXPR.
48 (cp_fold_function): Set DECL_ESCALATION_CHECKED_P if
49 deferred_escalating_exprs does not contain current_function_decl.
50 (process_and_check_pending_immediate_escalating_fns): New.
51 * cp-tree.h (struct lang_decl_fn): Add escalated_p bit-field.
52 (DECL_ESCALATION_CHECKED_P): New.
53 (immediate_invocation_p): Declare.
54 (process_pending_immediate_escalating_fns): Likewise.
55 * decl2.cc (c_parse_final_cleanups): Set at_eof to 2 after all
56 templates have been instantiated; and to 3 at the end of the function.
57 Call process_pending_immediate_escalating_fns.
58 * error.cc (dump_template_bindings): Check at_eof against an updated
60 * module.cc (trees_out::lang_decl_bools): Stream escalated_p.
61 (trees_in::lang_decl_bools): Likewise.
62 * pt.cc (push_tinst_level_loc): Set at_eof to 3, not 2.
63 * typeck.cc (cp_build_addr_expr_1): Don't check
64 DECL_IMMEDIATE_FUNCTION_P.
66 2023-12-04 Jason Merrill <jason@redhat.com>
68 * constexpr.cc (potential_constant_expression_1): Fix
69 check for loading volatile lvalue.
71 2023-12-04 Jakub Jelinek <jakub@redhat.com>
74 * cp-tree.h (cp_convert_range_for): Change UNROLL type from
75 unsigned short to tree.
76 (finish_while_stmt_cond, finish_do_stmt, finish_for_cond): Likewise.
77 * parser.cc (cp_parser_statement): Pass NULL_TREE rather than 0 to
78 cp_parser_iteration_statement UNROLL argument.
79 (cp_parser_for, cp_parser_c_for): Change UNROLL type from
80 unsigned short to tree.
81 (cp_parser_range_for): Likewise. Set RANGE_FOR_UNROLL to just UNROLL
82 rather than build_int_cst from it.
83 (cp_convert_range_for, cp_parser_iteration_statement): Change UNROLL
84 type from unsigned short to tree.
85 (cp_parser_omp_loop_nest): Pass NULL_TREE rather than 0 to
86 cp_parser_range_for UNROLL argument.
87 (cp_parser_pragma_unroll): Return tree rather than unsigned short.
88 If parsed expression is type dependent, just return it, don't diagnose
89 issues with value if it is value dependent.
90 (cp_parser_pragma): Change UNROLL type from unsigned short to tree.
91 * semantics.cc (finish_while_stmt_cond): Change UNROLL type from
92 unsigned short to tree. Build ANNOTATE_EXPR with UNROLL as its last
93 operand rather than build_int_cst from it.
94 (finish_do_stmt, finish_for_cond): Likewise.
95 * pt.cc (tsubst_stmt) <case RANGE_FOR_STMT>: Change UNROLL type from
96 unsigned short to tree and set it to RECUR on RANGE_FOR_UNROLL (t).
97 (tsubst_expr) <case ANNOTATE_EXPR>: For annot_expr_unroll_kind repeat
98 checks on UNROLL value from cp_parser_pragma_unroll.
100 2023-12-02 Richard Sandiford <richard.sandiford@arm.com>
102 * cp-tree.h (cxx_attribute_table): Delete.
103 (cxx_gnu_attribute_table, std_attribute_table): Declare.
104 * cp-objcp-common.h (LANG_HOOKS_COMMON_ATTRIBUTE_TABLE): Delete.
105 (LANG_HOOKS_FORMAT_ATTRIBUTE_TABLE): Delete.
106 (cp_objcp_attribute_table): New table.
107 (LANG_HOOKS_ATTRIBUTE_TABLE): Redefine.
108 * tree.cc (cxx_attribute_table): Replace with...
109 (cxx_gnu_attributes, cxx_gnu_attribute_table): ...these globals.
110 (std_attribute_table): Change type to scoped_attribute_specs, using...
111 (std_attributes): ...this as the underlying array.
112 (init_tree): Remove call to register_scoped_attributes.
114 2023-12-01 Jason Merrill <jason@redhat.com>
116 * mangle.cc (write_type): Mangle placeholder as its template.
118 2023-12-01 Jason Merrill <jason@redhat.com>
120 * cp-tree.h (TEMPLATE_ARGS_TYPE_CONSTRAINT_P): New.
121 (get_concept_check_template): Declare.
122 * constraint.cc (combine_constraint_expressions)
123 (finish_shorthand_constraint): Use UNKNOWN_LOCATION.
124 * pt.cc (convert_generic_types_to_packs): Likewise.
125 * mangle.cc (write_constraint_expression)
126 (write_tparms_constraints, write_type_constraint)
127 (template_parm_natural_p, write_requirement)
128 (write_requires_expr): New.
129 (write_encoding): Mangle trailing requires-clause.
130 (write_name): Pass parms to write_template_args.
131 (write_template_param_decl): Factor out from...
132 (write_closure_template_head): ...here.
133 (write_template_args): Mangle non-natural parms
135 (write_expression): Handle REQUIRES_EXPR.
137 2023-12-01 Jason Merrill <jason@redhat.com>
139 * semantics.cc (finish_non_static_data_member)
140 (finish_decltype_type, capture_decltype):
141 Handle deduced closure parameter.
143 2023-11-30 Marek Polacek <polacek@redhat.com>
146 * typeck.cc (finish_class_member_access_expr): When accessing
147 a static data member, use ba_any for lookup_base.
149 2023-11-30 Jakub Jelinek <jakub@redhat.com>
152 * cp-tree.h: Implement C++26 P2169R4 - Placeholder variables with no
154 (OVL_NAME_INDEPENDENT_DECL_P): Define.
155 (add_capture): Add unsigned * argument.
156 (name_independent_decl_p): New inline function.
157 * name-lookup.cc (class name_lookup): Make ambiguous and
158 add_value members public.
159 (name_independent_linear_search): New function.
160 (get_class_binding_direct): Handle member_vec_binary_search
161 returning OVL_NAME_INDEPENDENT_DECL_P OVERLOAD. Use
162 name_independent_linear_search rather than fields_linear_search
163 for linear lookup of _ name if !want_type.
164 (member_name_cmp): Sort name-independent declarations first.
165 (member_vec_dedup): Handle name-independent declarations.
166 (pop_local_binding): Handle binding->value being a TREE_LIST for
167 ambiguous name-independent declarations.
168 (supplement_binding): Handle name-independent declarations.
169 (update_binding): Likewise.
170 (check_local_shadow): Return tree rather than void, normally
171 NULL_TREE but old for name-independent declarations which used
172 to conflict with outer scope declaration. Don't emit -Wshadow*
173 warnings for name-independent declarations.
174 (pushdecl): Handle name-independent declarations.
175 * search.cc (lookup_field_r): Handle nval being a TREE_LIST.
176 * lambda.cc (build_capture_proxy): Adjust for ___.<number>
178 (add_capture): Add NAME_INDEPENDENT_CNT argument. Use ___.<number>
179 name rather than ___ for second and following capture with
181 (add_default_capture): Adjust add_capture caller.
182 * decl.cc (poplevel): Don't warn about name-independent declarations.
183 (duplicate_decls): If in C++26 a _ named declaration conflicts with
184 earlier declarations, emit explaining note why the new declaration
185 is not name-independent.
186 (reshape_init_class): If field is a TREE_LIST, emit an ambiguity
187 error with list of candidates rather than error about non-existing
188 non-static data member.
189 * parser.cc (cp_parser_lambda_introducer): Adjust add_capture callers.
190 Allow name-independent capture redeclarations.
191 (cp_parser_decomposition_declaration): Set decl_specs.storage_class
192 to sc_static for static structured bindings.
193 * pt.cc (tsubst_lambda_expr): Adjust add_capture caller.
195 2023-11-30 Alexandre Oliva <oliva@adacore.com>
197 * decl.cc (finish_enum_value_list): Set TYPE_PACKED if
198 use_short_enum, and propagate it to variants.
200 2023-11-30 Jason Merrill <jason@redhat.com>
202 * cp-tree.h (LAMBDA_EXPR_MUTABLE_P): Remove.
203 * cp-tree.def: Remove documentation.
204 * lambda.cc (build_lambda_expr): Remove reference.
205 * parser.cc (cp_parser_lambda_declarator_opt): Likewise.
206 * pt.cc (tsubst_lambda_expr): Likewise.
207 * ptree.cc (cxx_print_lambda_node): Likewise.
208 * semantics.cc (capture_decltype): Get the object quals
209 from the object instead.
211 2023-11-29 Marek Polacek <polacek@redhat.com>
214 * constexpr.cc (cxx_eval_constant_expression) <case PARM_DECL>: Allow
215 reference to unknown/this as per P2280.
216 <case VAR_DECL>: Allow reference to unknown as per P2280.
218 2023-11-29 Patrick Palka <ppalka@redhat.com>
221 * pt.cc (tsubst_expr) <case MODOP_EXPR>: Look through implicit
222 INDIRECT_REF when propagating -Wparentheses warning suppression.
223 * semantics.cc (maybe_warn_unparenthesized_assignment): Replace
224 REFERENCE_REF_P handling with STRIP_REFERENCE_REF.
225 (finish_parenthesized_expr): Likewise.
227 2023-11-29 Jakub Jelinek <jakub@redhat.com>
229 * semantics.cc (finish_static_assert): Free buf on error return.
231 2023-11-29 Alexandre Oliva <oliva@adacore.com>
233 * decl.cc (maybe_prepare_return_this): Split out of...
234 (maybe_return_this): ... this.
235 * cp-tree.h (maybe_prepare_return_this): Declare.
236 * class.cc (build_clone): Call it.
238 2023-11-29 Alexandre Oliva <oliva@adacore.com>
240 * contracts.cc (check_postcondition_result): Cope with
243 2023-11-28 Jason Merrill <jason@redhat.com>
247 * call.cc (convert_like_internal): Remove obsolete comment.
248 * typeck.cc (decay_conversion): Allow array prvalue.
249 (maybe_warn_about_returning_address_of_local): Check
250 for returning pointer to temporary.
252 2023-11-28 Jakub Jelinek <jakub@redhat.com>
254 * cp-objcp-common.cc (cp_feature_table): Evaluate
255 __has_extension (cxx_init_captures) to 1 even for -std=c++11.
257 2023-11-27 Alex Coplan <alex.coplan@arm.com>
258 Iain Sandoe <iain@sandoe.co.uk>
261 * cp-lang.cc (c_family_register_lang_features): New.
262 * cp-objcp-common.cc (struct cp_feature_selector): New.
263 (cp_feature_selector::has_feature): New.
264 (struct cp_feature_info): New.
265 (cp_register_features): New.
266 * cp-objcp-common.h (cp_register_features): New.
268 2023-11-25 Nathaniel Shead <nathanieloshead@gmail.com>
270 * name-lookup.cc (check_can_export_using_decl): New.
271 (do_nonmember_using_decl): Use above to check if names can be
274 2023-11-25 Nathaniel Shead <nathanieloshead@gmail.com>
277 * decl.cc (duplicate_decls): Allow exporting a redeclaration of
280 2023-11-24 Tobias Burnus <tobias@codesourcery.com>
282 * parser.cc (cp_parser_omp_clause_dist_schedule,
283 cp_parser_omp_scan_loop_body, cp_parser_omp_assumption_clauses,
284 cp_parser_omp_depobj): Add OPT_Wopenmp to warning_at.
285 * semantics.cc (finish_omp_clauses): Likewise.
287 2023-11-24 Tobias Burnus <tobias@codesourcery.com>
289 * parser.cc (cp_parser_omp_depobj): Accept optionally an argument
290 to the destroy clause.
292 2023-11-24 Nathaniel Shead <nathanieloshead@gmail.com>
295 * decl.cc (grokvardecl): Don't mark variables attached to
298 2023-11-24 Nathaniel Shead <nathanieloshead@gmail.com>
301 * module.cc (trees_out::get_merge_kind): Handle lambdas in class
303 (maybe_key_decl): Remove assertion and fix whitespace.
305 2023-11-24 Nathaniel Shead <nathanieloshead@gmail.com>
308 * decl.cc (duplicate_decls): Adjust error message.
309 (xref_tag): Adjust error message. Check exporting decl that is
310 already declared as non-exporting.
312 2023-11-23 Jakub Jelinek <jakub@redhat.com>
315 * parser.cc: Implement C++26 P2741R3 - user-generated static_assert
317 (cp_parser_static_assert): Parse message argument as
318 conditional-expression if it is not a pure string literal or
319 several of them concatenated followed by closing paren.
320 * semantics.cc (finish_static_assert): Handle message which is not
321 STRING_CST. For condition with bare parameter packs return early.
322 * pt.cc (tsubst_expr) <case STATIC_ASSERT>: Also tsubst_expr
323 message and make sure that if it wasn't originally STRING_CST, it
324 isn't after tsubst_expr either.
326 2023-11-22 Patrick Palka <ppalka@redhat.com>
329 * pt.cc (tsubst_aggr_type): Handle empty TYPE_TEMPLATE_INFO
330 in the entering_scope adjustment.
332 2023-11-22 Jason Merrill <jason@redhat.com>
334 * decl.cc (start_preparsed_function): Clarify ctype logic.
336 2023-11-20 Marc Poulhiès <dkm@kataplop.net>
338 * lambda.cc (compare_lambda_sig): Fix typo in variadic.
340 2023-11-20 Jason Merrill <jason@redhat.com>
342 * pt.cc (comp_template_parms): Just one level.
343 (template_parameter_lists_equivalent_p): Likewise.
345 2023-11-20 Jason Merrill <jason@redhat.com>
347 * cp-tree.h (DECL_TEMPLATE_PARM_CHECK): New.
348 (DECL_IMPLICIT_TEMPLATE_PARM_P): New.
349 (decl_template_parm_check): New.
350 * mangle.cc (write_closure_template_head): Use it.
351 * parser.cc (synthesize_implicit_template_parm): Likewise.
352 * pt.cc (template_parameters_equivalent_p): Likewise.
354 2023-11-19 Nathaniel Shead <nathanieloshead@gmail.com>
357 * cp-tree.h (enum cp_tree_index): Add CPTI_THREAD_ATEXIT.
358 (thread_atexit_node): New.
359 * decl.cc (get_thread_atexit_node): Cache in thread_atexit_node.
361 2023-11-19 David Malcolm <dmalcolm@redhat.com>
363 * mapper-client.cc: Include "rich-location.h".
365 2023-11-16 Jakub Jelinek <jakub@redhat.com>
368 * class.cc (layout_class_type): Don't
369 SET_DECL_FIELD_CXX_ZERO_WIDTH_BIT_FIELD on FIELD_DECLs with
370 error_mark_node type.
372 2023-11-16 Patrick Palka <ppalka@redhat.com>
376 * constexpr.cc (potential_constant_expression_1) <case CALL_EXPR>:
377 Fix FUNCTION_POINTER_TYPE_P test.
379 2023-11-16 Marek Polacek <polacek@redhat.com>
382 * parser.cc (cp_parser_direct_declarator): Maybe call
383 abort_fully_implicit_template if it turned out the parameter list was
386 2023-11-15 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
388 * tree.cc (build_cplus_array_type): Revert using the macro
391 2023-11-15 Patrick Palka <ppalka@redhat.com>
394 * decl.cc (is_direct_enum_init): Check type-dependence of the
397 2023-11-15 Patrick Palka <ppalka@redhat.com>
400 * tree.cc (strip_typedefs_expr) <case TREE_LIST>: Handle
401 non-empty TREE_PURPOSE.
403 2023-11-15 Patrick Palka <ppalka@redhat.com>
406 * tree.cc (build_min_non_dep): Propagate TREE_SIDE_EFFECTS from
407 the original arguments.
408 (build_min_non_dep_call_vec): Likewise.
409 * typeck2.cc (build_m_component_ref): Use cp_convert, build2 and
410 cp_fully_fold instead of fold_build_pointer_plus and fold_convert.
411 Don't build the POINTER_PLUS_EXPR in a template context.
413 2023-11-15 Patrick Palka <ppalka@redhat.com>
417 * constexpr.cc (potential_constant_expression_1) <case VAR_DECL>:
418 Only consider var_in_maybe_constexpr_fn if 'now' is false.
419 <case INDIRECT_REF>: Likewise.
421 2023-11-15 Jakub Jelinek <jakub@redhat.com>
423 * typeck.cc: Implement C++26 P2864R2 - Remove Deprecated Arithmetic
424 Conversion on Enumerations From C++26.
425 (do_warn_enum_conversions): Return bool rather than void, add COMPLAIN
426 argument. Use pedwarn rather than warning_at for C++26 and remove
427 " is deprecated" part of the diagnostics in that case. For SFINAE
428 in C++26 return true on newly erroneous cases.
429 (cp_build_binary_op): For C++26 call do_warn_enum_conversions
430 unconditionally, pass complain argument to it and if it returns true,
431 return error_mark_node.
432 * call.cc (build_conditional_expr): Use pedwarn rather than warning_at
433 for C++26 and remove " is deprecated" part of the diagnostics in that
434 case and check for complain & tf_warning_or_error. Use emit_diagnostic
435 with cxx_dialect >= cxx26 ? DK_PEDWARN : DK_WARNING. For SFINAE in
436 C++26 return error_mark_node on newly erroneous cases.
437 (build_new_op): Use emit_diagnostic with cxx_dialect >= cxx26
438 ? DK_PEDWARN : DK_WARNING and complain & tf_warning_or_error check
439 for C++26. For SFINAE in C++26 return error_mark_node on newly
442 2023-11-14 Nathaniel Shead <nathanieloshead@gmail.com>
445 * module.cc (trees_out::decl_node): Write DECL_VINDEX for
447 (trees_in::tree_node): Read DECL_VINDEX for virtual clones.
449 2023-11-14 Nathaniel Shead <nathanieloshead@gmail.com>
452 * name-lookup.cc (do_nonmember_using_decl): Handle
453 TEMPLATE_DECLs when checking module attachment.
455 2023-11-14 David Malcolm <dmalcolm@redhat.com>
457 * decl.cc (finish_function): Update call to
458 global_dc->m_option_enabled to use option_enabled_p.
460 2023-11-14 David Malcolm <dmalcolm@redhat.com>
462 * contracts.cc (build_comment): Use global_dc's file_cache.
464 2023-11-14 Jonathan Wakely <jwakely@redhat.com>
468 * call.cc (convert_like_internal): Use OPT_Wnarrowing for
469 pedwarns about illformed conversions involving extended
470 floating-point types. Clarify that ISO C++ requires these
473 2023-11-14 Jakub Jelinek <jakub@redhat.com>
476 * call.cc (magic_varargs_p): Return 4 for
477 BUILT_IN_{CLZ,CTZ,CLRSB,FFS,PARITY,POPCOUNT}G.
478 (build_over_call): Don't promote first argument of
479 BUILT_IN_{CLZ,CTZ,CLRSB,FFS,PARITY,POPCOUNT}G.
480 * cp-gimplify.cc (cp_gimplify_expr): For BUILT_IN_C{L,T}ZG use
483 2023-11-10 Patrick Palka <ppalka@redhat.com>
486 * cp-tree.h (STRIP_REFERENCE_REF): Define.
487 * semantics.cc (outer_var_p): Assert REFERENCE_REF_P is false.
488 (finish_decltype_type): Look through implicit INDIRECT_REF when
489 deciding whether to call capture_decltype.
491 2023-11-10 Patrick Palka <ppalka@redhat.com>
495 * semantics.cc (finish_decltype_type): Handle an id-expression
496 naming a capture proxy specially.
498 2023-11-07 Kwok Cheung Yeung <kcy@codesourcery.com>
500 * cp-tree.h (cp_omp_declare_target_attr): Add indirect field.
501 * decl2.cc (cplus_decl_attributes): Add attribute for indirect
503 * parser.cc (cp_parser_omp_clause_name): Handle indirect clause.
504 (cp_parser_omp_clause_indirect): New.
505 (cp_parser_omp_all_clauses): Handle indirect clause.
506 (handle_omp_declare_target_clause): Add extra parameter. Add
507 indirect attribute for indirect functions.
508 (OMP_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
509 (cp_parser_omp_declare_target): Handle indirect clause. Emit error
510 message if device_type or indirect clauses used alone. Emit error
511 if indirect clause used with device_type that is not 'any'.
512 (OMP_BEGIN_DECLARE_TARGET_CLAUSE_MASK): Add indirect clause to mask.
513 (cp_parser_omp_begin): Handle indirect clause.
514 * semantics.cc (finish_omp_clauses): Handle indirect clause.
516 2023-11-04 Jakub Jelinek <jakub@redhat.com>
518 * parser.h (struct cp_parser): Adjust comment on omp_attrs_forbidden_p
520 * parser.cc (cp_parser_omp_section_scan): Allow __directive__ spelling.
522 2023-11-04 David Malcolm <dmalcolm@redhat.com>
524 * call.cc: Update for changes to diagnostic_context.
525 * class.cc: Likewise.
527 * error.cc: Likewise.
528 * except.cc: Likewise.
531 2023-11-02 Jason Merrill <jason@redhat.com>
533 * semantics.cc (nrv_data): Change visited to hash_set.
534 (finalize_nrv_r): Reorganize.
536 2023-11-02 Jason Merrill <jason@redhat.com>
541 * except.cc (maybe_splice_retval_cleanup): Clear
542 current_retval_sentinel when destroying retval.
543 * semantics.cc (nrv_data): Add in_nrv_cleanup.
544 (finalize_nrv): Set it.
545 (finalize_nrv_r): Fix handling of throwing cleanups.
547 2023-11-02 Jakub Jelinek <jakub@redhat.com>
550 * parser.cc: Implement C++26 P2361R6 - Unevaluated strings.
551 (uneval_string_attr): New enumerator.
552 (cp_parser_string_literal_common): Add UNEVAL argument. If true,
553 pass CPP_UNEVAL_STRING rather than CPP_STRING to
554 cpp_interpret_string_notranslate.
555 (cp_parser_string_literal, cp_parser_userdef_string_literal): Adjust
556 callers of cp_parser_string_literal_common.
557 (cp_parser_unevaluated_string_literal): New function.
558 (cp_parser_parenthesized_expression_list): Handle uneval_string_attr.
559 (cp_parser_linkage_specification): Use
560 cp_parser_unevaluated_string_literal for C++26.
561 (cp_parser_static_assert): Likewise.
562 (cp_parser_std_attribute): Use uneval_string_attr for standard
563 deprecated and nodiscard attributes.
565 2023-10-31 David Malcolm <dmalcolm@redhat.com>
567 * module.cc (ordinary_loc_of): Update for removal of
568 MACRO_MAP_EXPANSION_POINT_LOCATION.
569 (module_state::note_location): Update for renaming of field.
570 (module_state::write_macro_maps): Likewise.
572 2023-10-27 Patrick Palka <ppalka@redhat.com>
575 * init.cc (build_new_1): Remove unnecessary call to convert
576 on 'nelts'. Use build2 instead of fold_build2 for
577 'outer_nelts_checks'.
579 2023-10-27 Patrick Palka <ppalka@redhat.com>
581 * cp-tree.h (maybe_warn_unparenthesized_assignment): Declare.
582 * semantics.cc (is_assignment_op_expr_p): Generalize to return
583 true for any assignment operator expression, not just one that
584 has been resolved to an operator overload.
585 (maybe_warn_unparenthesized_assignment): Factored out from ...
586 (maybe_convert_cond): ... here.
587 (finish_parenthesized_expr): Mention
588 maybe_warn_unparenthesized_assignment.
589 * typeck.cc (convert_for_assignment): Replace -Wparentheses
590 warning logic with maybe_warn_unparenthesized_assignment.
592 2023-10-27 Lewis Hyatt <lhyatt@gmail.com>
594 PR preprocessor/87299
595 * parser.cc (cp_lexer_new_main): Call c_reset_target_pragmas ()
596 after preprocessing is complete, before starting compilation.
598 2023-10-26 liuhongt <hongtao.liu@intel.com>
600 * typeck.cc (build_vec_cmp): Pass type of arg0 to
603 2023-10-25 Jason Merrill <jason@redhat.com>
605 * cp-tree.def: Improve OFFSET_REF comment.
606 * cp-gimplify.cc (cp_fold_immediate): Add to comment.
608 2023-10-25 Thomas Schwinge <thomas@codesourcery.com>
610 * parser.cc (cp_parser_omp_clause_name): Return
611 'PRAGMA_OACC_CLAUSE_SELF' for "self".
612 (cp_parser_oacc_data_clause, OACC_UPDATE_CLAUSE_MASK): Adjust.
613 (cp_parser_oacc_all_clauses): Remove 'bool compute_p' formal
614 parameter, and instead locally determine whether we're called for
615 an OpenACC compute construct or OpenACC 'update' directive.
616 (cp_parser_oacc_compute): Adjust.
618 2023-10-25 Chung-Lin Tang <cltang@codesourcery.com>
620 * parser.cc (cp_parser_oacc_compute_clause_self): New function.
621 (cp_parser_oacc_all_clauses): Add new 'bool compute_p = false'
622 parameter, add parsing of self clause when compute_p is true.
623 (OACC_KERNELS_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_SELF.
624 (OACC_PARALLEL_CLAUSE_MASK): Likewise,
625 (OACC_SERIAL_CLAUSE_MASK): Likewise.
626 (cp_parser_oacc_compute): Adjust call to c_parser_oacc_all_clauses to
627 set compute_p argument to true.
628 * pt.cc (tsubst_omp_clauses): Add OMP_CLAUSE_SELF case.
629 * semantics.cc (c_finish_omp_clauses): Add OMP_CLAUSE_SELF case, merged
630 with OMP_CLAUSE_IF case.
632 2023-10-25 Marek Polacek <polacek@redhat.com>
635 * typeck.cc (build_static_cast_1): Call decay_conversion.
637 2023-10-24 Patrick Palka <ppalka@redhat.com>
640 * init.cc (build_new_1): Use convert, build2, build3 and
641 cp_fully_fold instead of fold_convert, size_binop and
642 fold_build3 when building up 'size'.
644 2023-10-24 Patrick Palka <ppalka@redhat.com>
647 * tree.cc (cp_stabilize_reference): Do nothing when
648 processing_template_decl.
650 2023-10-22 Patrick Palka <ppalka@redhat.com>
653 * pt.cc (tsubst_expr) <case AT_ENCODE_EXPR>: Use tsubst instead
656 2023-10-20 Jason Merrill <jason@redhat.com>
658 * call.cc (implicit_conversion_1): Rename...
659 (implicit_conversion): ...to this. Remove the old wrapper.
661 2023-10-20 Jason Merrill <jason@redhat.com>
663 * call.cc (tourney): Only skip champ_compared_to_predecessor.
665 2023-10-20 Nathan Sidwell <nathan@acm.org>
668 * module.cc (trees_out::core_vals): Stream CONSTRUCTOR operands
670 (trees_in::core_vals): Likewise.
672 2023-10-20 Patrick Palka <ppalka@redhat.com>
674 * cp-lang.cc (objcp_tsubst_copy_and_build): Rename to ...
675 (objcp_tsubst_expr): ... this.
676 * cp-objcp-common.h (objcp_tsubst_copy_and_build): Rename to ...
677 (objcp_tsubst_expr): ... this.
678 * cp-tree.h (tsubst_copy_and_build): Remove declaration.
679 * init.cc (maybe_instantiate_nsdmi_init): Use tsubst_expr
680 instead of tsubst_copy_and_build.
681 * pt.cc (expand_integer_pack): Likewise.
682 (instantiate_non_dependent_expr_internal): Likewise.
683 (instantiate_class_template): Use tsubst_stmt instead of
684 tsubst_expr for STATIC_ASSERT.
685 (tsubst_function_decl): Adjust tsubst_copy_and_build uses.
686 (tsubst_arg_types): Likewise.
687 (tsubst_exception_specification): Likewise.
688 (tsubst_tree_list): Likewise.
690 (tsubst_name): Likewise.
691 (tsubst_omp_clause_decl): Use tsubst_stmt instead of tsubst_expr.
692 (tsubst_omp_clauses): Likewise.
693 (tsubst_copy_asm_operands): Adjust tsubst_copy_and_build use.
694 (tsubst_omp_for_iterator): Use tsubst_stmt instead of tsubst_expr.
695 (tsubst_expr): Rename to ...
696 (tsubst_stmt): ... this.
697 <case CO_YIELD_EXPR, CO_AWAIT_EXPR>: Move to tsubst_expr.
698 (tsubst_omp_udr): Use tsubst_stmt instead of tsubst_expr.
699 (tsubst_non_call_postfix_expression): Adjust tsubst_copy_and_build
701 (tsubst_lambda_expr): Likewise. Use tsubst_stmt instead of
702 tsubst_expr for the body of a lambda.
703 (tsubst_copy_and_build_call_args): Rename to ...
704 (tsubst_call_args): ... this. Adjust tsubst_copy_and_build use.
705 (tsubst_copy_and_build): Rename to tsubst_expr. Adjust
706 tsubst_copy_and_build and tsubst_copy_and_build_call_args use.
707 <case TRANSACTION_EXPR>: Use tsubst_stmt instead of tsubst_expr.
708 (maybe_instantiate_noexcept): Adjust tsubst_copy_and_build use.
709 (instantiate_body): Use tsubst_stmt instead of tsubst_expr for
710 substituting the function body.
711 (tsubst_initializer_list): Adjust tsubst_copy_and_build use.
713 2023-10-20 Patrick Palka <ppalka@redhat.com>
715 * cp-tree.h (enum tsubst_flags): Add tf_no_name_lookup.
716 * pt.cc (tsubst_pack_expansion): Use tsubst for substituting
718 (tsubst_decl) <case USING_DECL>: Use tsubst_name instead of
720 (tsubst) <case TEMPLATE_TYPE_PARM>: Use tsubst_copy_and_build
721 instead of tsubst_copy for substituting
722 CLASS_PLACEHOLDER_TEMPLATE.
723 <case TYPENAME_TYPE>: Use tsubst_name instead of tsubst_copy for
724 substituting TYPENAME_TYPE_FULLNAME.
725 (tsubst_name): Define.
726 (tsubst_qualified_id): Use tsubst_name instead of tsubst_copy
727 for substituting the component name of a SCOPE_REF.
728 (tsubst_copy): Remove.
729 (tsubst_copy_and_build): Clear tf_no_name_lookup at the start,
730 and remember if it was set. Call maybe_dependent_member_ref if
731 tf_no_name_lookup was not set.
732 <case IDENTIFIER_NODE>: Don't do name lookup if tf_no_name_lookup
734 <case TEMPLATE_ID_EXPR>: If tf_no_name_lookup was set, use
735 tsubst_name instead of tsubst_copy_and_build to substitute the
736 template and don't finish the template-id.
737 <case BIT_NOT_EXPR>: Handle identifier and type operand (if
738 tf_no_name_lookup was set).
739 <case SCOPE_REF>: Avoid trying to resolve a SCOPE_REF if
740 tf_no_name_lookup was set by calling build_qualified_name directly
741 instead of tsubst_qualified_id.
742 <case SIZEOF_EXPR>: Handling of sizeof... copied from tsubst_copy.
743 <case CALL_EXPR>: Use tsubst_name instead of tsubst_copy to
744 substitute a TEMPLATE_ID_EXPR callee naming an unresolved template.
745 <case COMPONENT_REF>: Likewise to substitute the member.
746 <case FUNCTION_DECL>: Copied from tsubst_copy and merged with ...
747 <case VAR_DECL, PARM_DECL>: ... these. Initial handling copied
748 from tsubst_copy. Optimize local variable substitution by
749 trying retrieve_local_specialization before checking
751 <case CONST_DECL>: Copied from tsubst_copy.
752 <case FIELD_DECL>: Likewise.
753 <case NAMESPACE_DECL>: Likewise.
754 <case OVERLOAD>: Likewise.
755 <case TEMPLATE_DECL>: Likewise.
756 <case TEMPLATE_PARM_INDEX>: Likewise.
757 <case TYPE_DECL>: Likewise.
758 <case CLEANUP_POINT_EXPR>: Likewise.
759 <case OFFSET_REF>: Likewise.
760 <case EXPR_PACK_EXPANSION>: Likewise.
761 <case NONTYPE_ARGUMENT_PACK>: Likewise.
762 <case *_CST>: Likewise.
763 <case *_*_FOLD_EXPR>: Likewise.
764 <case DEBUG_BEGIN_STMT>: Likewise.
765 <case CO_AWAIT_EXPR>: Likewise.
766 <case TRAIT_EXPR>: Use tsubst and tsubst_copy_and_build instead
768 <default>: Copied from tsubst_copy.
769 (tsubst_initializer_list): Use tsubst and tsubst_copy_and_build
770 instead of tsubst_copy.
772 2023-10-20 Patrick Palka <ppalka@redhat.com>
775 * parser.cc (cp_parser_postfix_expression): Consolidate three
776 calls to finish_call_expr, one to build_new_method_call and
777 one to build_min_nt_call_vec into one call to finish_call_expr.
778 Don't call maybe_generic_this_capture here.
779 * pt.cc (tsubst_copy_and_build) <case CALL_EXPR>: Remove
780 COMPONENT_REF callee handling.
781 (type_dependent_expression_p): Use t_d_object_e_p instead of
782 t_d_e_p for COMPONENT_REF and OFFSET_REF.
783 * semantics.cc (finish_call_expr): In the type-dependent case,
784 call maybe_generic_this_capture here instead.
786 2023-10-20 Patrick Palka <ppalka@redhat.com>
788 * call.cc (build_new_method_call): Remove calls to
789 build_non_dependent_expr and/or make_args_non_dependent.
790 * coroutines.cc (finish_co_return_stmt): Likewise.
791 * cp-tree.h (build_non_dependent_expr): Remove.
792 (make_args_non_dependent): Remove.
793 * decl2.cc (grok_array_decl): Remove calls to
794 build_non_dependent_expr and/or make_args_non_dependent.
795 (build_offset_ref_call_from_tree): Likewise.
796 * init.cc (build_new): Likewise.
797 * pt.cc (make_args_non_dependent): Remove.
798 (test_build_non_dependent_expr): Remove.
799 (cp_pt_cc_tests): Adjust.
800 * semantics.cc (finish_expr_stmt): Remove calls to
801 build_non_dependent_expr and/or make_args_non_dependent.
802 (finish_for_expr): Likewise.
803 (finish_call_expr): Likewise.
804 (finish_omp_atomic): Likewise.
805 * typeck.cc (finish_class_member_access_expr): Likewise.
806 (build_x_indirect_ref): Likewise.
807 (build_x_binary_op): Likewise.
808 (build_x_array_ref): Likewise.
809 (build_x_vec_perm_expr): Likewise.
810 (build_x_shufflevector): Likewise.
811 (build_x_unary_op): Likewise.
812 (cp_build_addressof): Likewise.
813 (build_x_conditional_expr): Likewise.
814 (build_x_compound_expr): Likewise.
815 (build_static_cast): Likewise.
816 (build_x_modify_expr): Likewise.
817 (check_return_expr): Likewise.
818 * typeck2.cc (build_x_arrow): Likewise.
820 2023-10-20 Patrick Palka <ppalka@redhat.com>
822 * class.cc (instantiate_type): Remove NON_DEPENDENT_EXPR
824 * constexpr.cc (cxx_eval_constant_expression): Likewise.
825 (potential_constant_expression_1): Likewise.
826 * coroutines.cc (coro_validate_builtin_call): Don't
827 expect ALIGNOF_EXPR to be wrapped in NON_DEPENDENT_EXPR.
828 * cp-objcp-common.cc (cp_common_init_ts): Remove
829 NON_DEPENDENT_EXPR handling.
830 * cp-tree.def (NON_DEPENDENT_EXPR): Remove.
831 * cp-tree.h (build_non_dependent_expr): Temporarily redefine as
832 the identity function.
833 * cvt.cc (maybe_warn_nodiscard): Handle type-dependent and
834 variable callee of CALL_EXPR.
835 * cxx-pretty-print.cc (cxx_pretty_printer::expression): Remove
836 NON_DEPENDENT_EXPR handling.
837 * error.cc (dump_decl): Likewise.
838 (dump_expr): Likewise.
839 * expr.cc (mark_use): Likewise.
840 (mark_exp_read): Likewise.
841 * pt.cc (build_non_dependent_expr): Remove.
842 * tree.cc (lvalue_kind): Remove NON_DEPENDENT_EXPR handling.
843 (cp_stabilize_reference): Likewise.
844 * typeck.cc (warn_for_null_address): Likewise.
845 (cp_build_binary_op): Handle type-dependent SIZEOF_EXPR operands.
846 (cp_build_unary_op) <case TRUTH_NOT_EXPR>: Don't fold inside a
849 2023-10-20 Alexandre Oliva <oliva@adacore.com>
851 * decl.cc (push_throw_library_fn): Mark with ECF_XTHROW.
852 * except.cc (build_throw): Likewise __cxa_throw,
853 _ITM_cxa_throw, __cxa_rethrow.
855 2023-10-20 Nathaniel Shead <nathanieloshead@gmail.com>
859 * call.cc (build_over_call): Fold more indirect refs for trivial
861 * class.cc (type_has_non_deleted_trivial_default_ctor): Create.
862 * constexpr.cc (cxx_eval_call_expression): Start lifetime of
863 union member before entering constructor.
864 (cxx_eval_component_reference): Check against first member of
865 value-initialised union.
866 (cxx_eval_store_expression): Activate member for
867 value-initialised union. Check for accessing inactive union
869 * cp-tree.h (type_has_non_deleted_trivial_default_ctor):
872 2023-10-20 Nathaniel Shead <nathanieloshead@gmail.com>
874 * constexpr.cc (is_std_source_location_current): New.
875 (cxx_eval_constant_expression): Only ignore cast from void* for
876 specific cases and improve other diagnostics.
878 2023-10-19 Marek Polacek <polacek@redhat.com>
880 * cp-gimplify.cc (cp_fold_r): Don't call maybe_constant_value.
882 2023-10-19 Jason Merrill <jason@redhat.com>
884 * typeck2.cc (check_narrowing): Adjust.
886 2023-10-19 Jason Merrill <jason@redhat.com>
888 * parser.cc (cp_parser_primary_expression): Use G_.
889 (cp_parser_using_enum): Likewise.
890 * decl.cc (identify_goto): Likewise.
892 2023-10-18 Jason Merrill <jason@redhat.com>
894 * typeck2.cc (check_narrowing): Use permerror.
896 2023-10-17 Marek Polacek <polacek@redhat.com>
899 * parser.cc (cp_parser_simple_declaration): Do cp_parser_error
902 2023-10-17 Marek Polacek <polacek@redhat.com>
905 * cp-gimplify.cc (cp_fold_immediate_r) <case COND_EXPR>: Don't
907 (cp_fold_r): Handle COND_EXPR here.
909 2023-10-17 Jason Merrill <jason@redhat.com>
911 * mangle.cc (abi_check): New.
912 (write_prefix, write_unqualified_name, write_discriminator)
913 (write_type, write_member_name, write_expression)
914 (write_template_arg, write_template_param): Use it.
915 (start_mangling): Assign from {}.
916 * cp-tree.h: Update comment.
918 2023-10-17 Nathaniel Shead <nathanieloshead@gmail.com>
920 * constexpr.cc (cxx_eval_dynamic_cast_fn): Add missing
921 auto_diagnostic_group.
922 (cxx_eval_call_expression): Likewise.
923 (diag_array_subscript): Likewise.
924 (outside_lifetime_error): Likewise.
925 (potential_constant_expression_1): Likewise.
927 2023-10-16 Jason Merrill <jason@redhat.com>
929 * parser.cc (cp_parser_fold_expression): Track location range.
930 * semantics.cc (finish_unary_fold_expr)
931 (finish_left_unary_fold_expr, finish_right_unary_fold_expr)
932 (finish_binary_fold_expr): Add location parm.
933 * constraint.cc (finish_shorthand_constraint): Pass it.
934 * pt.cc (convert_generic_types_to_packs): Likewise.
937 2023-10-16 Marek Polacek <polacek@redhat.com>
940 * constexpr.cc (explain_invalid_constexpr_fn): Also check the body of
941 a constructor in C++14 and up.
943 2023-10-14 Jakub Jelinek <jakub@redhat.com>
946 * module.cc (trees_out::start, trees_in::start): Remove
947 TREE_INT_CST_OFFSET_NUNITS handling.
949 2023-10-10 Jason Merrill <jason@redhat.com>
952 * mangle.cc (write_template_param): Also mangle level.
954 2023-10-08 David Malcolm <dmalcolm@redhat.com>
956 * module.cc (module_state::read_location): Update for renaming of
957 get_combined_adhoc_loc.
959 2023-10-03 David Malcolm <dmalcolm@redhat.com>
961 * error.cc (print_instantiation_partial_context_line): Call
962 diagnostic_show_locus.
964 2023-10-03 David Malcolm <dmalcolm@redhat.com>
966 * error.cc: Update for "m_" prefixes to text_info fields.
968 2023-09-30 Eugene Rozenfeld <erozen@microsoft.com>
970 * Make-lang.in: Make create_fdas_for_cc1plus target not .PHONY
972 2023-09-28 Richard Sandiford <richard.sandiford@arm.com>
974 * constexpr.cc (cxx_fold_indirect_ref): Remove unused variables.
976 2023-09-22 Jason Merrill <jason@redhat.com>
979 * pt.cc (expand_integer_pack): Use IMPLICIT_CONV_EXPR.
981 2023-09-22 Jason Merrill <jason@redhat.com>
983 * constexpr.cc (free_constructor): Handle null ce->value.
985 2023-09-22 Jason Merrill <jason@redhat.com>
988 * parser.cc (cp_parser_lambda_declarator_opt): Don't suggest
989 -std=c++14 for lambda templates.
990 * pt.cc (tsubst_expr): Move ANNOTATE_EXPR handling...
991 (tsubst_copy_and_build): ...here.
993 2023-09-22 Patrick Palka <ppalka@redhat.com>
996 * decl2.cc (grok_array_decl): Guard diagnostic and backward
997 compatibility fallback code paths with tf_error.
999 2023-09-22 Patrick Palka <ppalka@redhat.com>
1002 * pt.cc (is_compatible_template_arg): New parameter 'args'.
1003 Add the outer template arguments 'args' to 'new_args'.
1004 (convert_template_argument): Pass 'args' to
1005 is_compatible_template_arg.
1007 2023-09-20 Jakub Jelinek <jakub@redhat.com>
1009 * parser.cc (cp_parser_postfix_expression): Parse
1010 __builtin_classify_type call with typename as argument.
1011 * pt.cc (tsubst_copy_and_build): Handle __builtin_classify_type
1012 with dependent typename as argument.
1014 2023-09-20 Patrick Palka <ppalka@redhat.com>
1017 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
1018 <case VAR_DECL>: Handle class NTTP objects by printing
1019 their type and value.
1020 <case VIEW_CONVERT_EXPR>: Strip const VIEW_CONVERT_EXPR
1021 wrappers for class NTTPs.
1022 (pp_cxx_template_argument_list): Don't handle class NTTP
1025 2023-09-20 Patrick Palka <ppalka@redhat.com>
1027 * pt.cc (tsubst_function_decl): Don't bother computing 'argvec'
1028 when 'lambda_fntype' is set.
1029 (tsubst_template_decl): Make sure we return a TEMPLATE_DECL
1030 during specialization lookup. In the non-class non-function
1031 template case, use tsubst_decl directly with use_spec_table=false,
1032 update DECL_TI_ARGS and call register_specialization like
1033 tsubst_decl would have done if use_spec_table=true.
1035 2023-09-20 Jakub Jelinek <jakub@redhat.com>
1038 * parser.h (struct cp_lexer): Add in_omp_decl_attribute member.
1039 * cp-tree.h (cp_maybe_parse_omp_decl): Declare.
1040 * parser.cc (cp_parser_handle_statement_omp_attributes): Diagnose
1041 omp::decl attribute on statements. Adjust diagnostic wording for
1043 (cp_parser_omp_directive_args): Add DECL_P argument, set TREE_PUBLIC
1044 to it on the DEFERRED_PARSE tree.
1045 (cp_parser_omp_sequence_args): Adjust caller.
1046 (cp_parser_std_attribute): Handle omp::decl attribute.
1047 (cp_parser_omp_var_list): If parser->lexer->in_omp_decl_attribute
1048 don't expect any arguments, instead create clause or TREE_LIST for
1050 (cp_parser_late_parsing_omp_declare_simd): Adjust diagnostic wording
1052 (cp_maybe_parse_omp_decl): New function.
1053 (cp_parser_omp_declare_target): If
1054 parser->lexer->in_omp_decl_attribute and first token isn't name or
1055 comma invoke cp_parser_omp_var_list.
1056 * decl2.cc (cplus_decl_attributes): Adjust diagnostic wording for
1057 omp::decl. Handle omp::decl on declarations.
1058 * name-lookup.cc (finish_using_directive): Adjust diagnostic wording
1061 2023-09-19 Ben Boeckel <ben.boeckel@kitware.com>
1063 * mapper-client.cc, mapper-client.h (open_module_client): Accept
1064 dependency tracking and track module mapper files as
1066 * module.cc (make_mapper, get_mapper): Pass the dependency
1067 tracking class down.
1069 2023-09-19 Ben Boeckel <ben.boeckel@kitware.com>
1071 * module.cc (do_import): Report imported CMI files as
1074 2023-09-19 Ben Boeckel <ben.boeckel@kitware.com>
1076 * module.cc (preprocessed_module): Pass whether the module is
1077 exported to dependency tracking.
1079 2023-09-19 Javier Martinez <javier.martinez.bugzilla@gmail.com>
1081 * class.cc (propagate_class_warmth_attribute): New function.
1082 (check_bases_and_members): propagate hot and cold attributes
1083 to all FUNCTION_DECL when the record is marked hot or cold.
1084 * cp-tree.h (maybe_propagate_warmth_attributes): New function.
1085 * decl2.cc (maybe_propagate_warmth_attributes): New function.
1086 * method.cc (lazily_declare_fn): propagate hot and cold
1087 attributes to lazily declared functions when the record is
1090 2023-09-19 Patrick Palka <ppalka@redhat.com>
1092 * ptree.cc (cxx_print_type): Remove TYPE_LANG_SPECIFIC
1093 test guarding TYPE_TEMPLATE_INFO.
1095 2023-09-19 Jason Merrill <jason@redhat.com>
1098 * class.cc (add_implicit_default_ctor): Split out...
1099 (add_implicitly_declared_members): ...from here.
1100 Also call it when inheriting a default ctor.
1102 2023-09-19 Marek Polacek <polacek@redhat.com>
1104 * call.cc (build_over_call): Set ADDR_EXPR_DENOTES_CALL_P. Don't handle
1105 immediate_invocation_p here.
1106 * constexpr.cc (cxx_eval_call_expression): Use mce_true for
1107 DECL_IMMEDIATE_FUNCTION_P.
1108 (cxx_eval_conditional_expression): Call cp_fold_immediate.
1109 * cp-gimplify.cc (enum fold_flags): Add ff_fold_immediate.
1110 (maybe_replace_decl): Make static.
1111 (cp_fold_r): Expand immediate invocations.
1112 (cp_fold_immediate_r): New.
1113 (cp_fold_immediate): New.
1114 * cp-tree.h (ADDR_EXPR_DENOTES_CALL_P): Define.
1115 (cp_fold_immediate): Declare.
1116 * tree.cc (bot_replace): Don't handle immediate invocations here.
1118 2023-09-19 Patrick Palka <ppalka@redhat.com>
1121 * cvt.cc (convert_to_void) <case INDIRECT_REF>: Only call
1122 complete_type if the type is volatile.
1123 <case VAR_DECL>: Likewise.
1125 2023-09-19 Patrick Palka <ppalka@redhat.com>
1128 * semantics.cc (finish_decltype_type): For an NTTP object,
1129 return its type modulo cv-quals.
1131 2023-09-18 Patrick Palka <ppalka@redhat.com>
1134 * pt.cc (try_class_unification): Strengthen TI_TEMPLATE equality
1135 test by not calling most_general_template. Only unify the
1136 innermost levels of template arguments.
1137 (unify) <case CLASS_TYPE>: Only unify the innermost levels of
1138 template arguments, and only if the template is primary.
1140 2023-09-18 Patrick Palka <ppalka@redhat.com>
1144 * semantics.cc (maybe_convert_cond): Look through implicit
1145 INDIRECT_REF when deciding whether to issue a -Wparentheses
1146 warning, and consider templated assignment expressions as well.
1147 (finish_parenthesized_expr): Look through implicit INDIRECT_REF
1148 when suppressing -Wparentheses warning.
1149 * typeck.cc (build_x_modify_expr): Check simple assignments
1150 ahead time too, not just compound assignments. Give the second
1151 operand of MODOP_EXPR a non-null type so that it's not considered
1152 always instantiation-dependent. Don't call suppress_warning.
1154 2023-09-18 Patrick Palka <ppalka@redhat.com>
1157 * pt.cc (unify): Return unify_success for identical dependent
1158 DECL_P 'arg' and 'parm'.
1159 <case CONST_DECL>: Remove handling.
1161 2023-09-18 Patrick Palka <ppalka@redhat.com>
1163 * call.cc (add_template_candidate_real): Check arity even
1164 when there are no explicit template arguments. Combine the
1165 two adjacent '!obj' tests into one.
1167 2023-09-18 Patrick Palka <ppalka@redhat.com>
1169 * pt.cc (register_specialization): Remove now-unnecessary
1170 early exit for FUNCTION_DECL partial instantiation.
1171 (tsubst_template_decl): Pass use_spec_table=false to
1172 tsubst_function_decl. Set DECL_TI_ARGS of a non-lambda
1173 FUNCTION_DECL specialization to the full set of arguments.
1174 Simplify register_specialization call accordingly.
1176 2023-09-18 Jason Merrill <jason@redhat.com>
1178 * class.cc (check_subobject_offset): Use similar_type_p.
1180 2023-09-12 Jason Merrill <jason@redhat.com>
1183 * pt.cc (expand_integer_pack): Convert argument to int.
1185 2023-09-12 Jason Merrill <jason@redhat.com>
1188 * typeck2.cc (process_init_constructor_array): Use VEC_INIT_EXPR
1189 regardless of seen_error.
1191 2023-09-08 Patrick Palka <ppalka@redhat.com>
1194 * pt.cc (check_non_deducible_conversions): Add bool parameter
1195 passed down to check_non_deducible_conversion.
1196 (fn_type_unification): Call check_non_deducible_conversions
1197 an extra time before satisfaction with noninst_only_p=true.
1198 (conversion_may_instantiate_p): Define.
1199 (check_non_deducible_conversion): Add bool parameter controlling
1200 whether to compute only conversions that are guaranteed to
1201 not induce template instantiation.
1203 2023-09-07 Sandra Loosemore <sandra@codesourcery.com>
1206 * parser.cc (fixup_blocks_walker): Check for null BIND_EXPR_BLOCK.
1208 2023-09-06 Jason Merrill <jason@redhat.com>
1210 * class.cc (check_subobject_offset): Check
1211 same_type_ignoring_top_level_qualifiers_p.
1213 2023-09-05 Marek Polacek <polacek@redhat.com>
1216 * constexpr.cc (verify_constant_explain_r): New.
1217 (verify_constant): Call it.
1219 2023-09-05 Jakub Jelinek <jakub@redhat.com>
1222 * name-lookup.cc (check_local_shadow): Don't punt early for
1223 DECL_EXTERNAL decls, instead just disable the shadowing of namespace
1224 decls check for those and emit a pedwarn rather than error_at or
1225 permerror for those. Formatting fix.
1227 2023-09-05 Jakub Jelinek <jakub@redhat.com>
1230 * name-lookup.h (struct cp_binding_level): Add artificial bit-field.
1232 * name-lookup.cc (check_local_shadow): Skip artificial bindings when
1233 checking if parameter scope is parent scope. Don't special case
1234 FUNCTION_NEEDS_BODY_BLOCK. Diagnose the in_function_try_handler
1235 cases in the b->kind == sk_function_parms test and verify no
1236 non-artificial intervening scopes. Add missing auto_diagnostic_group.
1237 * decl.cc (begin_function_body): Set
1238 current_binding_level->artificial.
1239 * semantics.cc (begin_function_try_block): Likewise.
1241 2023-09-05 Patrick Palka <ppalka@redhat.com>
1243 * parser.cc (cp_parser_parenthesized_expression_list_elt): Pass
1244 nullptr as non_constant_p to cp_parser_braced_list if our
1245 non_constant_p is null.
1246 (cp_parser_initializer_list): Likewise to
1247 cp_parser_initializer_clause. Avoid inspecting
1248 clause_non_constant_p if it's uninitialized.
1250 2023-09-05 Patrick Palka <ppalka@redhat.com>
1252 * call.cc (build_user_type_conversion): Free allocated
1254 (build_converted_constant_expr_internal): Use
1255 conversion_obstack_sentinel instead.
1256 (perform_dguide_overload_resolution): Likewise.
1257 (build_new_function_call): Likewise.
1258 (build_operator_new_call): Free allocated conversions.
1259 (build_op_call): Use conversion_obstack_sentinel instead.
1260 (build_conditional_expr): Use conversion_obstack_sentinel
1261 instead, and hoist it out to the outermost scope.
1262 (build_new_op): Use conversion_obstack_sentinel instead
1263 and set it up before the first goto. Remove second unneeded goto.
1264 (build_op_subscript): Use conversion_obstack_sentinel instead.
1265 (ref_conv_binds_to_temporary): Likewise.
1266 (build_new_method_call): Likewise.
1267 (can_convert_arg): Likewise.
1268 (can_convert_arg_bad): Likewise.
1269 (perform_implicit_conversion_flags): Likewise.
1270 (perform_direct_initialization_if_possible): Likewise.
1271 (initialize_reference): Likewise.
1273 2023-09-01 Jakub Jelinek <jakub@redhat.com>
1276 * cp-tree.h (determine_local_discriminator): Add NAME argument with
1278 (struct cp_decomp): New type.
1279 (cp_finish_decl): Add DECOMP argument defaulted to nullptr.
1280 (cp_maybe_mangle_decomp): Remove declaration.
1281 (cp_finish_decomp): Add cp_decomp * argument, remove tree and unsigned
1283 (cp_convert_range_for): Likewise.
1284 * decl.cc (determine_local_discriminator): Add NAME argument, use it
1285 if non-NULL, otherwise compute it the old way.
1286 (maybe_commonize_var): Don't return early for structured bindings.
1287 (cp_finish_decl): Add DECOMP argument, if non-NULL, call
1288 cp_maybe_mangle_decomp.
1289 (cp_maybe_mangle_decomp): Make it static with a forward declaration.
1290 Call determine_local_discriminator. Replace FIRST and COUNT arguments
1291 with DECOMP argument.
1292 (cp_finish_decomp): Replace FIRST and COUNT arguments with DECOMP
1294 * mangle.cc (find_decomp_unqualified_name): Remove.
1295 (write_unqualified_name): Don't call find_decomp_unqualified_name.
1296 (mangle_decomp): Handle mangling of static function/block scope
1297 structured bindings. Don't call decl_mangling_context twice. Call
1298 check_abi_tags, call write_abi_tags for abi version >= 19 and emit
1299 -Wabi warnings if needed.
1300 (write_guarded_var_name): Handle structured bindings.
1301 (mangle_ref_init_variable): Use write_guarded_var_name.
1302 * parser.cc (cp_parser_range_for): Adjust do_range_for_auto_deduction
1303 and cp_convert_range_for callers.
1304 (do_range_for_auto_deduction): Replace DECOMP_FIRST_NAME and
1305 DECOMP_CNT arguments with DECOMP. Adjust cp_finish_decomp caller.
1306 (cp_convert_range_for): Replace DECOMP_FIRST_NAME and
1307 DECOMP_CNT arguments with DECOMP. Don't call cp_maybe_mangle_decomp,
1308 adjust cp_finish_decl and cp_finish_decomp callers.
1309 (cp_parser_decomposition_declaration): Don't call
1310 cp_maybe_mangle_decomp, adjust cp_finish_decl and cp_finish_decomp
1312 (cp_convert_omp_range_for): Adjust do_range_for_auto_deduction
1313 and cp_finish_decomp callers.
1314 (cp_finish_omp_range_for): Don't call cp_maybe_mangle_decomp,
1315 adjust cp_finish_decl and cp_finish_decomp callers.
1316 * pt.cc (tsubst_omp_for_iterator): Adjust tsubst_decomp_names
1318 (tsubst_decomp_names): Replace FIRST and CNT arguments with DECOMP.
1319 (tsubst_expr): Don't call cp_maybe_mangle_decomp, adjust
1320 tsubst_decomp_names, cp_finish_decl, cp_finish_decomp and
1321 cp_convert_range_for callers.
1323 2023-08-30 Marek Polacek <polacek@redhat.com>
1326 * parser.cc (cp_parser_initializer_list): Set CONSTRUCTOR_IS_DIRECT_INIT
1327 when the designated initializer is of the .x{} form.
1329 2023-08-30 Marek Polacek <polacek@redhat.com>
1332 * decl.cc (grokdeclarator): Disallow constinit on functions.
1334 2023-08-29 Marek Polacek <polacek@redhat.com>
1336 * call.cc (convert_like_internal): Show where the conversion function
1338 (maybe_show_nonconverting_candidate): New.
1339 * cp-tree.h (maybe_show_nonconverting_candidate): Declare.
1340 * typeck.cc (convert_for_assignment): Call it.
1342 2023-08-25 Sandra Loosemore <sandra@codesourcery.com>
1344 * cp-tree.h (cp_convert_omp_range_for): Adjust declaration.
1345 * parser.cc (struct omp_for_parse_data): New.
1346 (cp_parser_postfix_expression): Diagnose calls to OpenMP runtime
1347 in intervening code.
1348 (check_omp_intervening_code): New.
1349 (cp_parser_statement_seq_opt): Special-case nested loops, blocks,
1350 and other constructs for OpenMP loops.
1351 (cp_parser_iteration_statement): Reject loops in intervening code.
1352 (cp_parser_omp_for_loop_init): Expand comments and tweak the
1353 interface slightly to better distinguish input/output parameters.
1354 (cp_convert_omp_range_for): Likewise.
1355 (cp_parser_omp_loop_nest): New, split from cp_parser_omp_for_loop
1356 and largely rewritten. Add more comments.
1357 (insert_structured_blocks): New.
1358 (find_structured_blocks): New.
1359 (struct sit_data, substitute_in_tree_walker, substitute_in_tree):
1361 (fixup_blocks_walker): New.
1362 (cp_parser_omp_for_loop): Rewrite to use recursive descent instead
1363 of a loop. Add logic to reshuffle the bits of code collected
1364 during parsing so intervening code gets moved to the loop body.
1365 (cp_parser_omp_loop): Remove call to finish_omp_for_block, which
1367 (cp_parser_omp_simd): Likewise.
1368 (cp_parser_omp_for): Likewise.
1369 (cp_parser_omp_distribute): Likewise.
1370 (cp_parser_oacc_loop): Likewise.
1371 (cp_parser_omp_taskloop): Likewise.
1372 (cp_parser_pragma): Reject OpenMP pragmas in intervening code.
1373 * parser.h (struct cp_parser): Add omp_for_parse_state field.
1374 * pt.cc (tsubst_omp_for_iterator): Adjust call to
1375 cp_convert_omp_range_for.
1376 * semantics.cc (finish_omp_for): Try harder to preserve location
1377 of loop variable init expression for use in diagnostics.
1378 (struct fofb_data, finish_omp_for_block_walker): New.
1379 (finish_omp_for_block): Allow variables to be bound in a BIND_EXPR
1380 nested inside BIND instead of directly in BIND itself.
1382 2023-08-25 Sandra Loosemore <sandra@codesourcery.com>
1384 * constexpr.cc (cxx_eval_constant_expression): Handle
1385 OMP_STRUCTURED_BLOCK.
1386 * pt.cc (tsubst_expr): Likewise.
1388 2023-08-25 Uros Bizjak <ubizjak@gmail.com>
1390 * call.cc (build_conditional_expr):
1391 Rename TRUE/FALSE to true/false.
1392 (build_new_op): Ditto.
1394 2023-08-22 Jason Merrill <jason@redhat.com>
1396 * pt.cc (outer_template_args): Handle non-template argument.
1397 * constraint.cc (maybe_substitute_reqs_for): Pass decl to it.
1398 * cp-tree.h (outer_template_args): Adjust.
1400 2023-08-22 Jason Merrill <jason@redhat.com>
1403 * cp-tree.h (member_like_constrained_friend_p): Declare.
1404 * decl.cc (member_like_constrained_friend_p): New.
1405 (function_requirements_equivalent_p): Check it.
1406 (duplicate_decls): Check it.
1407 (grokfndecl): Check friend template constraints.
1408 * mangle.cc (decl_mangling_context): Check it.
1409 (write_unqualified_name): Check it.
1410 * pt.cc (uses_outer_template_parms_in_constraints): Fix for friends.
1411 (tsubst_friend_function): Don't check satisfaction.
1413 2023-08-22 Tobias Burnus <tobias@codesourcery.com>
1415 * parser.cc (cp_parser_omp_clause_defaultmap): Parse
1418 2023-08-15 Chung-Lin Tang <cltang@codesourcery.com>
1419 Thomas Schwinge <thomas@codesourcery.com>
1421 * parser.cc (OACC_DATA_CLAUSE_MASK): Add PRAGMA_OACC_CLAUSE_DEFAULT.
1423 2023-08-14 gnaggnoyil <gnaggnoyil@gmail.com>
1427 * decl.cc (get_tuple_size): Update implementation for DR 2386.
1429 2023-08-14 Jason Merrill <jason@redhat.com>
1431 * parser.cc (cp_parser_simple_type_specifier): Handle -std=c++14
1434 2023-08-12 Patrick Palka <ppalka@redhat.com>
1435 Jason Merrill <jason@redhat.com>
1438 * decl.cc (redeclaration_error_message): Remove special handling
1439 for deduction guides.
1440 (grokfndecl): Give deduction guides a dummy DECL_INITIAL.
1442 2023-08-11 Patrick Palka <ppalka@redhat.com>
1445 * parser.cc (cp_parser_type_requirement): Pass
1446 check_dependency_p=true instead of =false.
1448 2023-08-11 Patrick Palka <ppalka@redhat.com>
1451 * decl.cc (grokdeclarator): Pass 'dname' instead of
1452 'unqualified_id' as the name when building the VAR_DECL for a
1453 static data member. Call check_explicit_specialization for a
1454 TEMPLATE_ID_EXPR such member.
1455 * pt.cc (finish_member_template_decl): Return NULL_TREE
1456 instead of 'decl' when DECL_TEMPLATE_SPECIALIZATION is not
1459 2023-08-11 Patrick Palka <ppalka@redhat.com>
1461 * ptree.cc (cxx_print_decl): Check for DECL_LANG_SPECIFIC and
1462 TS_DECL_COMMON only when necessary. Print DECL_TEMPLATE_INFO
1463 for all decls that have it, not just VAR_DECL or FUNCTION_DECL.
1464 Also print DECL_USE_TEMPLATE.
1465 (cxx_print_type): Print TYPE_TEMPLATE_INFO.
1466 <case BOUND_TEMPLATE_TEMPLATE_PARM>: Don't print TYPE_TI_ARGS
1468 <case TEMPLATE_TYPE/TEMPLATE_PARM>: Print TEMPLATE_TYPE_PARM_INDEX
1469 instead of printing the index, level and original level
1472 2023-08-08 Marek Polacek <polacek@redhat.com>
1474 * parser.cc (cp_parser_postfix_expression): Adjust the call to
1475 cp_parser_braced_list.
1476 (cp_parser_postfix_open_square_expression): Likewise.
1477 (cp_parser_new_initializer): Likewise.
1478 (cp_parser_assignment_expression): Adjust the call to
1479 cp_parser_initializer_clause.
1480 (cp_parser_lambda_introducer): Adjust the call to cp_parser_initializer.
1481 (cp_parser_range_for): Adjust the call to cp_parser_braced_list.
1482 (cp_parser_jump_statement): Likewise.
1483 (cp_parser_mem_initializer): Likewise.
1484 (cp_parser_template_argument): Likewise.
1485 (cp_parser_default_argument): Adjust the call to cp_parser_initializer.
1486 (cp_parser_initializer): Handle null is_direct_init and non_constant_p
1488 (cp_parser_initializer_clause): Handle null non_constant_p argument.
1489 (cp_parser_braced_list): Likewise.
1490 (cp_parser_initializer_list): Likewise.
1491 (cp_parser_member_declaration): Adjust the call to
1492 cp_parser_initializer_clause and cp_parser_initializer.
1493 (cp_parser_yield_expression): Adjust the call to cp_parser_braced_list.
1494 (cp_parser_functional_cast): Likewise.
1495 (cp_parser_late_parse_one_default_arg): Adjust the call to
1496 cp_parser_initializer.
1497 (cp_parser_omp_for_loop_init): Likewise.
1498 (cp_parser_omp_declare_reduction_exprs): Likewise.
1500 2023-08-08 Nathaniel Shead <nathanieloshead@gmail.com>
1503 * parser.cc (cp_parser_decltype_expr): Report errors raised by
1504 finish_id_expression.
1506 2023-08-04 Tamar Christina <tamar.christina@arm.com>
1508 * cp-tree.h (RANGE_FOR_NOVECTOR): New.
1509 (cp_convert_range_for, finish_while_stmt_cond, finish_do_stmt,
1510 finish_for_cond): Add novector param.
1511 * init.cc (build_vec_init): Default novector to false.
1512 * method.cc (build_comparison_op): Likewise.
1513 * parser.cc (cp_parser_statement): Likewise.
1514 (cp_parser_for, cp_parser_c_for, cp_parser_range_for,
1515 cp_convert_range_for, cp_parser_iteration_statement,
1516 cp_parser_omp_for_loop, cp_parser_pragma): Support novector.
1517 (cp_parser_pragma_novector): New.
1518 * pt.cc (tsubst_expr): Likewise.
1519 * semantics.cc (finish_while_stmt_cond, finish_do_stmt,
1520 finish_for_cond): Likewise.
1522 2023-08-01 Lewis Hyatt <lhyatt@gmail.com>
1524 * parser.cc (c_init_preprocess): New function.
1525 (maybe_read_tokens_for_pragma_lex): New function.
1526 (pragma_lex): Support preprocess-only mode.
1527 (pragma_lex_discard_to_eol): New function.
1529 2023-07-31 Chung-Lin Tang <cltang@codesourcery.com>
1531 * parser.cc (cp_parser_oacc_host_data): Add checking requiring OpenACC
1532 host_data construct to have an use_device clause.
1534 2023-07-28 Ng YongXiang <yongxiangng@gmail.com>
1538 * init.cc (build_vec_delete_1): Devirtualize array destruction.
1540 2023-07-27 Patrick Palka <ppalka@redhat.com>
1543 * constexpr.cc (cxx_eval_array_reference): Allow synthesizing an
1544 empty subobject even if CONSTRUCTOR_NO_CLEARING is set.
1545 (cxx_eval_bare_aggregate): Set 'no_slot' to true more generally
1546 whenever new_ctx.ctor is set to NULL_TREE by init_subob_ctx,
1547 i.e. whenever initializing an subobject of empty type.
1548 (cxx_eval_vec_init_1): Define 'no_slot' as above and use it
1551 2023-07-27 Nathaniel Shead <nathanieloshead@gmail.com>
1554 * pt.cc (type_uses_auto): Check inside parameter packs.
1556 2023-07-26 Patrick Palka <ppalka@redhat.com>
1560 * pt.cc (reduce_template_parm_level): Set DECL_TEMPLATE_INFO
1561 on the DECL_TEMPLATE_RESULT of the new ttp.
1562 (add_defaults_to_ttp): Make a copy of the original ttp's
1563 DECL_TEMPLATE_RESULT, and update this copy's DECL_TEMPLATE_INFO
1565 (coerce_template_template_parms): Make sure 'scope_args' has
1566 the right amount of levels for the ttp argument.
1567 (most_general_template): Handle template template parameters.
1568 (rewrite_template_parm): Set DECL_TEMPLATE_RESULT on the
1569 DECL_TEMPLATE_RESULT of the new ttp.
1571 2023-07-26 Patrick Palka <ppalka@redhat.com>
1575 * pt.cc (coerce_template_template_parms): Simplify by using
1576 DECL_INNERMOST_TEMPLATE_PARMS and removing redundant asserts.
1577 Always pass the parameters of the most general template to
1578 coerce_template_parms.
1580 2023-07-26 Patrick Palka <ppalka@redhat.com>
1583 * pt.cc (unify) <case INTEGER_CST>: Generalize to handle
1586 2023-07-26 Marek Polacek <polacek@redhat.com>
1588 * parser.cc (cp_parser_constant_expression): Allow non_constant_p to be
1589 nullptr even when allow_non_constant_p is true. Don't call
1590 _rvalue_constant_expression when not necessary. Move local variable
1591 declarations closer to their first use.
1592 (cp_parser_static_assert): Don't pass a dummy down to
1593 cp_parser_constant_expression.
1595 2023-07-26 Jason Merrill <jason@redhat.com>
1598 * parser.cc (cp_parser_template_name): Skip non-member
1599 lookup after the template keyword.
1600 (cp_parser_lookup_name): Pass down template_keyword_p.
1602 2023-07-26 Nathaniel Shead <nathanieloshead@gmail.com>
1607 * constexpr.cc (constexpr_global_ctx::is_outside_lifetime): New
1609 (constexpr_global_ctx::get_value): Don't return expired values.
1610 (constexpr_global_ctx::get_value_ptr): Likewise.
1611 (constexpr_global_ctx::remove_value): Mark value outside
1613 (outside_lifetime_error): New function.
1614 (cxx_eval_call_expression): No longer track save_exprs.
1615 (cxx_eval_loop_expr): Likewise.
1616 (cxx_eval_constant_expression): Add checks for outside lifetime
1617 values. Remove local variables at end of bind exprs, and
1618 temporaries after cleanup points.
1620 2023-07-26 Nathaniel Shead <nathanieloshead@gmail.com>
1623 * cp-gimplify.cc (cp_genericize_r): Transform RETURN_EXPRs to
1624 not return dangling pointers.
1625 * cp-tree.h (RETURN_EXPR_LOCAL_ADDR_P): New flag.
1626 (check_return_expr): Add a new parameter.
1627 * semantics.cc (finish_return_stmt): Set flag on RETURN_EXPR
1628 when referring to dangling pointer.
1629 * typeck.cc (check_return_expr): Disable transformation of
1630 dangling pointers, instead pass this information to caller.
1632 2023-07-26 Nathaniel Shead <nathanieloshead@gmail.com>
1634 * constexpr.cc (modifying_const_object_error): Find the source
1635 location of the const object's declaration.
1636 (cxx_eval_constant_expression): Update input_location to the
1637 location of the currently evaluated expression, if possible.
1639 2023-07-25 Marek Polacek <polacek@redhat.com>
1642 * pt.cc (lookup_and_finish_template_variable): Don't clear tf_partial
1644 (instantiate_template): Reset all complain flags except
1645 tf_warning_or_error.
1647 2023-07-25 Marek Polacek <polacek@redhat.com>
1650 * constexpr.cc (cxx_eval_array_reference): Create a new constructor
1651 only when we don't already have a matching one. Clear the object
1652 when the type is non-scalar.
1654 2023-07-21 Marek Polacek <polacek@redhat.com>
1657 * constexpr.cc (potential_constant_expression_1): Try to complete the
1658 type when !processing_template_decl.
1660 2023-07-20 Marek Polacek <polacek@redhat.com>
1663 * call.cc (implicit_conversion_1): Return early if the type isn't
1666 2023-07-19 Marek Polacek <polacek@redhat.com>
1669 * error.cc (dump_simple_decl): Print base class name.
1671 2023-07-19 Marek Polacek <polacek@redhat.com>
1674 * typeck2.cc (process_init_constructor_record): Don't emit
1675 -Wmissing-field-initializers for empty classes.
1677 2023-07-19 Patrick Palka <ppalka@redhat.com>
1679 * pt.cc (type_unification_real): Test for PARM_DECL instead
1680 of TEMPLATE_PARM_INDEX to distinguish a type vs non-type
1681 template parameter pack.
1682 (type_targs_deducible_from): Likewise.
1684 2023-07-19 Patrick Palka <ppalka@redhat.com>
1686 * pt.cc (tsubst_function_decl): Add defaulted 'use_spec_table'
1687 flag parameter. Don't look up or insert into the specializations
1688 table if 'use_spec_table' is false.
1689 (tsubst_decl): Add defaulted 'use_spec_table' flag parameter.
1690 Check for error_mark_node.
1691 <case FUNCTION_DECL>: Pass 'use_spec_table' to
1692 tsubst_function_decl.
1693 <case TYPE/VAR_DECL>: Don't call coerce_template_parms.
1694 Don't look up or insert into the specializations table if
1695 'use_spec_table' is false. Exit earlier if the substituted
1696 type is erroneous and we're not complaining, and do so for
1697 alias specializations as well.
1698 (instantiate_template): Pass false as 'use_spec_table'
1699 to tsubst_decl. Call register_specialization afterwards.
1701 2023-07-18 Jason Merrill <jason@redhat.com>
1703 * constexpr.cc (cxx_eval_bit_cast): Check that the result of
1704 native_interpret_aggregate doesn't need more evaluation.
1706 2023-07-18 Patrick Palka <ppalka@redhat.com>
1708 * call.cc (add_template_conv_candidate): Don't check for
1709 non-empty 'candidates' here.
1710 (build_op_call): Check it here, before we've considered any
1711 conversion functions.
1713 2023-07-18 Patrick Palka <ppalka@redhat.com>
1716 * call.cc (add_conv_candidate): Check constraints.
1718 2023-07-17 Jason Merrill <jason@redhat.com>
1720 * constexpr.cc (cxx_eval_call_expression): Only cache
1721 reduced_constant_expression_p results.
1722 (reduced_constant_expression_p): Handle CONSTRUCTOR of scalar type.
1723 (cxx_eval_constant_expression): Fold vectors here.
1724 (cxx_eval_bare_aggregate): Not here.
1726 2023-07-15 Patrick Palka <ppalka@redhat.com>
1729 * call.cc (keep_unused_object_arg): Use cp_build_compound_expr
1730 instead of building a COMPOUND_EXPR directly.
1732 2023-07-15 Patrick Palka <ppalka@redhat.com>
1735 * mangle.cc (write_expression): Handle TEMPLATE_ID_EXPR
1736 whose template is already an IDENTIFIER_NODE.
1738 2023-07-14 Nathaniel Shead <nathanieloshead@gmail.com>
1740 * constexpr.cc (cxx_eval_constant_expression): Pass t to get_value.
1742 2023-07-14 Jason Merrill <jason@redhat.com>
1745 * constexpr.cc (cxx_eval_constant_expression): Move P2738 handling
1746 after heap handling.
1747 * name-lookup.cc (get_cxx_dialect_name): Add C++26.
1749 2023-07-14 Marek Polacek <polacek@redhat.com>
1750 Jason Merrill <jason@redhat.com>
1753 * decl.cc (cp_finish_decl): Set TREE_CONSTANT when initializing
1754 an object of empty class type.
1755 * pt.cc (value_dependent_expression_p) <case VAR_DECL>: Treat a
1756 constexpr-declared non-constant variable as value-dependent.
1758 2023-07-11 Patrick Palka <ppalka@redhat.com>
1761 * pt.cc (lookup_template_variable): Pass all levels of arguments
1762 to coerce_template_parms, and use the parameters from the most
1765 2023-07-10 Patrick Palka <ppalka@redhat.com>
1768 * pt.cc (redeclare_class_template): Relax the ttp DECL_CONTEXT
1769 assert, and downgrade it to a checking assert.
1771 2023-06-30 Patrick Palka <ppalka@redhat.com>
1773 * cp-tree.h (TEMPLATE_PARM_DESCENDANTS): Harden.
1774 (TEMPLATE_TYPE_DESCENDANTS): Define.
1775 (TEMPLATE_TEMPLATE_PARM_SIMPLE_P): Define.
1776 * pt.cc (reduce_template_parm_level): Revert
1777 r14-418-g0bc2a1dc327af9 change.
1778 (process_template_parm): Set TEMPLATE_TEMPLATE_PARM_SIMPLE_P
1780 (uses_outer_template_parms): Determine the outer depth of
1781 a template template parm without relying on DECL_CONTEXT.
1782 (tsubst) <case TEMPLATE_TEMPLATE_PARM>: Cache lowering a
1783 simple template template parm. Consistently use 'code'.
1785 2023-06-29 Patrick Palka <ppalka@redhat.com>
1788 * init.cc (maybe_instantiate_nsdmi_init): Mask out all
1789 tsubst flags except for tf_warning_or_error.
1791 2023-06-29 Patrick Palka <ppalka@redhat.com>
1794 * cp-gimplify.cc (cp_fold) <case CONSTRUCTOR>: Propagate
1795 CONSTRUCTOR_MUTABLE_POISON.
1797 2023-06-29 Patrick Palka <ppalka@redhat.com>
1799 * cp-tree.h (tree_template_info::partial): New data member.
1800 (TI_PARTIAL_INFO): New tree accessor.
1801 (most_specialized_partial_spec): Add defaulted bool parameter.
1802 * module.cc (trees_out::core_vals) <case TEMPLATE_INFO>: Stream
1804 (trees_in::core_vals) <case TEMPLATE_INFO>: Likewise.
1805 * parser.cc (specialization_of): Adjust after making
1806 most_specialized_partial_spec return TEMPLATE_INFO instead
1808 * pt.cc (process_partial_specialization): Set TI_PARTIAL_INFO
1809 of 'decl' to point back to the partial TEMPLATE_DECL. Likewise
1810 (and pass rechecking=true to most_specialization_partial_spec).
1811 (instantiate_class_template): Likewise.
1812 (instantiate_template): Set TI_PARTIAL_INFO to the result of
1813 most_specialization_partial_spec after forming a variable
1814 template specialization.
1815 (most_specialized_partial_spec): Add 'rechecking' parameter.
1816 Exit early if the template is not primary. Use the TI_PARTIAL_INFO
1817 of the corresponding TEMPLATE_INFO as a cache unless 'rechecking'
1818 is true. Don't bother setting TREE_TYPE of each TREE_LIST.
1819 (instantiate_decl): Adjust after making
1820 most_specialized_partial_spec return TEMPLATE_INFO instead of
1822 * ptree.cc (cxx_print_xnode) <case TEMPLATE_INFO>: Dump
1825 2023-06-29 Eugene Rozenfeld <erozen@microsoft.com>
1827 * Make-lang.in: Pass correct stage cc1plus when processing
1828 profile data collected while building target libraries
1830 2023-06-28 Patrick Palka <ppalka@redhat.com>
1834 * cp-tree.h (lookup_template_variable): Add complain parameter.
1835 * parser.cc (cp_parser_template_id): Pass tf_warning_or_error
1836 to lookup_template_variable.
1837 * pt.cc (lookup_template_variable): Add complain parameter.
1838 Coerce template arguments here ...
1839 (finish_template_variable): ... instead of here.
1840 (lookup_and_finish_template_variable): Check for error_mark_node
1841 result from lookup_template_variable.
1842 (tsubst_copy) <case TEMPLATE_ID_EXPR>: Pass complain to
1843 lookup_template_variable.
1844 (instantiate_template): Use build2 instead of
1845 lookup_template_variable to build a TEMPLATE_ID_EXPR
1846 for most_specialized_partial_spec.
1848 2023-06-28 Marek Polacek <polacek@redhat.com>
1851 * typeck.cc (cp_build_unary_op): Check tf_warning before warning.
1853 2023-06-28 Jason Merrill <jason@redhat.com>
1856 * cp-tree.h (clone_attrs): Declare.
1857 * method.cc (implicitly_declare_fn): Use it for inherited
1859 * optimize.cc (clone_attrs): New.
1860 (maybe_clone_body): Use it.
1862 2023-06-28 Jason Merrill <jason@redhat.com>
1865 * constexpr.cc (cxx_eval_constant_expression): In C++26, allow cast
1866 from void* to the type of a pointed-to object.
1868 2023-06-23 David Malcolm <dmalcolm@redhat.com>
1871 * cp-name-hint.h (maybe_suggest_missing_header): New decl.
1872 * decl.cc: Define INCLUDE_MEMORY. Add include of
1873 "cp/cp-name-hint.h".
1874 (start_decl_1): Call maybe_suggest_missing_header.
1875 * name-lookup.cc (maybe_suggest_missing_header): Remove "static".
1877 2023-06-16 Alex Coplan <alex.coplan@arm.com>
1879 * parser.cc (cp_parser_enum_specifier): Don't reject
1880 elaborated-type-specifier with enum-base, instead emit new
1881 Welaborated-enum-base warning.
1883 2023-06-14 Jason Merrill <jason@redhat.com>
1887 * call.cc (joust_maybe_elide_copy): Don't change cand.
1888 (joust): Move the elided tiebreaker later.
1890 2023-06-13 David Malcolm <dmalcolm@redhat.com>
1893 * name-lookup.cc (missing_std_header::~missing_std_header): Reword
1894 note to avoid negative tone of "forgetting".
1896 2023-06-13 Jason Merrill <jason@redhat.com>
1898 * tree.cc (build_target_expr): Check TYPE_HAS_MUTABLE_P.
1900 2023-06-12 Tobias Burnus <tobias@codesourcery.com>
1902 * parser.cc (cp_parser_omp_clause_map): Reword error message for
1903 clearness especially with 'omp target (enter/exit) data.'
1904 * semantics.cc (handle_omp_array_sections): Handle
1905 GOMP_MAP_{ALWAYS_,}PRESENT_{TO,TOFROM,FROM,ALLOC} enum values.
1907 2023-06-12 Jason Merrill <jason@redhat.com>
1910 * call.cc (convert_like_internal) [ck_list]: Use
1911 maybe_init_list_as_array.
1912 * constexpr.cc (cxx_eval_vec_init_1): Init might have
1914 * tree.cc (build_vec_init_elt): Likewise.
1915 * init.cc (build_vec_init): Handle from_array from a
1916 TARGET_EXPR. Retain TARGET_EXPR of a different type.
1918 2023-06-11 Patrick Palka <ppalka@redhat.com>
1921 * constexpr.cc (cxx_eval_call_expression): Synthesize defaulted
1922 functions needed for constant evaluation.
1923 (instantiate_cx_fn_r): Likewise.
1925 2023-06-11 Patrick Palka <ppalka@redhat.com>
1928 * pt.cc (lookup_template_class): Extend shortcut for looking up the
1929 current class scope to consider outer class scopes too, and use
1930 current_nonlambda_class_type instead of current_class_type. Only
1931 call coerce_template_parms when specializing a primary template.
1933 2023-06-10 Nathan Sidwell <nathan@acm.org>
1936 * pt.cc (maybe_adjust_types_for_deduction): Implement DR976.
1938 2023-06-09 Jason Merrill <jason@redhat.com>
1942 * method.cc (build_comparison_op): Give retval a name.
1943 * typeck.cc (check_return_expr): Fix for nameless variables.
1945 2023-06-09 Jason Merrill <jason@redhat.com>
1947 * parser.cc (cp_parser_simple_type_specifier): Check for auto
1948 in template argument.
1949 (cp_parser_template_type_arg): Remove auto checking.
1951 2023-06-09 Jason Merrill <jason@redhat.com>
1954 * call.cc (maybe_init_list_as_array): Check that the element type is
1957 2023-06-07 Jason Merrill <jason@redhat.com>
1961 * cp-tree.h (INIT_EXPR_NRV_P): New.
1962 * semantics.cc (finalize_nrv_r): Check it.
1963 * name-lookup.h (decl_in_scope_p): Declare.
1964 * name-lookup.cc (decl_in_scope_p): New.
1965 * typeck.cc (check_return_expr): Allow non-NRV
1966 returns if the NRV is no longer in scope.
1968 2023-06-07 Jason Merrill <jason@redhat.com>
1971 * typeck.cc (want_nrvo_p): New.
1972 (check_return_expr): Handle -Wnrvo.
1974 2023-06-07 Jason Merrill <jason@redhat.com>
1978 * decl.cc (finish_function): Simplify NRV handling.
1979 * except.cc (maybe_set_retval_sentinel): Also set if NRV.
1980 (maybe_splice_retval_cleanup): Don't add the cleanup region
1981 if we don't need it.
1982 * semantics.cc (nrv_data): Add simple field.
1983 (finalize_nrv): Set it.
1984 (finalize_nrv_r): Check it and retval sentinel.
1985 * cp-tree.h (finalize_nrv): Adjust declaration.
1986 * typeck.cc (check_return_expr): Remove named_labels check.
1988 2023-06-07 Jason Merrill <jason@redhat.com>
1991 * typeck.cc (check_return_expr): Prevent NRV in the presence of
1994 2023-06-07 Jason Merrill <jason@redhat.com>
1997 * except.cc (maybe_splice_retval_cleanup): Change
1998 recognition of function body and try scopes.
1999 * semantics.cc (do_poplevel): Call it after poplevel.
2000 (at_try_scope): New.
2001 * cp-tree.h (maybe_splice_retval_cleanup): Adjust.
2003 2023-06-07 Jason Merrill <jason@redhat.com>
2005 * semantics.cc (finalize_nrv_r): [RETURN_EXPR]: Only replace the
2008 2023-06-06 Kwok Cheung Yeung <kcy@codesourcery.com>
2009 Tobias Burnus <tobias@codesourcery.com>
2011 * parser.cc (cp_parser_omp_clause_defaultmap,
2012 cp_parser_omp_clause_map): Parse 'present'.
2013 (cp_parser_omp_clause_from_to): New; parse to/from
2014 clauses with optional 'present' modifier.
2015 (cp_parser_omp_all_clauses): Update call.
2016 (cp_parser_omp_target_data, cp_parser_omp_target_enter_data,
2017 cp_parser_omp_target_exit_data): Handle new enum value for
2019 * semantics.cc (finish_omp_target): Likewise.
2021 2023-06-04 Jason Merrill <jason@redhat.com>
2024 * cp-tree.h (enum cp_tree_index): Add CPTI_CALL_TERMINATE_FN.
2025 (call_terminate_fn): New macro.
2026 * cp-gimplify.cc (gimplify_must_not_throw_expr): Use it.
2027 * except.cc (init_exception_processing): Set it.
2028 (cp_protect_cleanup_actions): Return it.
2030 2023-06-03 Patrick Palka <ppalka@redhat.com>
2033 * pt.cc (is_specialization_of_friend): Fix overbroad check for
2034 a non-template member function of a class template.
2036 2023-06-03 Patrick Palka <ppalka@redhat.com>
2038 * pt.cc (iterative_hash_template_arg): Don't hash
2039 TEMPLATE_TEMPLATE_PARM specially.
2041 2023-06-03 Patrick Palka <ppalka@redhat.com>
2043 * class.cc (build_base_path): Check in_template_context instead
2044 of in_template_function.
2045 (resolves_to_fixed_type_p): Likewise.
2046 * cp-tree.h (in_template_context): Define.
2047 (in_template_function): Remove.
2048 * decl.cc (cp_make_fname_decl): Check current_function_decl
2049 and in_template_context instead of in_template_function.
2050 * decl2.cc (mark_used): Check in_template_context instead of
2051 in_template_function.
2052 * pt.cc (in_template_function): Remove.
2053 * semantics.cc (enforce_access): Check in_template_context
2054 instead of current_template_parms directly.
2056 2023-06-03 Patrick Palka <ppalka@redhat.com>
2059 * mangle.cc (write_expression): Handle NOEXCEPT_EXPR.
2061 2023-06-02 Jason Merrill <jason@redhat.com>
2065 * call.cc (sfk_copy_or_move): New.
2066 (joust): Add tiebreaker for explicit conv and copy ctor.
2068 2023-06-02 Jason Merrill <jason@redhat.com>
2072 * call.cc (maybe_init_list_as_array): Set DECL_MERGEABLE.
2073 (convert_like_internal) [ck_list]: Set it.
2074 (set_up_extended_ref_temp): Copy it.
2075 * tree.cc (handle_no_unique_addr_attribute): Set it.
2077 2023-06-01 Jason Merrill <jason@redhat.com>
2079 * typeck2.cc (check_narrowing): Check flag_permissive.
2081 2023-05-30 Tobias Burnus <tobias@codesourcery.com>
2084 * parser.cc (cp_parser_oacc_all_clauses,
2085 cp_parser_omp_all_clauses): Improve error wording.
2087 2023-05-19 Andrew Pinski <apinski@marvell.com>
2090 * lang-specs.h ("@c++-header"): Add %w after
2092 ("@c++-system-header"): Likewise.
2093 ("@c++-user-header"): Likewise.
2095 2023-05-19 Patrick Palka <ppalka@redhat.com>
2097 * constraint.cc (normalize_concept_check): Avoid having to do
2098 two norm_cache lookups. Remove unnecessary early exit for an
2099 ill-formed concept definition.
2101 2023-05-19 Patrick Palka <ppalka@redhat.com>
2104 * pt.cc (lookup_and_finish_template_variable): Don't call
2105 convert_from_reference.
2106 (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Call
2107 convert_from_reference on the result of
2108 lookup_and_finish_template_variable.
2110 2023-05-18 Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
2112 * call.cc (promoted_arithmetic_type_p): Use _P defines from tree.h.
2113 (build_conditional_expr): Ditto.
2114 (convert_like_internal): Ditto.
2115 (convert_arg_to_ellipsis): Ditto.
2116 (build_over_call): Ditto.
2117 (compare_ics): Ditto.
2118 * class.cc (is_empty_base_ref): Ditto.
2119 * coroutines.cc (rewrite_param_uses): Ditto.
2120 * cp-tree.h (DECL_DISCRIMINATOR_P): Ditto.
2121 (ARITHMETIC_TYPE_P): Ditto.
2122 * cvt.cc (ocp_convert): Ditto.
2123 * cxx-pretty-print.cc (pp_cxx_template_argument_list): Ditto.
2124 * decl.cc (layout_var_decl): Ditto.
2125 (get_tuple_size): Ditto.
2126 * error.cc (dump_simple_decl): Ditto.
2127 * lambda.cc (start_lambda_scope): Ditto.
2128 * mangle.cc (write_template_arg): Ditto.
2129 * method.cc (spaceship_comp_cat): Ditto.
2130 * module.cc (node_template_info): Ditto.
2131 (trees_out::start): Ditto.
2132 (trees_out::decl_node): Ditto.
2133 (trees_in::read_var_def): Ditto.
2134 (set_instantiating_module): Ditto.
2135 * name-lookup.cc (maybe_record_mergeable_decl): Ditto.
2136 (consider_decl): Ditto.
2137 (maybe_add_fuzzy_decl): Ditto.
2138 * pt.cc (convert_nontype_argument): Ditto.
2139 * semantics.cc (handle_omp_array_sections_1): Ditto.
2140 (finish_omp_clauses): Ditto.
2141 (finish_omp_target_clauses_r): Ditto.
2142 (is_this_parameter): Ditto.
2143 * tree.cc (build_cplus_array_type): Ditto.
2144 (is_this_expression): Ditto.
2145 * typeck.cc (do_warn_enum_conversions): Ditto.
2146 * typeck2.cc (store_init_value): Ditto.
2147 (check_narrowing): Ditto.
2149 2023-05-17 Jakub Jelinek <jakub@redhat.com>
2152 * init.cc (build_zero_init_1): Don't initialize zero-width bitfields.
2153 For unions only initialize the first FIELD_DECL.
2155 2023-05-16 Marek Polacek <polacek@redhat.com>
2158 * typeck.cc (check_return_expr): In a template, return only after
2159 suppressing -Wdangling-reference.
2161 2023-05-16 Patrick Palka <ppalka@redhat.com>
2164 * call.cc (add_list_candidates): Check for invalid designated
2165 initialization sooner and even for types that have a list
2168 2023-05-11 Patrick Palka <ppalka@redhat.com>
2171 * typeck2.cc (poison_mutable_constructors): Define.
2172 (store_init_value): Use it instead of setting
2173 CONSTRUCTOR_MUTABLE_POISON directly.
2175 2023-05-11 Patrick Palka <ppalka@redhat.com>
2176 Jonathan Wakely <jwakely@redhat.com>
2181 * pt.cc (convert_nontype_argument_function): Remove linkage
2182 requirement for C++17 and later.
2183 (invalid_tparm_referent_p) <case ADDR_EXPR>: Restrict
2184 DECL_ARTIFICIAL rejection test to VAR_DECL.
2186 2023-05-10 Marek Polacek <polacek@redhat.com>
2189 * method.cc (build_trait_object): New.
2190 (assignable_expr): Use it.
2191 (ref_xes_from_temporary): Likewise.
2192 (is_convertible_helper): Likewise. Check FUNC_OR_METHOD_TYPE_P.
2194 2023-05-10 Jason Merrill <jason@redhat.com>
2196 * call.cc (convert_like_internal): Share ck_ref_bind handling
2197 between all bad conversions.
2199 2023-05-10 Jason Merrill <jason@redhat.com>
2202 * constexpr.cc (cxx_eval_outermost_constant_expr): Preserve
2204 (potential_constant_expression_1): Check TARGET_EXPR_ELIDING_P.
2205 * typeck2.cc (store_init_value): Diagnose constinit sooner.
2207 2023-05-10 Jason Merrill <jason@redhat.com>
2209 * constexpr.cc (cxx_eval_outermost_constant_expr): Always check
2210 for address of immediate fn.
2211 (maybe_constant_init_1): Evaluate PTRMEM_CST.
2213 2023-05-10 Jakub Jelinek <jakub@redhat.com>
2216 * parser.cc (cp_parser_std_attribute): For unknown attributes with
2217 arguments set TREE_VALUE (attribute) to error_mark_node after skipping
2218 the balanced tokens.
2219 (cp_parser_std_attribute_list): If ... is used after attribute without
2220 arguments, diagnose it and return error_mark_node. If
2221 TREE_VALUE (attribute) is error_mark_node, don't call
2222 make_pack_expansion nor return early error_mark_node.
2224 2023-05-09 Patrick Palka <ppalka@redhat.com>
2227 * constraint.cc (satisfaction_cache::satisfaction_cache): In the
2228 unexpected case of evaluating an atom for the first time noisily,
2229 remove the cache slot that we inserted.
2231 2023-05-09 Patrick Palka <ppalka@redhat.com>
2234 * parser.cc (cp_parser_class_specifier): Don't pass a class
2235 context to noexcept_override_late_checks.
2236 (noexcept_override_late_checks): Remove 'type' parameter
2237 and use DECL_CONTEXT of 'fndecl' instead.
2239 2023-05-09 Jakub Jelinek <jakub@redhat.com>
2242 * cp-gimplify.cc (process_stmt_assume_attribute): Diagnose pack
2243 expansion of assume attribute.
2245 2023-05-08 Patrick Palka <ppalka@redhat.com>
2249 * pt.cc (do_auto_deduction): Move up resolve_nondeduced_context
2250 calls to happen before do_class_deduction. Add some
2251 error_mark_node tests.
2253 2023-05-07 Patrick Palka <ppalka@redhat.com>
2256 * cxx-pretty-print.cc (cxx_pretty_printer::unary_expression)
2257 <case ALIGNOF_EXPR>: Consider ALIGNOF_EXPR_STD_P.
2258 * error.cc (dump_expr) <case ALIGNOF_EXPR>: Likewise.
2260 2023-05-07 Patrick Palka <ppalka@redhat.com>
2264 * decl.cc (decl_jump_unsafe): Return bool instead of int.
2265 Don't consider TYPE_HAS_NONTRIVIAL_DESTRUCTOR.
2266 (check_previous_goto_1): Simplify now that decl_jump_unsafe
2267 returns bool instead of int.
2268 (check_goto): Likewise.
2270 2023-05-07 Patrick Palka <ppalka@redhat.com>
2272 * pt.cc (instantiate_alias_template): Exit early upon
2273 error from coerce_template_parms. Remove dependence test
2274 guarding constraints_satisfied_p.
2276 2023-05-07 Patrick Palka <ppalka@redhat.com>
2278 * cp-tree.h (PLACEHOLDER_TYPE_CONSTRAINTS_INFO): Harden via
2279 TEMPLATE_TYPE_PARM_CHECK.
2280 (TPARMS_PRIMARY_TEMPLATE): Harden via TREE_VEC_CHECK.
2281 (TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL): Harden via
2282 TEMPLATE_TEMPLATE_PARM_CHECK.
2283 * cxx-pretty-print.cc (cxx_pretty_printer::simple_type_specifier):
2284 Guard PLACEHOLDER_TYPE_CONSTRAINTS access.
2285 * error.cc (dump_type) <case TEMPLATE_TYPE_PARM>: Use separate
2286 variable to store CLASS_PLACEHOLDER_TEMPLATE result.
2287 * pt.cc (outer_template_args): Use strip_innermost_template_args.
2288 (any_type_dependent_arguments_p): Exit early if
2289 !processing_template_decl. Use range-based for.
2290 (any_dependent_template_arguments_p): Likewise.
2292 2023-05-07 Patrick Palka <ppalka@redhat.com>
2295 * pt.cc (tsubst_copy_and_build) <case COMPONENT_REF>: Propagate
2296 REF_PARENTHESIZED_P more generally via force_paren_expr.
2297 * semantics.cc (force_paren_expr): Document default argument.
2299 2023-05-07 Patrick Palka <ppalka@redhat.com>
2302 * pt.cc (coerce_template_args_for_ttp): Mention we can hit the
2303 current_template_parms fallback when level-lowering a bound ttp.
2304 (tsubst_template_decl): Add lambda_tparms parameter. Prefer to
2305 use lambda_tparms instead of substituting DECL_TEMPLATE_PARMS.
2306 (tsubst_decl) <case TEMPLATE_DECL>: Pass NULL_TREE as lambda_tparms
2307 to tsubst_template_decl.
2308 (tsubst_lambda_expr): For a generic lambda, substitute
2309 DECL_TEMPLATE_PARMS and set current_template_parms to it
2310 before substituting the function type. Pass the substituted
2311 DECL_TEMPLATE_PARMS as lambda_tparms to tsubst_template_decl.
2313 2023-05-07 Patrick Palka <ppalka@redhat.com>
2316 * semantics.cc (enforce_access): Check current_template_parms
2317 instead of processing_template_decl when deciding whether to
2318 defer the access check.
2320 2023-05-07 Patrick Palka <ppalka@redhat.com>
2323 * constexpr.cc (potential_constant_expression_1) <case CALL_EXPR>:
2324 Reorganize to call get_fns sooner. Remove special handling of
2325 the object argument of a non-static member function call. Remove
2326 dead store to 'fun'.
2328 2023-05-05 Jason Merrill <jason@redhat.com>
2331 2023-04-27 Jason Merrill <jason@redhat.com>
2334 * pt.cc (instantiate_decl): Assert !defer_ok for local
2337 2023-05-03 Jason Merrill <jason@redhat.com>
2341 * friend.cc (do_friend): Don't call check_explicit_specialization if
2342 DECL_TEMPLATE_INFO is already set.
2343 * decl2.cc (check_classfn): Set DECL_TEMPLATE_INFO.
2344 * name-lookup.cc (set_decl_namespace): Likewise.
2346 2023-05-03 Jakub Jelinek <jakub@redhat.com>
2348 * cp-gimplify.cc (cp_fold_data): Move definition earlier.
2349 (cp_gimplify_expr): Pass address of ff_genericize | ff_mce_false
2350 constructed data rather than &pset to cp_walk_tree with cp_fold_r.
2352 2023-05-03 Jason Merrill <jason@redhat.com>
2354 * pt.cc (reduce_template_parm_level): Fix comparison of
2355 template template parm to cached version.
2357 2023-05-02 Jason Merrill <jason@redhat.com>
2359 * pt.cc (instantiate_class_template): Skip the RECORD_TYPE
2360 of a class template.
2361 (tsubst_template_decl): Clear CLASSTYPE_USE_TEMPLATE.
2363 2023-05-02 Jason Merrill <jason@redhat.com>
2365 * name-lookup.cc (pop_from_top_level): Don't
2366 invalidate_class_lookup_cache.
2368 2023-05-02 Jason Merrill <jason@redhat.com>
2371 * cp-tree.h (lookup_base): Add offset parm.
2372 * constexpr.cc (cxx_fold_indirect_ref_1): Pass it.
2373 * search.cc (struct lookup_base_data_s): Add offset.
2374 (dfs_lookup_base): Handle it.
2375 (lookup_base): Pass it.
2377 2023-05-02 Jason Merrill <jason@redhat.com>
2380 * constexpr.cc (cxx_fold_indirect_ref_1): Handle empty base first.
2382 2023-05-01 Jason Merrill <jason@redhat.com>
2385 * name-lookup.cc (maybe_push_to_top_level)
2386 (maybe_pop_from_top_level): Split out...
2387 * pt.cc (instantiate_body): ...from here.
2388 * init.cc (maybe_instantiate_nsdmi_init): Use them.
2389 * name-lookup.h: Declare them..
2391 2023-04-28 Eugene Rozenfeld <erozen@microsoft.com>
2393 * Make-lang.in: Merge perf data collected when compiling cc1plus and runtime libraries
2395 2023-04-27 Jason Merrill <jason@redhat.com>
2397 * call.cc (print_conversion_rejection): Use iloc_sentinel.
2399 2023-04-27 Jason Merrill <jason@redhat.com>
2402 * pt.cc (instantiate_decl): Assert !defer_ok for local
2405 2023-04-26 Jason Merrill <jason@redhat.com>
2407 * init.cc (nsdmi_inst): Remove.
2408 (maybe_instantiate_nsdmi_init): Use DECL_INITIAL instead.
2410 2023-04-26 Jason Merrill <jason@redhat.com>
2413 * pt.cc (instantiate_class_template): Do partially instantiate.
2414 (tsubst_expr): Do call complete_type for partial instantiations.
2416 2023-04-26 Jason Merrill <jason@redhat.com>
2419 * pt.cc (regenerate_decl_from_template): Skip unique friends.
2421 2023-04-26 Patrick Palka <ppalka@redhat.com>
2423 * pt.cc (most_specialized_partial_spec): Exit early when
2424 DECL_TEMPLATE_SPECIALIZATIONS is empty. Move local variable
2425 declarations closer to their first use. Remove redundant
2426 flag_concepts test. Remove redundant forward declaration.
2428 2023-04-25 Patrick Palka <ppalka@redhat.com>
2431 * pt.cc (value_dependent_expression_p) <case VAR_DECL>:
2432 Suppress conservative early exit for reference variables
2433 when DECL_HAS_VALUE_EXPR_P.
2435 2023-04-25 Tobias Burnus <tobias@codesourcery.com>
2437 * parser.cc (cp_parser_omp_scan_loop_body): Handle
2438 zero exec statements before/after 'omp scan'.
2440 2023-04-24 Patrick Palka <ppalka@redhat.com>
2442 * cp-tree.h (cp_expr_location): Define here.
2443 * tree.cc (cp_expr_location): Don't define here.
2445 2023-04-21 Jason Merrill <jason@redhat.com>
2448 * decl.cc (grokdeclarator): Don't clear typedef_decl after 'unsigned
2449 typedef' pedwarn. Use c_common_signed_or_unsigned_type. Also
2450 handle 'signed typedef'.
2452 2023-04-21 Patrick Palka <ppalka@redhat.com>
2454 * tree.cc (cp_walk_subtrees): Avoid repeatedly dereferencing tp.
2455 <case DECLTYPE_TYPE>: Use cp_unevaluated and WALK_SUBTREE.
2456 <case ALIGNOF_EXPR etc>: Likewise.
2458 2023-04-20 Patrick Palka <ppalka@redhat.com>
2460 * pt.cc (tsubst) <case TEMPLATE_TYPE_PARM>: Don't recurse when
2461 level lowering a cv-qualified type template parameter. Remove
2462 recursive loop breaker in the level lowering case for constrained
2463 autos. Use the TEMPLATE_PARM_DESCENDANTS cache in this case as
2466 2023-04-20 Patrick Palka <ppalka@redhat.com>
2468 * constraint.cc (diagnose_trait_expr): Convert a TREE_VEC
2469 of arguments into a TREE_LIST for sake of pretty printing.
2470 * cxx-pretty-print.cc (pp_cxx_trait): Handle TREE_VEC
2471 instead of TREE_LIST of trailing variadic trait arguments.
2472 * method.cc (constructible_expr): Likewise.
2473 (is_xible_helper): Likewise.
2474 * parser.cc (cp_parser_trait): Represent trailing variadic trait
2475 arguments as a TREE_VEC instead of TREE_LIST.
2476 * pt.cc (value_dependent_expression_p): Handle TREE_VEC
2477 instead of TREE_LIST of trailing variadic trait arguments.
2478 * semantics.cc (finish_type_pack_element): Likewise.
2479 (check_trait_type): Likewise.
2481 2023-04-20 Patrick Palka <ppalka@redhat.com>
2483 * tree.cc (strip_typedefs): Move TREE_LIST handling to
2484 strip_typedefs_expr. Dispatch to strip_typedefs_expr for
2486 <case TYPENAME_TYPE>: Remove manual dispatching to
2487 strip_typedefs_expr.
2488 <case TRAIT_TYPE>: Likewise.
2489 (strip_typedefs_expr): Replaces calls to strip_typedefs_expr
2490 with strip_typedefs throughout. Don't dispatch to strip_typedefs
2492 <case TREE_LIST>: Replace this with the better version from
2495 2023-04-19 Patrick Palka <ppalka@redhat.com>
2496 Jonathan Wakely <jwakely@redhat.com>
2499 * cp-trait.def (TYPE_PACK_ELEMENT): Define.
2500 * cp-tree.h (finish_trait_type): Add complain parameter.
2501 * cxx-pretty-print.cc (pp_cxx_trait): Handle
2502 CPTK_TYPE_PACK_ELEMENT.
2503 * parser.cc (cp_parser_constant_expression): Document default
2505 (cp_parser_trait): Handle CPTK_TYPE_PACK_ELEMENT. Pass
2506 tf_warning_or_error to finish_trait_type.
2507 * pt.cc (tsubst) <case TRAIT_TYPE>: Handle non-type first
2508 argument. Pass complain to finish_trait_type.
2509 * semantics.cc (finish_type_pack_element): Define.
2510 (finish_trait_type): Add complain parameter. Handle
2511 CPTK_TYPE_PACK_ELEMENT.
2512 * tree.cc (strip_typedefs): Handle non-type first argument.
2513 Pass tf_warning_or_error to finish_trait_type.
2514 * typeck.cc (structural_comptypes) <case TRAIT_TYPE>: Use
2515 cp_tree_equal instead of same_type_p for the first argument.
2517 2023-04-19 Patrick Palka <ppalka@redhat.com>
2520 * pt.cc (try_class_unification): Don't ggc_free the copy of
2523 2023-04-19 Jason Merrill <jason@redhat.com>
2526 * decl.cc (grokdeclarator): Keep typedef_decl for __int128_t.
2528 2023-04-17 Patrick Palka <ppalka@redhat.com>
2531 * pt.cc (tsubst) <case BOUND_TEMPLATE_TEMPLATE_PARM>:
2532 In the level-lowering case just use lookup_template_class
2533 to rebuild the bound ttp.
2535 2023-04-15 Jason Merrill <jason@redhat.com>
2538 * constexpr.cc (cxx_eval_constant_expression) [TARGET_EXPR]:
2539 Check for complex initializer.
2541 2023-04-13 Patrick Palka <ppalka@redhat.com>
2544 * decl.cc (make_typename_type): Also ignore non-types during the
2545 lookup if tag_type corresponds to an elaborated-type-specifier.
2546 * pt.cc (tsubst) <case TYPENAME_TYPE>: Pass class_type or
2547 enum_type as tag_type to make_typename_type accordingly instead
2548 of always passing typename_type.
2550 2023-04-13 Jason Merrill <jason@redhat.com>
2553 * semantics.cc (check_trait_type): Handle incomplete type directly.
2554 * typeck2.cc (cxx_incomplete_type_diagnostic): Remove assert.
2556 2023-04-13 Jason Merrill <jason@redhat.com>
2558 * typeck2.cc (cxx_incomplete_type_diagnostic): Return bool.
2559 * cp-tree.h (cxx_incomplete_type_diagnostic): Adjust.
2561 2023-04-12 Jakub Jelinek <jakub@redhat.com>
2563 * Make-lang.in (s-cp-module-version): New target.
2564 (cp/module.o): Depend on it.
2565 (MODULE_VERSION): Remove variable.
2566 (CFLAGS-cp/module.o): For -DMODULE_VERSION= argument just
2567 cat s-cp-module-version.
2569 2023-04-09 Iain Sandoe <iain@sandoe.co.uk>
2571 * coroutines.cc (coro_rewrite_function_body): Ensure that added
2572 bind expressions have scope blocks.
2574 2023-04-04 Jason Merrill <jason@redhat.com>
2577 * decl2.cc (find_last_decl): Return early if DECL_USE_TEMPLATE.
2579 2023-04-03 Patrick Palka <ppalka@redhat.com>
2582 * decl.cc (cp_finish_decl): Diagnose ordinary auto deduction
2583 with no initializer, instead of asserting.
2585 2023-04-01 Patrick Palka <ppalka@redhat.com>
2588 * cp-tree.h (do_auto_deduction): Add defaulted tmpl parameter.
2589 * pt.cc (convert_template_argument): Pass 'in_decl' as 'tmpl' to
2591 (tsubst_decl) <case VAR_/TYPE_DECL>: Pass 'tmpl' instead of 't' as
2592 'in_decl' to coerce_template_parms.
2593 (unify) <case TEMPLATE_PARM_INDEX>: Pass TPARMS_PRIMARY_TEMPLATE
2594 as 'tmpl' to do_auto_deduction.
2595 (do_auto_deduction): Document default arguments. Rename local
2596 variable 'tmpl' to 'ctmpl'. Use 'tmpl' to obtain a full set of
2597 template arguments for satisfaction in the adc_unify case.
2599 2023-04-01 Patrick Palka <ppalka@redhat.com>
2603 * pt.cc (invalid_tparm_referent_p): Accept ADDR_EXPR of
2605 (instantiate_class_template): Call mark_template_arguments_used.
2606 (tsubst_copy_and_build) <case CALL_EXPR>: Revert r13-995 change.
2607 (mark_template_arguments_used): Define.
2608 (instantiate_body): Call mark_template_arguments_used.
2610 2023-04-01 Iain Sandoe <iain@sandoe.co.uk>
2613 * coroutines.cc (flatten_await_stmt): Use the current count of
2614 promoted temporaries to build a unique name for the frame entries.
2616 2023-03-30 Jason Merrill <jason@redhat.com>
2619 * search.cc (type_context_for_name_lookup): New.
2620 (accessible_p): Handle anonymous union.
2621 * init.cc (maybe_instantiate_nsdmi_init): Use
2622 type_context_for_name_lookup.
2623 * parser.cc (cp_parser_class_specifier): Likewise.
2624 * cp-tree.h (type_context_for_name_lookup): Declare.
2626 2023-03-30 Jason Merrill <jason@redhat.com>
2629 * pt.cc (unify) [FUNCTION_TYPE]: Handle function pointer
2632 2023-03-30 Jakub Jelinek <jakub@redhat.com>
2635 * decl2.cc (grok_array_decl): After emitting a pedwarn for
2636 -Wcomma-subscript, if processing_template_decl set orig_index_exp
2637 to compound expr from orig_index_exp_list.
2639 2023-03-30 Jason Merrill <jason@redhat.com>
2643 * decl2.cc (record_mangling): Use symtab_node::reset.
2645 2023-03-30 Jakub Jelinek <jakub@redhat.com>
2648 * call.cc (convert_like_internal): If pedwarn for extended float
2649 type conversions doesn't report anything, avoid calling
2650 maybe_inform_about_fndecl_for_bogus_argument_init.
2652 2023-03-29 Jason Merrill <jason@redhat.com>
2656 * pt.cc (alias_ctad_tweaks): Rewrite deduced args.
2657 (type_targs_deducible_from): Handle null pack deduction.
2659 2023-03-28 David Malcolm <dmalcolm@redhat.com>
2662 * parser.cc (cp_parser_binary_expression): Update for new param of
2663 check_for_xor_used_as_pow.
2665 2023-03-28 Jakub Jelinek <jakub@redhat.com>
2668 * contracts.cc: Include intl.h.
2669 (check_postcondition_result): Don't form diagnostics from two halves
2670 of an English message to allow translations.
2672 2023-03-24 Patrick Palka <ppalka@redhat.com>
2675 * parser.cc (cp_parser_class_specifier): Clear current_class_ptr
2676 and current_class_ref sooner, before parsing a class definition.
2678 2023-03-24 Jason Merrill <jason@redhat.com>
2681 * pt.cc (type_unification_real): Adjust for partial ordering.
2683 2023-03-23 Jason Merrill <jason@redhat.com>
2686 * typeck.cc (build_ptrmemfunc): Drop 0-offset optimization
2687 and location wrappers.
2689 2023-03-23 Marek Polacek <polacek@redhat.com>
2692 * call.cc (class_has_reference_member_p): New.
2693 (class_has_reference_member_p_r): New.
2694 (reference_like_class_p): Don't look for a specific constructor.
2695 Use a DFS walk with class_has_reference_member_p_r.
2697 2023-03-23 Jason Merrill <jason@redhat.com>
2700 * pt.cc (find_parameter_packs_r): Handle null TREE_BINFO.
2702 2023-03-22 Jason Merrill <jason@redhat.com>
2705 * pt.cc (unify): Use fold of build_nop instead of fold_convert.
2707 2023-03-22 Jason Merrill <jason@redhat.com>
2710 * semantics.cc (finish_id_expression_1): Check scope before
2711 returning id_expression.
2713 2023-03-22 Alex Coplan <alex.coplan@arm.com>
2716 * call.cc (build_over_call): Use make_temp_override to suppress
2717 both unavailable and deprecated warnings when calling
2720 2023-03-21 Jason Merrill <jason@redhat.com>
2723 * init.cc (maybe_instantiate_nsdmi_init): Don't leave
2724 current_function_decl set to a constructor.
2726 2023-03-20 Marek Polacek <polacek@redhat.com>
2729 * call.cc (add_template_candidate_real): Add explicit decls to the
2730 set of candidates when the initializer is a braced-init-list.
2732 2023-03-20 Jakub Jelinek <jakub@redhat.com>
2735 * cp-tree.h (var_needs_tls_wrapper): Declare.
2736 * decl2.cc (var_needs_tls_wrapper): No longer static.
2737 * decl.cc (cp_finish_decl): Clear TREE_READONLY on TLS variables
2738 for which a TLS wrapper will be needed.
2740 2023-03-17 Jason Merrill <jason@redhat.com>
2743 * lambda.cc (prune_lambda_captures): Don't bother in a template.
2745 2023-03-17 Jason Merrill <jason@redhat.com>
2748 * except.cc (build_throw): Check dtor access.
2750 2023-03-17 Jason Merrill <jason@redhat.com>
2753 * friend.cc (do_friend): Handle namespace as scope argument.
2754 * decl.cc (grokdeclarator): Pass down in_namespace.
2756 2023-03-16 Jason Merrill <jason@redhat.com>
2759 * init.cc (get_nsdmi): Split out...
2760 (maybe_instantiate_nsdmi_init): ...this function.
2761 * cp-tree.h: Declare it.
2762 * pt.cc (tsubst_expr): Use it.
2764 2023-03-16 Jason Merrill <jason@redhat.com>
2767 * pt.cc (tsubst_expr) [TAG_DEFN]: Handle partial instantiation.
2769 2023-03-16 Jason Merrill <jason@redhat.com>
2772 * semantics.cc (finish_qualified_id_expr): Don't try to build a
2773 pointer-to-member if the scope is an enumeration.
2775 2023-03-16 Patrick Palka <ppalka@redhat.com>
2778 * constexpr.cc (maybe_constant_init_1): For an unevaluated
2779 non-manifestly-constant operand, don't constant evaluate
2780 and instead call fold_to_constant as in maybe_constant_value.
2782 2023-03-16 Patrick Palka <ppalka@redhat.com>
2785 * constraint.cc (satisfaction_cache::get): Relax overly strict
2786 checking assert in the constraint recursion case.
2788 2023-03-16 Jason Merrill <jason@redhat.com>
2791 * coroutines.cc (build_co_await): Handle lvalue 'o'.
2793 2023-03-15 Jason Merrill <jason@redhat.com>
2797 * typeck.cc (cp_build_modify_expr): Allow array initialization of
2798 DECL_ARTIFICIAL variable.
2800 2023-03-15 Marek Polacek <polacek@redhat.com>
2803 * constexpr.cc (cxx_eval_store_expression): Strip location wrappers.
2805 2023-03-15 Jason Merrill <jason@redhat.com>
2808 * semantics.cc (check_template_template_default_arg): Check
2809 maybe_get_template_decl_from_type_decl.
2811 2023-03-15 Jason Merrill <jason@redhat.com>
2816 * pt.cc (coerce_template_template_parms): Use args from
2817 DECL_CONTEXT (arg_tmpl) instead of outer_args.
2819 2023-03-15 Jason Merrill <jason@redhat.com>
2822 * pt.cc (coerce_template_template_parms): Take the arg and parm
2824 (coerce_template_template_parm): Adjust.
2825 (template_template_parm_bindings_ok_p): Adjust.
2826 (convert_template_argument): Adjust.
2828 2023-03-14 Patrick Palka <ppalka@redhat.com>
2831 * pt.cc (push_inline_template_parms_recursive): Set
2832 TEMPLATE_PARMS_CONSTRAINTS.
2833 (push_template_decl): For an out-of-line declaration, verify
2834 constraints for each enclosing template scope match those of the
2835 original template declaratation.
2837 2023-03-14 Patrick Palka <ppalka@redhat.com>
2840 * pt.cc (redeclare_class_template): Add missing "of" in
2841 constraint mismatch diagnostic.
2842 (tsubst_friend_class): For an already declared class template,
2843 substitute and pass the friend declaration's constraints to
2844 redeclare_class_template instead of passing the existing
2845 template's constraints.
2847 2023-03-14 Jason Merrill <jason@redhat.com>
2850 * pt.cc (unify_pack_expansion): Check that TPARMS_PRIMARY_TEMPLATE
2853 2023-03-14 Jason Merrill <jason@redhat.com>
2856 * cp-gimplify.cc (genericize_if_stmt): Restore folding
2857 of constant conditions.
2859 2023-03-14 Jakub Jelinek <jakub@redhat.com>
2862 * tree.cc (record_has_unique_obj_representations): Ignore unnamed
2865 2023-03-13 Jason Merrill <jason@redhat.com>
2868 * parser.cc (cp_parser_set_decl_spec_type): Use
2869 redefined_builtin_type for extended_float_type_p.
2871 2023-03-13 Marek Polacek <polacek@redhat.com>
2874 * call.cc (reference_like_class_p): Check for std::span.
2876 2023-03-10 Jakub Jelinek <jakub@redhat.com>
2879 * decl.cc (cp_finish_decl): Don't clear TREE_READONLY on
2880 automatic non-aggregate variables just because of
2881 -fmerge-all-constants.
2883 2023-03-10 Jakub Jelinek <jakub@redhat.com>
2886 * class.cc (end_of_class): For bit-fields, instead of computing
2887 offset as sum of byte_position (field) and DECL_SIZE_UNIT (field),
2888 compute it as sum of bit_position (field) and DECL_SIZE (field)
2889 divided by BITS_PER_UNIT rounded up.
2891 2023-03-10 Jason Merrill <jason@redhat.com>
2894 * lambda.cc (compare_lambda_template_head): Check more
2895 for error_mark_node.
2897 2023-03-10 Jason Merrill <jason@redhat.com>
2900 * mangle.cc (anon_aggr_naming_decl): New.
2901 (write_unqualified_name): Use it.
2903 2023-03-10 Jakub Jelinek <jakub@redhat.com>
2906 * decl.cc (poplevel): Suppress OPT_Wunused_variable warning
2907 after diagnosing it.
2909 2023-03-10 Jason Merrill <jason@redhat.com>
2912 * decl.cc (grokdeclarator): Handle non-typedef typedef_decl.
2914 2023-03-10 Jason Merrill <jason@redhat.com>
2917 * class.cc (instantiate_type): Strip location wrapper.
2919 2023-03-09 Jason Merrill <jason@redhat.com>
2922 * init.cc (find_allocator_temps_r): New.
2923 (combine_allocator_temps): Replace find_allocator_temp.
2924 (build_vec_init): Adjust.
2926 2023-03-09 Jason Merrill <jason@redhat.com>
2930 * pt.cc (alias_ctad_tweaks): Continue after deduction failure.
2932 2023-03-09 Jason Merrill <jason@redhat.com>
2933 Michael Spertus <mike@spertus.com>
2936 * pt.cc (corresponding_template_parameter_list): Split out...
2937 (corresponding_template_parameter): ...from here.
2938 (find_template_parameters): Factor out...
2939 (find_template_parameter_info::find_in): ...this function.
2940 (find_template_parameter_info::find_in_recursive): New.
2941 (find_template_parameter_info::found): New.
2942 (alias_ctad_tweaks): Only add parms used in the deduced args.
2944 2023-03-09 Jason Merrill <jason@redhat.com>
2946 * cp-trait.def (IS_DEDUCIBLE): Add space to name.
2948 2023-03-09 Jason Merrill <jason@redhat.com>
2951 * cp-trait.def (IS_DEDUCIBLE): New.
2952 * cxx-pretty-print.cc (pp_cxx_trait): Handle non-type.
2953 * parser.cc (cp_parser_trait): Likewise.
2954 * tree.cc (cp_tree_equal): Likewise.
2955 * pt.cc (tsubst_copy_and_build): Likewise.
2956 (type_targs_deducible_from): New.
2957 (alias_ctad_tweaks): Use it.
2958 * semantics.cc (trait_expr_value): Handle CPTK_IS_DEDUCIBLE.
2959 (finish_trait_expr): Likewise.
2960 * constraint.cc (diagnose_trait_expr): Likewise.
2961 * cp-tree.h (type_targs_deducible_from): Declare.
2963 2023-03-07 Jason Merrill <jason@redhat.com>
2967 * pt.cc (tsubst_function_decl): Don't replace the closure
2968 parameter if DECL_STATIC_FUNCTION_P.
2970 2023-03-07 Marek Polacek <polacek@redhat.com>
2973 * call.cc (reference_like_class_p): New.
2974 (do_warn_dangling_reference): Add new bool parameter. See through
2975 reference_like_class_p.
2977 2023-03-07 Jakub Jelinek <jakub@redhat.com>
2980 * rtti.cc (emit_support_tinfo_1): Don't assert that last
2981 unemitted_tinfo_decls element is tinfo, instead pop from it only in
2983 * decl2.cc (c_parse_final_cleanups): Don't call emit_tinfo_decl
2984 for unemitted_tinfO_decls which have already non-NULL DECL_INITIAL.
2986 2023-03-07 Marek Polacek <polacek@redhat.com>
2989 * constexpr.cc (cxx_eval_call_expression): Relax assert.
2991 2023-03-07 Marek Polacek <polacek@redhat.com>
2994 * constexpr.cc (potential_constant_expression_1) <case CALL_EXPR>: Pass
2995 'any' when recursing on a VAR_DECL and not a pointer to function.
2997 2023-03-04 Jakub Jelinek <jakub@redhat.com>
3000 * constexpr.cc: Include toplev.h.
3001 (cxx_eval_constant_expression) <case DECL_EXPR>: When seeing a local
3002 static initialized by constant expression outside of a constexpr
3003 function which has been deferred by make_rtl_for_nonlocal_decl,
3004 call rest_of_decl_compilation on it.
3006 2023-03-03 Patrick Palka <ppalka@redhat.com>
3009 * pt.cc (el_data::skipped_trees): New data member.
3010 (extract_locals_r): Push to skipped_trees any unevaluated
3011 contexts that we skipped over.
3012 (extract_local_specs): For the second walk, start from each
3013 tree in skipped_trees.
3015 2023-03-03 Alexandre Oliva <oliva@adacore.com>
3017 * typeck.cc (cp_build_binary_op): Suppress redundant warning
3018 for pfn null test in pmfn test with vbit-in-delta.
3020 2023-03-02 Jakub Jelinek <jakub@redhat.com>
3023 * cp-tree.h (enum cp_tree_index): Remove CPTI_FALLBACK_DFLOAT*_TYPE
3025 (fallback_dfloat32_type, fallback_dfloat64_type,
3026 fallback_dfloat128_type): Remove.
3027 * rtti.cc (emit_support_tinfo_1): If not emitted already, call
3028 emit_tinfo_decl and remove from unemitted_tinfo_decls right away.
3029 (emit_support_tinfos): Move &dfloat*_type_node from fundamentals array
3030 into new fundamentals_with_fallback array. Call emit_support_tinfo_1
3031 on elements of that array too, with the difference that if
3032 the type is NULL, use a fallback REAL_TYPE for it temporarily.
3033 Drop the !targetm.decimal_float_supported_p () handling. Call
3034 targetm.emit_support_tinfos at the end.
3035 * mangle.cc (write_builtin_type): Remove references to
3036 fallback_dfloat*_type. Handle bfloat16_type_node mangling.
3038 2023-03-02 Patrick Palka <ppalka@redhat.com>
3042 * cp-gimplify.cc (cp_fully_fold): Add an internal overload that
3043 additionally takes and propagate an mce_value parameter, and
3044 define the existing public overload in terms of it.
3045 (cp_fully_fold_init): Pass mce_false to cp_fully_fold.
3047 2023-03-02 Patrick Palka <ppalka@redhat.com>
3050 * constexpr.cc (maybe_constant_init_1): Override
3051 manifestly_const_eval to true if is_static.
3053 2023-03-02 Jakub Jelinek <jakub@redhat.com>
3056 * cp-gimplify.cc (cp_genericize_r) <case USING_STMT>: Set
3057 DECL_SOURCE_LOCATION on IMPORTED_DECL to expression location
3058 of USING_STMT or input_location.
3060 2023-03-02 Marek Polacek <polacek@redhat.com>
3063 * parser.cc (class_decl_loc_t::diag_mismatched_tags): If the first
3064 lookup of SPEC didn't find anything, try to look for
3065 most_general_template.
3067 2023-03-02 Jakub Jelinek <jakub@redhat.com>
3070 * parser.cc (cp_convert_omp_range_for): Allow in assert
3071 decomp_first_name without DECL_HAS_VALUE_EXPR_P if it has
3072 error_mark_node type.
3073 (cp_finish_omp_range_for): Don't set DECL_HAS_VALUE_EXPR_P back
3074 on decls which have error_mark_node type.
3076 2023-03-01 Marek Polacek <polacek@redhat.com>
3079 * constexpr.cc (cxx_eval_constant_expression): Emit an error when
3080 a PTRMEM_CST cannot be evaluated.
3082 2023-03-01 Patrick Palka <ppalka@redhat.com>
3084 * pt.cc (tsubst_scope): Define.
3085 (tsubst_decl) <case USING_DECL>: Call tsubst_scope instead of
3086 calling tsubst_scope with tf_qualifying_scope set.
3087 (tsubst_qualified_id): Call tsubst_scope instead of
3088 calling tsubst with tf_qualifying_scope set.
3089 (tsubst_copy): Immediately delegate to tsubst for all TYPE_P
3090 trees. Remove tf_qualifying_scope manipulation.
3091 <case SCOPE_REF>: Call tsubst_scope instead of calling
3092 tsubst with tf_qualifying_scope set.
3094 2023-03-01 Patrick Palka <ppalka@redhat.com>
3095 Jason Merrill <jason@redhat.com>
3099 * constexpr.cc (fold_to_constant): Define.
3100 (maybe_constant_value): Move up early exit test for unevaluated
3101 operands. Try reducing an unevaluated operand to a constant via
3103 (fold_non_dependent_expr_template): Add early exit test for
3104 CONSTANT_CLASS_P nodes. Try reducing an unevaluated operand
3105 to a constant via fold_to_constant.
3106 * cp-tree.h (fold_to_constant): Declare.
3108 2023-03-01 Jakub Jelinek <jakub@redhat.com>
3111 * constexpr.cc (potential_constant_expression_1) <case DECL_EXPR>:
3112 Only recurse on DECL_INITIAL (tmp) if tmp is a VAR_DECL, otherwise
3115 2023-02-28 Patrick Palka <ppalka@redhat.com>
3118 * pt.cc (finish_template_variable): Move dependence check
3120 (lookup_and_finish_template_variable): ... here.
3121 * semantics.cc (finish_id_expression_1): Call
3122 finish_template_variable sooner, before (and regardless of) the
3123 type_dependent_expression_p test.
3125 2023-02-28 Marek Polacek <polacek@redhat.com>
3128 * pt.cc (lookup_and_finish_template_variable): Clear tf_partial.
3130 2023-02-20 Marek Polacek <polacek@redhat.com>
3133 * constexpr.cc (cxx_eval_call_expression): Replace shortcutting trivial
3134 constructor/op= with a checking assert.
3136 2023-02-20 Marek Polacek <polacek@redhat.com>
3139 * pt.cc (prepend_one_capture): Set LAMBDA_CAPTURE_EXPLICIT_P.
3140 (tsubst_lambda_expr): Pass LAMBDA_CAPTURE_EXPLICIT_P to
3141 prepend_one_capture.
3143 2023-02-18 Jason Merrill <jason@redhat.com>
3153 * semantics.cc (finish_static_assert): Don't diagnose in
3156 2023-02-17 Patrick Palka <ppalka@redhat.com>
3160 * cp-gimplify.cc (enum fold_flags): Define.
3161 (fold_flags_t): Declare.
3162 (cp_fold_data::genericize): Replace this data member with ...
3163 (cp_fold_data::fold_flags): ... this.
3164 (cp_fold_r): Adjust use of cp_fold_data and calls to cp_fold.
3165 (cp_fold_function): Likewise.
3166 (cp_fold_maybe_rvalue): Add an internal overload that
3167 additionally takes and propagates a fold_flags_t parameter, and
3168 define the existing public overload in terms of it.
3169 (cp_fold_rvalue): Likewise.
3170 (cp_fully_fold_init): Adjust use of cp_fold_data.
3171 (fold_cache): Replace with ...
3172 (fold_caches): ... this 2-element array of caches.
3173 (get_fold_cache): Define.
3174 (clear_fold_cache): Adjust.
3175 (cp_fold): Add fold_flags_t parameter. Use get_fold_cache.
3176 Pass flags to calls to cp_fold, cp_fold_rvalue and
3177 cp_fold_maybe_rvalue.
3178 <case CALL_EXPR>: If ff_mce_false is set, fold
3179 __builtin_is_constant_evaluated to false and pass mce_false to
3180 maybe_constant_value.
3182 2023-02-17 Patrick Palka <ppalka@redhat.com>
3184 * constexpr.cc (constexpr_call::manifestly_const_eval): Give
3185 it type int instead of bool.
3186 (constexpr_ctx::manifestly_const_eval): Give it type mce_value
3188 (cxx_eval_builtin_function_call): Adjust after making
3189 manifestly_const_eval tri-state.
3190 (cxx_eval_call_expression): Likewise.
3191 (cxx_eval_binary_expression): Likewise.
3192 (cxx_eval_conditional_expression): Likewise.
3193 (cxx_eval_constant_expression): Likewise.
3194 (cxx_eval_outermost_constant_expr): Likewise.
3195 (cxx_constant_value): Likewise.
3196 (cxx_constant_dtor): Likewise.
3197 (maybe_constant_value): Give manifestly_const_eval parameter
3198 type mce_value instead of bool and adjust accordingly.
3199 (fold_non_dependent_expr_template): Adjust call
3200 to cxx_eval_outermost_constant_expr.
3201 (fold_non_dependent_expr): Likewise.
3202 (maybe_constant_init_1): Likewise.
3203 * constraint.cc (satisfy_atom): Adjust call to
3204 maybe_constant_value.
3205 * cp-tree.h (enum class mce_value): Define.
3206 (maybe_constant_value): Adjust manifestly_const_eval parameter
3207 type and default argument.
3208 * decl.cc (compute_array_index_type_loc): Adjust call to
3209 maybe_constant_value.
3210 * pt.cc (convert_nontype_argument): Likewise.
3212 2023-02-16 Patrick Palka <ppalka@redhat.com>
3215 * cp-tree.h (enum tsubst_flags): New flag tf_qualifying_scope.
3216 * decl.cc (make_typename_type): Use lookup_member instead of
3217 lookup_field. If tf_qualifying_scope is set, pass want_type=true
3218 instead of =false to lookup_member. Generalize format specifier
3219 in diagnostic to handle both type and non-type bindings.
3220 * pt.cc (tsubst_aggr_type_1): Clear tf_qualifying_scope. Tidy
3222 (tsubst_decl) <case USING_DECL>: Set tf_qualifying_scope when
3223 substituting USING_DECL_SCOPE.
3224 (tsubst): Clear tf_qualifying_scope right away and remember if
3225 it was set. Do the same for tf_tst_ok sooner.
3226 <case TYPENAME_TYPE>: Set tf_qualifying_scope when substituting
3227 TYPE_CONTEXT. Pass tf_qualifying_scope to make_typename_type
3229 (tsubst_qualified_id): Set tf_qualifying_scope when substituting
3231 (tsubst_copy): Clear tf_qualifying_scope and remember if it was
3233 <case SCOPE_REF>: Set tf_qualifying_scope when substituting the
3235 <case *_TYPE>: Pass tf_qualifying_scope to tsubst if it was set.
3236 * search.cc (lookup_member): Document default argument.
3238 2023-02-16 Patrick Palka <ppalka@redhat.com>
3240 * cp-tree.h: Mechanically drop static from static inline
3241 functions via s/^static inline/inline/g.
3243 2023-02-15 Marek Polacek <polacek@redhat.com>
3246 * call.cc (joust_maybe_elide_copy): Return false for ck_ambig.
3248 2023-02-10 Marek Polacek <polacek@redhat.com>
3251 * call.cc (set_up_extended_ref_temp): Pass var to maybe_constant_init.
3253 2023-02-09 Tobias Burnus <tobias@codesourcery.com>
3255 * parser.cc (cp_parser_omp_allocate): Parse align
3256 clause and check for restrictions.
3258 2023-02-09 Jakub Jelinek <jakub@redhat.com>
3261 * mangle.cc (write_expression, write_template_arg): Handle
3262 EXCESS_PRECISION_EXPR with REAL_CST operand as
3263 write_template_arg_literal on fold_convert of the REAL_CST
3264 to EXCESS_PRECISION_EXPR type.
3266 2023-02-06 Patrick Palka <ppalka@redhat.com>
3269 * cp-tree.h (call_expr_dependent_name): Declare.
3270 * pt.cc (iterative_hash_template_arg) <case CALL_EXPR>: Use
3271 call_expr_dependent_name instead of dependent_name.
3272 * tree.cc (call_expr_dependent_name): Define.
3273 (called_fns_equal): Adjust to take two CALL_EXPRs instead of
3274 CALL_EXPR_FNs thereof. Use call_expr_dependent_name instead
3276 (cp_tree_equal) <case CALL_EXPR>: Adjust call to called_fns_equal.
3278 2023-02-03 Marek Polacek <polacek@redhat.com>
3281 * constexpr.cc (cxx_eval_array_reference): Don't replace
3284 2023-02-03 Patrick Palka <ppalka@redhat.com>
3287 * semantics.cc (finish_call_expr): Strip ADDR_EXPR from
3288 the selected callee during overload set pruning.
3290 2023-02-03 Patrick Palka <ppalka@redhat.com>
3293 * class.cc (check_methods): Diagnose an unviable OVERLOAD
3294 set for CLASSTYPE_DESTRUCTOR differently from an ambiguous one.
3295 Then prune the OVERLOAD to a single function.
3296 (check_bases_and_members): Handle CLASSTYPE_DESTRUCTOR being
3297 an OVERLOAD when calling deduce_noexcept_on_destructor.
3298 Document why it has to be called before check_methods.
3300 2023-02-03 Patrick Palka <ppalka@redhat.com>
3303 * class.cc (check_methods): Swap order of constraints_satisfied_p
3304 and copy/move_fn_p tests.
3306 2023-02-01 Marek Polacek <polacek@redhat.com>
3309 * call.cc (build_new_op): Don't call warn_logical_operator when
3310 processing a template.
3312 2023-02-01 Jakub Jelinek <jakub@redhat.com>
3315 * constexpr.cc (cxx_eval_constant_expression): Handle OMP_*
3316 and OACC_* constructs as non-constant.
3317 (potential_constant_expression_1): Handle OMP_SCAN and OMP_SCOPE.
3319 2023-02-01 Jason Merrill <jason@redhat.com>
3321 * class.cc (note_name_declared_in_class): Change from permerror to
3322 -Wchanges-meaning pedwarn, forcing -pedantic-errors for most cases.
3324 2023-01-31 Jason Merrill <jason@redhat.com>
3327 * cp-gimplify.cc (any_non_eliding_target_exprs): New.
3328 (cp_genericize_init): Check it.
3330 2023-01-31 Marek Polacek <polacek@redhat.com>
3334 * cp-tree.h (instantiation_dependent_expression_p): Don't
3337 2023-01-26 Marek Polacek <polacek@redhat.com>
3340 * parser.cc: Remove unnecessary forward declarations.
3341 (cp_parser_string_literal): New wrapper.
3342 (cp_parser_string_literal_common): Renamed from
3343 cp_parser_string_literal. Add a bool parameter. Give an error when
3344 UDLs are not permitted.
3345 (cp_parser_userdef_string_literal): New wrapper.
3346 (finish_userdef_string_literal): Renamed from
3347 cp_parser_userdef_string_literal.
3348 (cp_parser_primary_expression): Call cp_parser_userdef_string_literal
3349 instead of cp_parser_string_literal.
3350 (cp_parser_linkage_specification): Move a variable declaration closer
3352 (cp_parser_static_assert): Likewise.
3353 (cp_parser_operator): Call cp_parser_userdef_string_literal instead of
3354 cp_parser_string_literal.
3355 (cp_parser_asm_definition): Move a variable declaration closer to its
3357 (cp_parser_asm_specification_opt): Move variable declarations closer to
3359 (cp_parser_asm_operand_list): Likewise.
3360 (cp_parser_asm_clobber_list): Likewise.
3362 2023-01-26 Jakub Jelinek <jakub@redhat.com>
3365 * parser.cc (cp_convert_omp_range_for): If cp_finish_decomp has been
3366 called in !processing_template_decl with processing_template_decl
3367 temporarily set, clear DECL_HAS_VALUE_EXPR_P on the vars temporarily.
3368 (cp_finish_omp_range_for): And set it back again here.
3370 2023-01-25 Jakub Jelinek <jakub@redhat.com>
3373 * mangle.cc (write_closure_type_name): Don't assume all
3374 lambda operator() fns are methods.
3376 2023-01-24 Jason Merrill <jason@redhat.com>
3379 * parser.cc (cp_lexer_new_main): Pass C_LEX_STRING_NO_JOIN for first
3382 2023-01-24 Jason Merrill <jason@redhat.com>
3385 * pt.cc (tsubst_function_decl): Handle static lambda.
3387 2023-01-24 Jakub Jelinek <jakub@redhat.com>
3390 * cp-gimplify.cc (cp_fold_r): Revert 2023-01-19 changes.
3392 2023-01-24 Jason Merrill <jason@redhat.com>
3396 * cp-gimplify.cc (cp_fold_r) [TARGET_EXPR]: In case of double
3397 TARGET_EXPR, keep the outer one instead of the inner one.
3398 (maybe_replace_decl): New.
3400 2023-01-23 Jason Merrill <jason@redhat.com>
3403 * cp-gimplify.cc (cp_gimplify_init_expr): Allow unexpected elision
3406 2023-01-23 Marek Polacek <polacek@redhat.com>
3409 * cvt.cc (ocp_convert): copy_warning when creating a new
3411 * init.cc (build_new_1): Suppress -Wunused-value on
3412 compiler-generated COMPOUND_EXPRs.
3414 2023-01-23 Jason Merrill <jason@redhat.com>
3417 * call.cc (build_user_type_conversion_1): Check whether the
3418 iterators also find a list ctor.
3420 2023-01-23 Jason Merrill <jason@redhat.com>
3423 * decl.cc (grokdeclarator): Check whether DECL_RESULT is already
3426 2023-01-23 Jason Merrill <jason@redhat.com>
3430 * call.cc (extend_ref_init_temps_1): Handle ptrmem expression.
3432 2023-01-19 Jakub Jelinek <jakub@redhat.com>
3435 * cp-tree.h (keep_unused_object_arg): Declare.
3436 * call.cc (keep_unused_object_arg): No longer static.
3437 * tree.cc (build_min_non_dep_op_overload): Handle ARRAY_REF
3438 with overload being static member function.
3440 2023-01-19 Jakub Jelinek <jakub@redhat.com>
3443 * cp-gimplify.cc (cp_fold_r): During cp_fully_fold_init replace
3444 DECL_ANON_UNION_VAR_P VAR_DECLs with their corresponding
3447 2023-01-16 Jakub Jelinek <jakub@redhat.com>
3450 * decl.cc (cp_finish_decl): Check warning_enabled_at
3451 at the DECL_SOURCE_LOCATION (decl) for OPT_Winit_self instead
3454 2023-01-14 Jakub Jelinek <jakub@redhat.com>
3457 * typeck.cc (cp_build_binary_op): Use may_shorten_divmod for integral
3460 2023-01-13 Jakub Jelinek <jakub@redhat.com>
3463 * cvt.cc (cp_convert_and_check): For EXCESS_PRECISION_EXPR
3464 use its operand except that for warning purposes use the original
3465 EXCESS_PRECISION_EXPR.
3466 * call.cc (convert_like_internal): Only look through
3467 EXCESS_PRECISION_EXPR when calling cp_convert, not when calling
3468 cp_convert_and_check.
3470 2023-01-09 Jakub Jelinek <jakub@redhat.com>
3475 * call.cc (maybe_init_list_as_range): Always return NULL_TREE if
3476 processing_template_decl.
3478 2023-01-05 Patrick Palka <ppalka@redhat.com>
3481 * parser.cc (cp_parser_class_head): Use dk_deferred instead of
3482 dk_no_check when parsing the class name.
3484 2023-01-05 Jakub Jelinek <jakub@redhat.com>
3487 * semantics.cc (finish_omp_target_clauses): Ignore clauses other than
3490 2023-01-04 Patrick Palka <ppalka@redhat.com>
3493 * decl2.cc (mark_single_function): Ignore mark_used failure
3494 only in a non-SFINAE context rather than in a SFINAE one.
3496 2023-01-04 Jakub Jelinek <jakub@redhat.com>
3499 * decl.cc (merge_default_template_args): Return false if either
3500 new_parm or old_parm are erroneous.
3503 Copyright (C) 2023 Free Software Foundation, Inc.
3505 Copying and distribution of this file, with or without modification,
3506 are permitted in any medium without royalty provided the copyright
3507 notice and this notice are preserved.