1 2020-10-02 Marek Polacek <polacek@redhat.com>
4 * cxx-pretty-print.c (pp_cxx_template_argument_list): If the
5 argument is template_parm_object_p, print its DECL_INITIAL.
7 2020-10-02 Nathan Sidwell <nathan@acm.org>
9 * cp-tree.h (lang_decl_base): anticipated_p is not used for
11 (DECL_ANTICIPATED): Delete.
12 * decl.c (duplicate_decls): Delete DECL_ANTICIPATED_management,
14 (cxx_builtin_function): Drop DECL_ANTICIPATED setting.
15 (xref_tag_1): Drop DECL_ANTICIPATED assert.
16 * name-lookup.c (name_lookup::adl_class_only): Drop
17 DECL_ANTICIPATED check.
18 (name_lookup::search_adl): Always dedup.
19 (anticipated_builtin_p): Reimplement.
20 (do_pushdecl): Drop DECL_ANTICIPATED asserts & update.
21 (lookup_elaborated_type_1): Drop DECL_ANTICIPATED update.
22 (do_pushtag): Drop DECL_ANTICIPATED setting.
23 * pt.c (push_template_decl): Likewise.
24 (tsubst_friend_class): Likewise.
26 2020-10-02 Nathan Sidwell <nathan@acm.org>
28 * name-lookup.c (consider_decl): New, broken out of ...
29 (consider_binding_level): ... here. Iterate the hash table for
32 2020-10-02 Nathan Sidwell <nathan@acm.org>
34 * cp-tree.h (base_ctor_omit_inherited_parms): Declare.
35 * class.c (add_method): Refactor main loop, only pass fns to
36 ctor_omit_inherited_parms.
37 (build_cdtor_clones): Rename bool parms.
38 (clone_cdtor): Call base_ctor_omit_inherited_parms.
39 * method.c (base_ctor_omit_inherited_parms): New, broken out of
41 (ctor_omit_inherited_parms): ... here, call it with
44 2020-10-02 Nathan Sidwell <nathan@acm.org>
46 * cp-tree.h (cp_fname_init): Delete declaration.
47 * decl.c (cp_fname_init): Merge into only caller ...
48 (cp_make_fname): ... here & refactor.
50 2020-10-02 Jason Merril <jason@redhat.com>
52 * call.c (build_operator_new_call): Set CALL_FROM_NEW_OR_DELETE_P.
53 (build_op_delete_call): Likewise.
54 * init.c (build_new_1, build_vec_delete_1, build_delete): Not here.
57 2020-10-02 Jason Merril <jason@redhat.com>
59 * lambda.c (call_from_lambda_thunk_p): New.
60 * cp-gimplify.c (cp_genericize_r): Use it.
61 * pt.c (tsubst_copy_and_build): Use it.
62 * typeck.c (check_return_expr): Use it.
63 * cp-tree.h: Declare it.
64 (CALL_FROM_NEW_OR_DELETE_P): Move to gcc/tree.h.
66 2020-10-01 Nathan Sidwell <nathan@acm.org>
68 * cp-tree.h (DECL_ANTICIPATED): Adjust comment.
69 (DECL_HIDDEN_P, TYPE_HIDDEN_P): Delete.
70 * tree.c (ovl_insert): Delete DECL_HIDDEN_P assert.
71 (ovl_skip_hidden): Likewise.
73 2020-10-01 Nathan Sidwell <nathan@acm.org>
75 * name-lookup.c (pushdecl_top_level): Assert incoming context is
76 null, add global_namespace context.
77 (pushdecl_top_level_and_finish): Likewise.
78 * pt.c (get_template_parm_object): Clear decl context before
80 * semantics.c (finish_compound_literal): Likewise.
82 2020-10-01 Nathan Sidwell <nathan@acm.org>
84 * decl.c (lookup_and_check_tag): Refactor.
86 2020-10-01 Jakub Jelinek <jakub@redhat.com>
89 * call.c (build_over_call): If obj_arg is non-NULL, return INIT_EXPR
90 setting obj_arg to call.
92 2020-10-01 Jakub Jelinek <jakub@redhat.com>
95 * constexpr.c (cxx_eval_call_expression): Don't VERIFY_CONSTANT the
98 2020-10-01 Marek Polacek <polacek@redhat.com>
101 * pt.c (do_class_deduction): Don't prune explicit deduction guides
102 in copy-list-initialization. In copy-list-initialization, if an
103 explicit deduction guide was selected, give an error.
105 2020-09-30 Nathan Sidwell <nathan@acm.org>
107 * cp-tree.h (struct lang_decl_fn): Remove hidden_friend_p.
108 (DECL_HIDDEN_FRIEND_P): Delete.
109 * call.c (add_function_candidate): Drop assert about anticipated
111 (build_new_op_1): Drop koenig lookup flagging for hidden friend.
112 * decl.c (duplicate_decls): Drop HIDDEN_FRIEND_P updating.
113 * name-lookup.c (do_pushdecl): Likewise.
114 (set_decl_namespace): Discover hiddenness from OVL_HIDDEN_P.
115 * pt.c (check_explicit_specialization): Record found_hidden
118 2020-09-29 Marek Polacek <polacek@redhat.com>
121 * call.c (ref_conv_binds_directly_p): New function.
122 * cp-tree.h (ref_conv_binds_directly_p): Declare.
123 * parser.c (warn_for_range_copy): New function.
124 (cp_convert_range_for): Call it.
126 2020-09-29 Nathan Sidwell <nathan@acm.org>
128 * cp-tree.h (ovl_insert): Change final parm to hidden-or-using
130 * name-lookup.h (HIDDEN_TYPE_BINDING_P): New.
131 (struct cxx_binding): Add type_is_hidden flag.
132 * tree.c (ovl_insert): Change using_p parm to using_or_hidden,
134 (ovl_skip_hidden): Assert we never see a naked hidden decl.
135 * decl.c (xref_tag_1): Delete unhiding friend from here (moved to
136 lookup_elaborated_type_1).
137 * name-lookup.c (STAT_TYPE_HIDDEN_P, STAT_DECL_HIDDEN_P): New.
138 (name_lookup::search_namespace_only): Check new hidden markers.
139 (cxx_binding_make): Clear HIDDEN_TYPE_BINDING_P.
140 (update_binding): Update new hidden markers.
141 (lookup_name_1): Check HIDDEN_TYPE_BINDING_P and simplify friend
143 (lookup_elaborated_type_1): Use new hidden markers. Reveal the
146 2020-09-29 Nathan Sidwell <nathan@acm.org>
148 * name-lookup.c (create_local_binding): Do not clear
149 INHERITED_VALUE_BINDING_P here.
150 (name_lookup::process_binding): Move done hidden-decl triage to ...
151 (name_lookup::search_namespace_only): ... here, its only caller.
152 (cxx_binding_make): Clear flags here.
153 (push_binding): Not here.
154 (pop_local_binding): RAII.
155 (update_binding): Refactor.
156 (do_pushdecl): Assert we're never revealing a local binding.
157 (do_pushdecl_with_scope): Directly call do_pushdecl.
158 (get_class_binding): Do not clear LOCAL_BINDING_P here.
159 * pt.c (push_template_decl): Set friend & anticipated before
162 2020-09-29 Nathan Sidwell <nathan@acm.org>
164 * name-lookup.c (update_binding): We never meet two implicit
166 (do_pushdecl): Adjust set_identifier_type_value_with_scope calls.
167 (set_identifier_type_value_with_scope): Do not update binding in
168 the namespace-case. Assert it is already there.
170 2020-09-25 Nathan Sidwell <nathan@acm.org>
172 * cp-tree.h (duplicate_decls): Replace 'is_friend' with 'hiding'
173 and add 'was_hidden'.
174 * name-lookup.h (pushdecl_namespace_level): Replace 'is_friend'
176 (pushdecl): Likewise.
177 (pushdecl_top_level): Drop is_friend parm.
178 * decl.c (check_no_redeclaration_friend_default_args): Rename parm
180 (duplicate_decls): Replace 'is_friend' with 'hiding'
181 and 'was_hidden'. Do minimal adjustments in body.
182 (cxx_builtin_function): Pass 'hiding' to pushdecl.
183 * friend.c (do_friend): Pass 'hiding' to pushdecl.
184 * name-lookup.c (supplement_binding_1): Drop defaulted arg to
186 (update_binding): Replace 'is_friend' with 'hiding'. Drop
187 defaulted arg to duplicate_decls.
188 (do_pushdecl): Replace 'is_friend' with 'hiding'. Assert no
189 surprise hidhing. Adjust duplicate_decls calls to inform of old
191 (pushdecl): Replace 'is_friend' with 'hiding'.
192 (set_identifier_type_value_with_scope): Adjust update_binding
194 (do_pushdecl_with_scope): Replace 'is_friend' with 'hiding'.
195 (pushdecl_outermost_localscope): Drop default arg to
196 do_pushdecl_with_scope.
197 (pushdecl_namespace_level): Replace 'is_friend' with 'hiding'.
198 (pushdecl_top_level): Drop is_friend parm.
199 * pt.c (register_specialization): Comment duplicate_decls call
201 (push_template_decl): Commont pushdecl_namespace_level.
202 (tsubst_friend_function, tsubst_friend_class): Likewise.
204 2020-09-25 Nathan Sidwell <nathan@acm.org>
206 * name-lookup.h (enum tag_scope): Replace with ...
207 (enum class TAG_how): ... this. Add HIDDEN_FRIEND value.
208 (lookup_type_scope): Replace with ...
209 (lookup_elaborated_type): ... this.
210 (pushtag): Use TAG_how, not tag_scope.
211 * cp-tree.h (xref_tag): Parameter is TAG_how, not tag_scope.
212 * decl.c (lookup_and_check_tag): Likewise. Adjust.
213 (xref_tag_1, xref_tag): Likewise. adjust.
214 (start_enum): Adjust lookup_and_check_tag call.
215 * name-lookup.c (lookup_type_scope_1): Rename to ...
216 (lookup_elaborated_type_1) ... here. Use TAG_how, not tag_scope.
217 (lookup_type_scope): Rename to ...
218 (lookup_elaborated_type): ... here. Use TAG_how, not tag_scope.
219 (do_pushtag): Use TAG_how, not tag_scope. Adjust.
221 * parser.c (cp_parser_elaborated_type_specifier): Adjust.
222 (cp_parser_class_head): Likewise.
224 2020-09-25 Nathan Sidwell <nathan@acm.org>
226 * cp-tree.h (DECL_BUILTIN_P): New.
227 * decl.c (duplicate_decls): Use it. Do not treat omp-udr as a
229 * name-lookup.c (anticipated_builtin): Use it.
230 (set_decl_context_in_fn): Function-scope OMP UDRs have function context.
231 (do_nonmember_using_decl): Use DECL_BUILTIN_P.
232 * parser.c (cp_parser_omp_declare_reduction): Function-scope OMP
233 UDRs have function context. Assert we never find a valid duplicate.
234 * pt.c (tsubst_expr): Function-scope OMP UDRs have function context.
236 2020-09-24 Nathan Sidwell <nathan@acm.org>
238 * cp-tree.h (duplicate_decls): Default is_friend to false.
239 (xref_tag): Default tag_scope & tpl_header_p to ts_current & false.
240 (push_template_decl_real): Default is_friend to false. Rename to
242 (push_template_decl): ... here. Delete original decl.
243 * name-lookup.h (pushdecl_namespace_level): Default is_friend to
245 (pushtag): Default tag_scope to ts_current.
246 * coroutines.cc (morph_fn_to_coro): Drop default args to xref_tag.
247 * decl.c (start_decl): Drop default args to duplicate_decls.
248 (start_enum): Drop default arg to pushtag & xref_tag.
249 (start_preparsed_function): Pass DECL_FRIEND_P to
251 (grokmethod): Likewise.
252 * friend.c (do_friend): Rename push_template_decl_real calls.
253 * lambda.c (begin_lamnbda_type): Drop default args to xref_tag.
254 (vla_capture_type): Likewise.
255 * name-lookup.c (maybe_process_template_type_declaration): Rename
256 push_template_decl_real call.
257 (pushdecl_top_level_and_finish): Drop default arg to
258 pushdecl_namespace_level.
259 * pt.c (push_template_decl_real): Assert no surprising friend
260 functions. Rename to ...
261 (push_template_decl): ... here. Delete original function.
262 (lookup_template_class_1): Drop default args from pushtag.
263 (instantiate_class_template_1): Likewise.
264 * ptree.c (debug_overload): Print hidden and using markers.
265 * rtti.c (init_rtti_processing): Drop refault args from xref_tag.
266 (build_dynamic_cast_1, tinfo_base_init): Likewise.
267 * semantics.c (begin_class_definition): Drop default args to
270 2020-09-24 Nathan Sidwell <nathan@acm.org>
273 * pt.c (maybe_instantiate_noexcept): Local externs are never
276 2020-09-23 Nathan Sidwell <nathan@acm.org>
278 * name-lookup.h (typedef cxx_binding): Delete tdef.
279 (typedef cp_binding_level): Likewise.
280 (struct cxx_binding): Flags are bools.
282 2020-09-23 Nathan Sidwell <nathan@acm.org>
285 * pt.c (tsubst_copy) [FUNCTION_DECL,VAR_DECL]: Retrieve local
286 specialization for DECL_LOCAL_P decls.
288 2020-09-22 Patrick Palka <ppalka@redhat.com>
291 * pt.c (corresponding_template_parameter): Define.
292 (keep_template_parm): Use it to adjust the given template
293 parameter to the corresponding in-scope one from ctx_parms.
295 2020-09-22 Nathan Sidwell <nathan@acm.org>
297 * cp-tree.h (xref_tag_from_type): Don't declare.
298 * decl.c (xref_tag_from_type): Delete.
299 * pt.c (lookup_template_class_1): Erroneously located class
300 definitions just give error_mark, don't try and inject it into the
303 2020-09-22 Jakub Jelinek <jakub@redhat.com>
306 * constexpr.c (cxx_eval_builtin_function_call): Return void_node for
307 calls to __sanitize_ptr_{sub,cmp} builtins.
309 2020-09-22 Nathan Sidwell <nathan@acm.org>
311 * pt.c (instantiate_class_template_1): Do not repush and unhide
314 2020-09-21 Marek Polacek <polacek@redhat.com>
318 * lambda.c (maybe_add_lambda_conv_op): Mark the conversion function
321 2020-09-21 Marek Polacek <polacek@redhat.com>
323 * pt.c (deduction_guides_for): Add a bool parameter. Set it.
324 (do_class_deduction): Warn when CTAD succeeds but the type doesn't
325 have any explicit deduction guides.
327 2020-09-21 Nathan Sidwell <nathan@acm.org>
329 * decl.c (xref_tag_1): Use IDENTIFIER_LAMBDA_P to detect lambdas.
330 * lambda.c (begin_lambda_type): Use ts_current to push the tag.
331 * name-lookup.h (enum tag_scope): Drop ts_lambda.
333 2020-09-21 Marek Polacek <polacek@redhat.com>
336 * decl.c (redeclaration_error_message): Detect a redeclaration of
339 2020-09-19 Sandra Loosemore <sandra@codesourcery.com>
341 * cp-gimplify.c (enum bc_t, bc_label): Move to c-family.
342 (begin_bc_block, finish_bc_block, get_bc_label): Likewise.
343 (genericize_cp_loop): Likewise.
344 (genericize_for_stmt, genericize_while_stmt): Likewise.
345 (genericize_do_stmt, genericize_switch_stmt): Likewise.
346 (genericize_continue_stmt, genericize_break_stmt): Likewise.
347 (genericize_omp_for_stmt): Likewise.
348 (cp_genericize_r): Call c_genericize_control_stmt instead of
349 above functions directly.
350 (cp_genericize): Call save_bc_state and restore_bc_state instead
351 of manipulating bc_label directly.
352 * cp-objcp-common.c (cxx_block_may_fallthru): Defer to
353 c_block_may_fallthru instead of handling SWITCH_STMT here.
354 (cp_common_init_ts): Move handling of loop and switch-related
355 statements to c-family.
356 * cp-tree.def (FOR_STMT, WHILE_STMT, DO_STMT): Move to c-family.
357 (BREAK_STMT, CONTINUE_STMT, SWITCH_STMT): Likewise.
358 * cp-tree.h (LABEL_DECL_BREAK, LABEL_DECL_CONTINUE): Likewise.
359 (WHILE_COND, WHILE_BODY): Likewise.
360 (DO_COND, DO_BODY): Likewise.
361 (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY, FOR_SCOPE): Likewise.
362 (SWITCH_STMT_COND, SWITCH_STMT_BODY): Likewise.
363 (SWITCH_STMT_TYPE, SWITCH_STMT_SCOPE): Likewise.
364 (SWITCH_STMT_ALL_CASES_P, SWITCH_STMT_NO_BREAK_P): Likewise.
365 * cxx-pretty-print.c (cxx_pretty_printer::statement): Move code
366 to handle structured loop and switch tree nodes to c-family.
367 * dump.c (cp_dump_tree): Likewise.
369 2020-09-19 Patrick Palka <ppalka@redhat.com>
373 * constraint.cc (map_arguments): Call template_parm_to_arg
374 in the self-mapping case.
375 (finish_shorthand_constraint): No need to build a TREE_LIST
376 before calling template_parm_to_arg.
377 * pt.c (template_parm_to_arg): Rewrite to handle TEMPLATE_PARM_P
378 nodes as well as DECL_TEMPLATE_PARM_P nodes, and to make the
379 overlying TREE_LIST node optional.
380 (keep_template_parm): Don't record a BOUND_TEMPLATE_TEMPLATE_PARM,
381 instead record its corresponding TEMPLATE_TEMPLATE_PARM.
382 (convert_generic_types_to_packs): Don't call
383 template_parm_to_arg.
385 2020-09-19 Patrick Palka <ppalka@redhat.com>
388 * constraint.cc (satisfy_atom): Pass true as the
389 manifestly_const_eval argument to maybe_constant_value.
391 2020-09-18 Jason Merrill <jason@redhat.com>
394 * decl.c (complete_vars): Only call layout_var_decl if completing
397 2020-09-18 Jason Merrill <jason@redhat.com>
399 * decl.c (complete_vars): Call layout_var_decl.
401 2020-09-17 Patrick Palka <ppalka@redhat.com>
405 * constraint.cc (tsubst_requires_expr): Use REQUIRES_EXPR_PARMS
406 and REQUIRES_EXPR_REQS. Use REQUIRES_EXPR_EXTRA_ARGS,
407 add_extra_args and build_extra_args to defer substitution until
408 we have all the template arguments.
409 (finish_requires_expr): Adjust the call to build_min so that
410 REQUIRES_EXPR_EXTRA_ARGS gets set to NULL_TREE.
411 * cp-tree.def (REQUIRES_EXPR): Give it a third operand.
412 * cp-tree.h (REQUIRES_EXPR_PARMS, REQUIRES_EXPR_REQS,
413 REQUIRES_EXPR_EXTRA_ARGS): Define.
414 (add_extra_args, build_extra_args): Declare.
416 2020-09-16 Nathan Sidwell <nathan@acm.org>
418 * cp-tree.h (cp_check_omp_declare_reduction): Return bool.
419 * semantics.c (cp_check_omp_declare_reduction): Return true on for
421 * pt.c (push_template_decl_real): OMP reductions do not get a
423 (tsubst_function_decl): Remove special casing for local decl omp
425 (tsubst_expr): Call instantiate_body for a local omp reduction.
426 (instantiate_body): Add nested_p parm, and deal with such
428 (instantiate_decl): Reject FUNCTION_SCOPE entities, adjust
429 instantiate_body call.
431 2020-09-16 Nathan Sidwell <nathan@acm.org>
433 * pt.c (instantiate_body): Remove 'nested' var, simplify
436 2020-09-16 Nathan Sidwell <nathan@acm.org>
438 * pt.c (instantiate_body): New, broken out of ..
439 (instantiate_decl): ... here. Call it.
441 2020-09-15 Nathan Sidwell <nathan@acm.org>
443 * pt.c (push_template_decl_real): OMP reductions retain a template
445 (tsubst_function_decl): Likewise.
447 2020-09-15 Tobias Burnus <tobias@codesourcery.com>
450 * cp-gimplify.c (cxx_omp_finish_clause): Add bool openacc arg.
451 * cp-tree.h (cxx_omp_finish_clause): Likewise
452 * semantics.c (handle_omp_for_class_iterator): Update call.
454 2020-09-14 Marek Polacek <polacek@redhat.com>
456 * pt.c (push_template_decl_real): Use VAR_OR_FUNCTION_DECL_P.
458 2020-09-14 Nathan Sidwell <nathan@acm.org>
460 * pt.c (push_template_decl_real): Don't attach a template head to
462 (tsubst_function_decl): Add support for headless local extern
464 (tsubst_decl): Add support for headless local extern decls.
466 2020-09-11 Nathan Sidwell <nathan@acm.org>
468 * decl.c (grokfndecl): Don't attach to local extern.
470 2020-09-11 Nathan Sidwell <nathan@acm.org>
472 * parser.c (cp_parser_objc_method_definition_list): Reimplement
473 loop, make sure we pop scope.
475 2020-09-11 Marek Polacek <polacek@redhat.com>
477 * cp-tree.h (LOOKUP_CONSTINIT): Remove.
478 (LOOKUP_REWRITTEN): Adjust.
479 * decl.c (duplicate_decls): Set DECL_DECLARED_CONSTINIT_P.
480 (check_initializer): Use DECL_DECLARED_CONSTINIT_P instead of
482 (cp_finish_decl): Don't set DECL_DECLARED_CONSTINIT_P. Use
483 DECL_DECLARED_CONSTINIT_P instead of LOOKUP_CONSTINIT.
484 (grokdeclarator): Set DECL_DECLARED_CONSTINIT_P.
485 * decl2.c (grokfield): Don't handle LOOKUP_CONSTINIT.
486 * parser.c (cp_parser_decomposition_declaration): Remove
487 LOOKUP_CONSTINIT handling.
488 (cp_parser_init_declarator): Likewise.
489 * pt.c (tsubst_expr): Likewise.
490 (instantiate_decl): Likewise.
491 * typeck2.c (store_init_value): Use DECL_DECLARED_CONSTINIT_P instead
494 2020-09-10 Nathan Sidwell <nathan@acm.org>
496 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Replace with ...
497 (DECL_DECLARED_CONSTINIT_P): ... this.
498 * decl.c (start_decl): No need to retrofit_lang_decl for constinit
500 (cp_finish_decl): Use DECL_DECLARED_CONSTINIT_P.
501 * pt.c (tsubst_decl): No need to handle constinit flag
503 (tsubst_expr): Or here.
505 2020-09-10 Nathan Sidwell <nathan@acm.org>
507 * cp-tree.h (DECL_LOCAL_FUNCTION_P): Rename to ...
508 (DECL_LOCAL_DECL_P): ... here. Accept both fns and vars.
509 * decl.c (start_decl): Set DECL_LOCAL_DECL_P for local externs.
510 (omp_declare_variant_finalize_one): Use DECL_LOCAL_DECL_P.
511 (local_variable_p): Simplify.
512 * name-lookup.c (set_decl_context_in_fn): Assert DECL_LOCAL_DECL_P
513 is as expected. Simplify.
514 (do_pushdecl): Don't set decl_context_in_fn for friends.
515 (is_local_extern): Simplify.
516 * call.c (equal_functions): Use DECL_LOCAL_DECL_P.
517 * parser.c (cp_parser_postfix_expression): Likewise.
518 (cp_parser_omp_declare_reduction): Likewise.
519 * pt.c (check_default_tmpl_args): Likewise.
520 (tsubst_expr): Assert nested reduction function is local.
521 (type_dependent_expression_p): Use DECL_LOCAL_DECL_P.
522 * semantics.c (finish_call_expr): Likewise.
524 2020-09-09 Marek Polacek <polacek@redhat.com>
527 * decl.c (reshape_init): If we're initializing a char array from
528 a string-literal that is enclosed in braces, unwrap it.
529 * init.c (build_new_1): Don't handle string-initializers here.
530 (build_new): Handle new-expression with paren-init when the
531 array bound is known. Always pass string constants to build_new_1
532 enclosed in braces. Don't handle string-initializers in any
535 2020-09-09 Marek Polacek <polacek@redhat.com>
538 * decl.c (reshape_init_r): When initializing an aggregate member
539 with an initializer from an initializer-list, also consider
542 2020-09-09 Nathan Sidwell <nathan@acm.org>
544 * parser.c (cp_parser_omp_declare_reduction): Refactor to avoid
545 code duplication. Update DECL_TI_TEMPLATE's context.
546 * pt.c (tsubst_expr): For OMP reduction function, set context to
547 global_namespace before pushing.
548 (tsubst_omp_udr): Assert current_function_decl, add comment about
551 2020-09-09 Patrick Palka <ppalka@redhat.com>
554 * class.c (resolve_address_of_overloaded_function): Check
555 constraints_satisfied_p and perform return-type deduction via
556 maybe_instantiate_decl when considering non-template functions
558 * cp-tree.h (maybe_instantiate_decl): Declare.
559 * decl2.c (maybe_instantiate_decl): Remove static.
561 2020-09-04 Jason Merrill <jason@redhat.com>
563 * expr.c (mark_use): Use iloc_sentinel.
565 2020-09-03 Jakub Jelinek <jakub@redhat.com>
568 * constexpr.c (fundef_copies_table): Change type from
569 hash_map<tree, tree> * to decl_tree_map *.
571 2020-09-03 Marek Polacek <polacek@redhat.com>
574 * cp-tree.h (do_aggregate_paren_init): Declare.
575 * decl.c (do_aggregate_paren_init): New.
576 (grok_reference_init): Use it.
577 (check_initializer): Likewise.
578 * init.c (perform_member_init): Handle initializing an array from
579 a ()-list. Use do_aggregate_paren_init.
581 2020-09-03 Jakub Jelinek <jakub@redhat.com>
584 * constexpr.c (cxx_eval_outermost_constant_expr): Temporarily disable
585 flag_rounding_math during manifestly constant evaluation.
587 2020-09-01 Marek Polacek <polacek@redhat.com>
590 * init.c (build_new_1): Call reshape_init.
592 2020-09-01 Jakub Jelinek <jakub@redhat.com>
595 * semantics.c (handle_omp_array_sections_1): Test
596 DECL_ARRAY_PARAMETER_P only on PARM_DECLs.
598 2020-08-31 Marek Polacek <polacek@redhat.com>
599 Jason Merrill <jason@redhat.com>
602 * call.c (build_new_method_call_1): Use build_constructor_from_vec
603 instead of build_tree_list_vec + build_constructor_from_list.
604 * init.c (build_new_1): Handle new char[]{"foo"}. Use
605 build_constructor_from_vec instead of build_tree_list_vec +
606 build_constructor_from_list.
607 (build_new): Deduce the array size in new-expression if not
608 present. Handle ()-init. Handle initializing an array from
610 * parser.c (cp_parser_new_type_id): Leave [] alone.
611 (cp_parser_direct_new_declarator): Allow [].
612 * pt.c (type_dependent_expression_p): In a NEW_EXPR, consider
613 array types whose dimension has to be deduced type-dependent.
615 2020-08-27 Martin Liska <mliska@suse.cz>
617 * class.c (build_vtbl_initializer): Set exact argument of a vector
618 growth function to true.
619 * constraint.cc (get_mapped_args): Likewise.
620 * decl.c (cp_maybe_mangle_decomp): Likewise.
621 (cp_finish_decomp): Likewise.
622 * parser.c (cp_parser_omp_for_loop): Likewise.
623 * pt.c (canonical_type_parameter): Likewise.
624 * rtti.c (get_pseudo_ti_init): Likewise.
626 2020-08-26 Nathan Sidwell <nathan@acm.org>
628 * decl.c (poplevel): A local-binding tree list holds the name in
630 * name-lookup.c (update_local_overload): Add id to TREE_PURPOSE.
631 (lookup_name_1): Deal with local-binding error_mark_node marker.
632 (op_unqualified_lookup): Return error_mark_node for 'nothing
633 found'. Retain global binding, check class binding here.
634 (maybe_save_operator_binding): Reimplement to always cache a
636 (push_operator_bindings): Deal with 'ignore' marker.
638 2020-08-25 Tobias Burnus <tobias@codesourcery.com>
641 * semantics.c (handle_omp_array_sections_1): Talk about
642 array function parameter in the error message.
644 2020-08-25 Jakub Jelinek <jakub@redhat.com>
647 * cp-tree.h (build_trivial_dtor_call): Add bool argument defaulted
649 * call.c (build_trivial_dtor_call): Add NO_PTR_DEREF argument. If
650 instance is a pointer and NO_PTR_DEREF is true, clobber the pointer
651 rather than what it points to.
652 * semantics.c (finish_call_expr): Call build_trivial_dtor_call with
653 true as NO_PTR_DEREF.
655 2020-08-25 Jason Merrill <jason@redhat.com>
658 * optimize.c (populate_clone_array): Revert PR70462 change.
659 (maybe_clone_body): Likewise.
661 2020-08-24 Nathan Sidwell <nathan@acm.org>
663 * ptree.c (debug_overload): New.
665 2020-08-19 Jason Merrill <jason@redhat.com>
668 * cp-tree.h (push_tinst_level, push_tinst_level_loc): Declare.
669 * constraint.cc (satisfy_declaration_constraints):
670 Use add_outermost_template_args and push_tinst_level.
671 * pt.c (add_outermost_template_args): Handle getting
672 a TEMPLATE_DECL as the first argument.
673 (push_tinst_level, push_tinst_level_loc): No longer static.
674 (fn_type_unification): Check satisfaction before non-dependent
677 2020-08-18 Nathan Sidwell <nathan@acm.org>
679 * cp-tree.h (SET_TYPE_TEMPLTE_INFO): Do not deal with ALIAS templates.
680 * pt.c (lookup_template_class_1): Special-case alias template
681 template_info setting.
683 2020-08-18 Jason Merrill <jason@redhat.com>
686 * pt.c (tsubst_aggr_type): Rewrite in C++17, too.
687 (maybe_dependent_member_ref): Likewise.
688 (build_deduction_guide): Re-substitute template parms.
689 * cp-tree.h (struct push_nested_class_guard): New.
690 * constraint.cc (get_normalized_constraints_from_decl): Use it.
692 2020-08-18 Jason Merrill <jason@redhat.com>
695 * pt.c (maybe_dependent_member_ref): New.
696 (tsubst_copy) [CONST_DECL]: Use it.
697 [VAR_DECL]: Likewise.
698 (tsubst_aggr_type): Handle nested type.
700 2020-08-18 Nathan Sidwell <nathan@acm.org>
702 * name-lookup.c (qualify_lookup): Drop lambda checking here.
703 Reorder namespace & type checking.
704 (lookup_name_1): Do hidden lambda checking here.
706 2020-08-14 Nathan Sidwell <nathan@acm.org>
708 * name-lookup.h (lookup_name_real, lookup_name_nonclass): Rename
710 (lookup_name): ... these new overloads.
711 * name-lookup.c (identifier_type_value_1): Rename lookup_name_real
713 (lookup_name_real_1): Rename to ...
714 (lookup_name_1): ... here.
715 (lookup_name_real): Rename to ...
716 (lookup_name): ... here. Rename lookup_name_real_1 call.
717 (lookup_name_nonclass): Delete.
718 * call.c (build_operator_new_call): Rename lookup_name_real call.
719 (add_operator_candidates): Likewise.
720 (build_op_delete_call): Rename lookup_name_nonclass call.
721 * parser.c (cp_parser_lookup_name): Likewise.
722 * pt.c (tsubst_friend_class, lookup_init_capture_pack): Likewise.
723 (tsubst_expr): Likewise.
724 * semantics.c (capture_decltype): Likewise.
726 2020-08-14 Nathan Sidwell <nathan@acm.org>
728 * cp-tree.h (LOOKUP_HIDDEN): Delete.
729 (LOOKUP_PREFER_RVALUE): Adjust initializer.
730 * name-lookup.h (enum class LOOK_want): Add HIDDEN_FRIEND and
732 (lookup_name_real): Drop flags parm.
733 (lookup_qualified_name): Drop find_hidden parm.
734 * name-lookup.c (class name_lookup): Drop hidden field, adjust
736 (name_lookup::add_overload): Check want for hiddenness.
737 (name_lookup::process_binding): Likewise.
738 (name_lookup::search_unqualified): Likewise.
739 (identifier_type_value_1): Adjust lookup_name_real call.
740 (set_decl_namespace): Adjust name_lookup ctor.
741 (qualify_lookup): Drop flags parm, use want for hiddenness.
742 (lookup_qualified_name): Drop find_hidden parm.
743 (lookup_name_real_1): Drop flags parm, adjust qualify_lookup
745 (lookup_name_real): Drop flags parm.
746 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real
748 (lookup_type_scope_1): Adjust qualify_lookup calls.
749 * call.c (build_operator_new_call): Adjust lookup_name_real call.
750 (add_operator_candidates): Likewise.
751 * coroutines.cc (morph_fn_to_coro): Adjust lookup_qualified_name
753 * parser.c (cp_parser_lookup_name): Adjust lookup_name_real calls.
754 * pt.c (check_explicit_specialization): Adjust
755 lookup_qualified_name call.
756 (deduction_guides_for): Likewise.
757 (tsubst_friend_class): Adjust lookup_name_real call.
758 (lookup_init_capture_pack): Likewise.
759 (tsubst_expr): Likewise, don't look in namespaces.
760 * semantics.c (capture_decltype): Adjust lookup_name_real. Don't
763 2020-08-14 Jason Merrill <jason@redhat.com>
767 * cp-tree.h (unsafe_return_slot_p): Declare.
768 * call.c (is_base_field_ref): Rename to unsafe_return_slot_p.
769 (build_over_call): Check unsafe_return_slot_p.
770 (build_special_member_call): Likewise.
771 * init.c (expand_default_init): Likewise.
772 * typeck2.c (split_nonconstant_init_1): Likewise.
774 2020-08-14 Nathan Sidwell <nathan@acm.org>
776 * cp-tree.h (LOOKUP_PREFER_TYPES, LOOKUP_PREFER_NAMESPACES)
777 (LOOKUP_NAMESPACES_ONLY, LOOKUP_TYPES_ONLY)
778 (LOOKUP_QUALIFIERS_ONL): Delete.
779 (LOOKUP_HIDDEN): Adjust.
780 * name-lookup.h (enum class LOOK_want): New.
781 (operator|, operator&): Overloads for it.
782 (lookup_name_real): Replace prefer_type & namespaces_only with
784 (lookup_qualified_name): Replace prefer_type with LOOK_want.
785 (lookup_name_prefer_type): Replace with ...
786 (lookup_name): ... this. New overload with LOOK_want parm.
787 * name-lookup.c (struct name_lookup): Replace flags with want and
788 hidden fields. Adjust constructors.
789 (name_lookyp::add_overload): Correct hidden stripping test. Update
790 for new LOOK_want type.
791 (name_lookup::process_binding): Likewise.
792 (name_lookup::search_unqualified): Use hidden flag.
793 (identifier_type_value_1): Adjust lookup_name_real call.
794 (set_decl_namespace): Adjust name_lookup ctor.
795 (lookup_flags): Delete.
796 (qualify_lookup): Add LOOK_want parm, adjust.
797 (lookup_qualified_name): Replace prefer_type parm with LOOK_want.
798 (lookup_name_real_1): Replace prefer_type and namespaces_only with
800 (lookup_name_real): Likewise.
801 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real call.
802 (lookup_name_prefer_type): Rename to ...
803 (lookup_name): ... here. New overload with LOOK_want parm.
804 (lookup_type_scope_1): Adjust qualify_lookup calls.
805 * call.c (build_operator_new_call)
806 (add_operator_candidates): Adjust lookup_name_real calls.
807 * coroutines.cc (find_coro_traits_template_decl)
808 (find_coro_handle_template_decl, morph_fn_to_coro): Adjust
809 lookup_qualified_name calls.
810 * cp-objcp-common.c (identifier_global_tag): Likewise.
811 * decl.c (get_tuple_size, get_tuple_decomp_init): Likewise.
812 (lookup_and_check_tag): Use lookup_name overload.
813 * parser.c (cp_parser_userdef_numeric_literal): Adjust
814 lookup_qualified_name call.
815 (prefer_arg_type): Drop template_mem_access parm, return LOOK_want
817 (cp_parser_lookup_name): Adjust lookup_member, lookup_name_real
819 * pt.c (check_explicit_specialization): Adjust lookup_qualified_name
821 (tsubst_copy_and_build, tsubst_qualified_name): Likewise
822 (deduction_guides_for): Likewise.
823 (tsubst_friend_class): Adjust lookup_name_real call.
824 (lookup_init_capture, tsubst_expr): Likewise.
825 * rtti.c (emit_support_tinfos): Adjust lookup_qualified_name call.
826 * semantics.c (omp_reduction_lookup): Likewise.
827 (capture_decltype): Adjust lookup_name_real call.
829 2020-08-13 Nathan Sidwell <nathan@acm.org>
831 * name-lookup.h (enum class LOOK_where): New.
832 (operator|, operator&): Overloads for it.
833 (lookup_name_real): Replace NONCLASS & BLOCK_P parms with WHERE.
834 * name-lookup.c (identifier_type_value_w): Adjust
835 lookup_name_real call.
836 (lookup_name_real_1): Replace NONCLASS and BLOCK_P parameters
837 with WHERE bitmask. Don't search namespaces if not asked to.
838 (lookup_name_real): Adjust lookup_name_real_1 call.
839 (lookup_name_nonclass, lookup_name)
840 (lookup_name_prefer_type): Likewise.
841 * call.c (build_operator_new_call)
842 (add_operator_candidates): Adjust lookup_name_real calls.
843 * parser.c (cp_parser_lookup_name): Likewise.
844 * pt.c (tsubst_friend_class, lookup_init_capture_pack)
845 (tsubst_expr): Likewise.
846 * semantics.c (capture_decltype): Likewise.
848 2020-08-13 Marek Polacek <polacek@redhat.com>
851 * typeck.c (build_static_cast_1): Implement P1975R0 by allowing
852 static_cast to aggregate type.
854 2020-08-10 Jakub Jelinek <jakub@redhat.com>
857 * constexpr.c (cxx_eval_binary_expression): For SPACESHIP_EXPR, tail
858 call cxx_eval_constant_expression after genericize_spaceship to avoid
859 undesirable further VERIFY_CONSTANT.
861 2020-08-10 Patrick Palka <ppalka@redhat.com>
863 * pt.c (resolve_overloaded_unification): Drop functions with
864 unsatisfied constraints.
865 (resolve_nondeduced_context): Likewise.
867 2020-08-05 Patrick Palka <ppalka@redhat.com>
868 Jason Merrill <jason@redhat.com>
871 * constexpr.c (cxx_eval_vec_init_1): Truncate ctx->ctor and
872 then clear CONSTRUCTOR_NO_CLEARING on each appended element
873 initializer if we're initializing a previously zero-initialized
876 2020-08-04 Marek Polacek <polacek@redhat.com>
879 * parser.c (cp_parser_elaborated_type_specifier): Allow
880 'template' following ::.
882 2020-08-04 Nathan Sidwell <nathan@acm.org>
884 * parser.c (cp_parser_explicit_specialization): Refactor
885 to avoid leak of num_template_parameter_lists value.
887 2020-08-04 Patrick Palka <ppalka@redhat.com>
890 * init.c (sort_mem_initializers): Preserve TREE_TYPE of the
891 member initializer list node.
892 (emit_mem_initializers): Set input_location when performing each
893 member initialization.
894 * parser.c (cp_parser_mem_initializer): Attach the source
895 location of this initializer to a dummy EMPTY_CLASS_EXPR
896 within the TREE_TYPE of the list node.
897 * pt.c (tsubst_initializer_list): Preserve TREE_TYPE of the
898 member initializer list node.
900 2020-08-03 Marek Polacek <polacek@redhat.com>
902 * cp-tree.h (after_nsdmi_defaulted_late_checks): Remove.
904 2020-08-03 Marek Polacek <polacek@redhat.com>
908 * pt.c (check_default_tmpl_args): Also consider variable
911 2020-07-31 Jakub Jelinek <jakub@redhat.com>
914 * decl.c (finish_function): In constexpr functions use for C++14 and
915 later error instead of warning if no return statement is present and
916 diagnose it regardless of warn_return_type. Move the warn_return_type
917 diagnostics earlier in the function.
919 2020-07-31 Martin Sebor <msebor@redhat.com>
922 * class.c (build_base_path): Set no-warning bit on the synthesized
923 conditional expression in static_cast.
925 2020-07-31 Richard Biener <rguenther@suse.de>
928 * cp-objcp-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
929 Define to c_common_finalize_early_debug.
931 2020-07-31 Patrick Palka <ppalka@redhat.com>
934 * constexpr.c (cxx_eval_constant_expression) <case CONST_DECL>:
935 Pass false to decl_constant_value and decl_really_constant_value
936 so that they don't unshare their result.
937 * cp-tree.h (decl_constant_value): New declaration with an added
939 (decl_really_constant_value): Add bool parameter defaulting to
940 true to existing declaration.
941 * init.c (constant_value_1): Add bool parameter which controls
942 whether to unshare the initializer before returning. Call
943 unshare_expr at most once.
944 (scalar_constant_value): Pass true to constant_value_1's new
946 (decl_really_constant_value): Add bool parameter and forward it
948 (decl_constant_value): Likewise, but instead define a new
949 overload with an added bool parameter.
951 2020-07-30 Patrick Palka <ppalka@redhat.com>
954 * pt.c (resolve_overloaded_unification): If the function
955 template specialization has a placeholder return type,
956 then instantiate it before attempting unification.
958 2020-07-30 Patrick Palka <ppalka@redhat.com>
961 * pt.c (alias_ctad_tweaks): Call remove_constraints before
962 calling set_constraints.
964 2020-07-30 Patrick Palka <ppalka@redhat.com>
967 * pt.c (reduce_template_parm_level): Propagate DECL_VIRTUAL_P
968 from the original TEMPLATE_PARM_DECL to the new lowered one.
970 2020-07-30 Patrick Palka <ppalka@redhat.com>
973 * constraint.cc (constraints_satisfied_p): Return true if
975 * pt.c (do_type_instantiation): Update a paragraph taken from
976 [temp.explicit] to reflect the latest specification. Don't
977 instantiate a member with unsatisfied constraints.
979 2020-07-29 Jason Merrill <jason@redhat.com>
982 * cp-tree.h (IMPLICIT_RVALUE_P): New.
983 (enum cp_lvalue_kind_flags): Add clk_implicit_rval.
984 (implicit_rvalue_p, set_implicit_rvalue_p): New.
985 * call.c (reference_binding): Check clk_implicit_rval.
986 (build_over_call): Adjust C++20 implicit move.
987 * coroutines.cc (finish_co_return_stmt): Simplify implicit move.
988 * except.c (build_throw): Adjust C++20 implicit move.
989 * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Propagate
991 * tree.c (lvalue_kind): Set clk_implicit_rval.
992 * typeck.c (treat_lvalue_as_rvalue_p): Overhaul.
993 (maybe_warn_pessimizing_move): Adjust.
994 (check_return_expr): Adjust C++20 implicit move.
996 2020-07-29 Jason Merrill <jason@redhat.com>
999 * call.c (build_over_call): Don't call a const ref
1000 overload for implicit move.
1002 2020-07-28 Nathan Sidwell <nathan@acm.org>
1004 * cp-gimplify.c (cp_genericize_r): Set IMPORTED_DECL's context.
1005 * cp-objcp-common.c (cp_pushdecl): Set decl's context.
1006 * decl.c (grokfndecl): Make DECL_CONTEXT setting clearer.
1008 2020-07-28 Nathan Sidwell <nathan@acm.org>
1010 * class.c (fixup_type_variants): Copy TYPE_SIZE and
1012 (finish_struct): Call it.
1014 2020-07-28 Nathan Sidwell <nathan@acm.org>
1016 * ptree.c (cxx_print_decl): Better indentation.
1018 2020-07-28 Jakub Jelinek <jakub@redhat.com>
1019 Mark Wielaard <mark@klomp.org>
1022 * parser.c (cp_lexer_safe_previous_token): Don't call
1023 cp_lexer_previous_token, instead inline it by hand and return NULL
1024 instead of failing assertion if all previous tokens until the first
1026 (cp_parser_error_1): Optimize - only call cp_lexer_safe_previous_token
1027 if token->type is CPP_NAME. Use cp_lexer_safe_previous_token instead
1028 of cp_lexer_previous_token for the missing_token_desc != RT_NONE
1031 2020-07-27 Nathan Sidwell <nathan@acm.org>
1033 * cp-tree.h (enum cp_tree_index): Add CPTI_AS_BASE_IDENTIFIER.
1034 (as_base_identifier): Define.
1035 * decl.c (initialize_predifined_identifiers): Initialize as_base
1037 * class.c (layout_class_type): Name the as-base type. Zap
1038 NSDMI its fields may have.
1040 2020-07-22 Nathan Sidwell <nathan@acm.org>
1042 * class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.
1044 2020-07-22 Nathan Sidwell <nathan@acm.org>
1046 * typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
1048 [UNDERLYING_TYPE]: Use an if.
1051 2020-07-22 Nathan Sidwell <nathan@acm.org>
1053 * decl.c (decls_match): Move variables into scopes
1055 (duplicate_decls): Use STRIP_TEMPLATE.
1056 (build_typename_type): Move var decls to their assignments.
1057 (begin_function_body): Likewise.
1058 * decl2.c (get_guard): Likewise.
1059 (mark_used): Use true for truthiness.
1060 * error.c (dump_aggr_type): Hold the decl in a var called
1063 2020-07-22 Nathan Sidwell <nathan@acm.org>
1065 * cp-tree.h (struct tree_lambda_expr): Shrink
1066 default_capture_mode & discriminator.
1068 2020-07-22 Nathan Sidwell <nathan@acm.org>
1070 * mangle.c (decl_is_template_id): Rename to ...
1071 (maybe_template_info): ... here. Return the template info,
1072 rather than use a pointer. Adjust all callers.
1073 (find_substitution): Use template_args_equal, rather than
1076 2020-07-22 Tobias Burnus <tobias@codesourcery.com>
1078 * parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
1079 (cp_parser_omp_critical): Permit hint(0) clause without named critical.
1080 * pt.c (tsubst_expr): Re-check the latter for templates.
1082 2020-07-21 Sunil K Pandey <skpgkp2@gmail.com>
1085 * decl.c (cp_finish_decl): Call target hook
1086 lower_local_decl_alignment to lower local decl alignment.
1088 2020-07-21 Nathan Sidwell <nathan@acm.org>
1090 * parser.c (cp_lexer_consume_token): Drop PRAGMA_EOL assert.
1091 (cp_parser_skip_to_closing_parenthesis_1): Only pass start token
1092 to pragma skipper if recovering.
1093 (cp_parser_skip_to_pragma_eol): Only purge and change pragma
1094 state when recovering.
1096 2020-07-20 Jason Merrill <jason@redhat.com>
1098 * pt.c (type_dependent_expression_p): A pseudo-dtor can be
1100 * semantics.c (finish_call_expr): Use build_trivial_dtor_call for
1102 (finish_pseudo_destructor_expr): Leave type NULL for dependent arg.
1104 2020-07-20 Jason Merrill <jason@redhat.com>
1106 * mangle.c (write_base_ref): New.
1107 (write_expression): Use it for base field COMPONENT_REFs.
1108 * pt.c (invalid_tparm_referent_p): Canonicalize the type
1109 of array offsets. Allow subobjects.
1111 2020-07-20 Jason Merrill <jason@redhat.com>
1113 * pt.c (collect_ctor_idx_types): Add 'const' when deducing from
1116 2020-07-17 Marek Polacek <polacek@redhat.com>
1119 * decl.c (grokdeclarator): Detect cv-qual decltype(auto).
1120 * pt.c (do_auto_deduction): Likewise.
1122 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
1129 * coroutines.cc (struct coro_ret_data): Delete.
1130 (coro_maybe_expand_co_return): Delete.
1131 (co_return_expander): Delete.
1132 (expand_co_returns): Delete.
1133 (co_await_find_in_subtree): Remove unused name.
1134 (build_actor_fn): Remove unused parm, remove handling
1135 for co_return expansion.
1136 (register_await_info): Demote duplicate info message to a
1138 (coro_make_frame_entry): Move closer to use site.
1139 (struct susp_frame_data): Add fields for final suspend label
1140 and a flag to indicate await expressions with initializers.
1141 (captures_temporary): Delete.
1142 (register_awaits): Remove unused code, update comments.
1143 (find_any_await): New.
1144 (tmp_target_expr_p): New.
1145 (struct interesting): New.
1146 (find_interesting_subtree): New.
1147 (struct var_nest_node): New.
1148 (flatten_await_stmt): New.
1149 (handle_nested_conditionals): New.
1150 (process_conditional): New.
1151 (replace_statement_captures): Rename to...
1152 (maybe_promote_temps): ... this.
1153 (maybe_promote_captured_temps): Delete.
1154 (analyze_expression_awaits): Check for await expressions with
1155 initializers. Simplify handling for truth-and/or-if.
1156 (expand_one_truth_if): Simplify (map cases that need expansion
1158 (await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
1159 handling for truth-and/or-if expressions.
1160 (register_local_var_uses): Ensure that we create names in the
1161 implementation namespace.
1162 (morph_fn_to_coro): Add final suspend label to suspend frame
1163 callback data and remove it from the build_actor_fn call.
1165 2020-07-16 Marek Polacek <polacek@redhat.com>
1167 * call.c (convert_like): Remove macro and introduce a new
1169 (convert_like_with_context): Likewise.
1170 (convert_like_real): Rename to convert_like.
1171 (convert_like_real_1): Rename to convert_like_internal. Call
1172 convert_like instead of convert_like_real therein.
1173 (perform_direct_initialization_if_possible): Call convert_like
1174 instead of convert_like_real.
1176 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
1178 * coroutines.cc: Correct some spelling errors
1181 2020-07-15 Nathan Sidwell <nathan@acm.org>
1183 * parser.c (cp_parser_declaration): Avoid copying tokens.
1184 (cp_parser_block_declaration): RAII token pointer.
1186 2020-07-15 Nathan Sidwell <nathan@acm.org>
1188 * parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
1189 meeting a deferred pragma.
1190 (cp_parser_skip_to_end_of_statement): Likewise.
1191 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
1192 (cp_parser_skip_to_pragma_eol): We should never meet EOF.
1193 (cp_parser_omp_declare_simd): Likewise.
1194 (cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
1195 (pragma_lex): Likewise.
1197 2020-07-14 Marek Polacek <polacek@redhat.com>
1202 * call.c (convert_like_real_1): Renamed from convert_like_real.
1203 (convert_like_real): New wrapper for convert_like_real_1.
1205 2020-07-14 Nathan Sidwell <nathan@acm.org>
1207 * parser.c (cp_lexer_alloc): Do not deal with PCH here.
1208 (cp_lexer_new_main): Deal with PCH here. Store the tokens directly
1210 (cp_lexer_new_from_tokens): Assert last token isn't purged either.
1211 (cp_lexer_get_preprocessor_token): Change first arg to flags, adjust.
1212 (cp_parser_new): Pass the lexer in, don't create it here.
1213 (cp_parser_translation_unit): Initialize access checks here.
1214 (cp_parser_initial_pragma): First token is provided by caller,
1215 don't deal with PCH stopping here. Adjust error message.
1216 (c_parse_file): Adjust, change error message to avoid C++20 module
1219 2020-07-14 Nathan Sidwell <nathan@acm.org>
1221 * ptree.c (cxx_print_type): Add TYPEOF_TYPE and BASES.
1223 2020-07-14 Nathan Sidwell <nathan@acm.org>
1225 * class.c (build_base_field_1): Cache CLASSTYPE_AS_BASE.
1226 (build_self_reference): Rename value -> decl.
1227 (dump_class_hierarchy_1): Cache CLASSTYPE_AS_BASE.
1229 2020-07-14 Marek Polacek <polacek@redhat.com>
1232 * decl.c (grokdeclarator) <case cdk_function>: Check also
1233 pointers/references/... to functions.
1235 2020-07-14 Nathan Sidwell <nathan@acm.org>
1237 * cp-tree.h: Correct some tree lang flag comments,
1238 reformat some structure definitions. Note some structure
1239 sizes. Clarify some comments.
1240 (yyungetc): Delete. Not been a thing for some time.
1241 * class.c (copy_fndecl_with_name): Comment.
1242 (check_bases_and_members): Unnecessary {}.
1243 (layout_class_type): Comment.
1244 * cp-tree.def (UNBOUND_CLASS_TEMPLATE): Adjust comment.
1245 * decl.c: Fix some formatting & whitespace issues.
1246 (function_requirements_equivalent_p): Note why
1247 substitutions are needed.
1248 * decl2.c (no_linkage_error): Note that heroics about
1249 'typedef struct { ... };' are no longer needed.
1250 * method.c: Whitespace.
1251 * name-lookup.c: Whitespace.
1252 (add_decl_to_level): Reformat a line.
1253 (print_binding_stack): Mark as DEBUG_FUNCTION.
1254 (has_using_namespace_std_directive_p): Delete comment.
1256 * ptree.c: Whitespace.
1257 * rtti.c: Whitespace & comment.
1259 * typeck.c (structural_comptypes): Add comment.
1261 2020-07-13 Nathan Sidwell <nathan@acm.org>
1263 * Make-lang.in (c++.disclean): Likewise.
1265 2020-07-13 Marek Polacek <polacek@redhat.com>
1268 * parser.c (cp_parser_enum_specifier): Commit to tentative parse
1269 after we've seen an opening brace.
1271 2020-07-10 Jason Merrill <jason@redhat.com>
1273 * tree.c (structural_type_p): Allow unions.
1274 * mangle.c (write_expression): Express unions with a designator.
1276 2020-07-10 Jason Merrill <jason@redhat.com>
1278 * pt.c (convert_nontype_argument): Handle REAL_TYPE.
1279 (invalid_nontype_parm_type_p): Allow all structural types.
1280 * tree.c (structural_type_p): Use SCALAR_TYPE_P.
1282 2020-07-10 Jason Merrill <jason@redhat.com>
1287 * class.c (check_field_decls): An array of empty classes is not an
1289 (layout_empty_base_or_field): Handle explicit alignment.
1292 2020-07-09 Julian Brown <julian@codesourcery.com>
1293 Thomas Schwinge <thomas@codesourcery.com>
1296 * semantics.c (finish_omp_clauses): Likewise.
1298 2020-07-09 Patrick Palka <ppalka@redhat.com>
1301 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
1302 Restore dependent_type_p check that guarded the call to
1303 is_really_empty_class.
1305 2020-07-08 Patrick Palka <ppalka@redhat.com>
1308 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
1309 When processing_template_decl, check COMPLETE_TYPE_P before
1310 calling is_really_empty_class. Don't check dependent_type_p.
1312 2020-07-08 Marek Polacek <polacek@redhat.com>
1315 * parser.c (cp_parser_decltype): Print error about using decltype(auto)
1316 in C++11. Check that the token following "auto" is ")".
1318 2020-07-07 Patrick Palka <ppalka@redhat.com>
1321 * cxx-pretty-print.c (pp_cxx_unqualified_id): Check
1322 PRIMARY_TEMPLATE_P before printing the innermost template
1325 2020-07-07 Martin Sebor <msebor@redhat.com>
1328 * parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
1329 if warning_at returns nonzero.
1331 2020-07-06 Martin Sebor <msebor@redhat.com>
1334 * call.c (build_over_call): Check calls only when tf_warning is set.
1336 2020-07-06 Nathan Sidwell <nathan@acm.org>
1338 * decl.c (push_library_fn): Return the decl pushdecl_toplevel returns.
1339 * except.c (verify_library_fn): Replace with ...
1340 (declare_library_fn_1): ... this fn. Always push the fn.
1341 (declare_library_fn): Call it.
1342 (build_throw): Call declare_library_fn_1.
1344 2020-07-06 Jonathan Wakely <jwakely@redhat.com>
1347 * parser.c (cp_parser_toplevel_declaration): Only do pedwarn for
1348 empty-declaration in C++98.
1350 2020-07-02 Jason Merrill <jason@redhat.com>
1351 Jakub Jelinek <jakub@redhat.com>
1353 * decl.c (grokfndecl): Allow consteval virtual.
1354 * search.c (check_final_overrider): Check consteval mismatch.
1355 * constexpr.c (cxx_eval_thunk_call): New.
1356 (cxx_eval_call_expression): Call it.
1357 * cvt.c (cp_get_fndecl_from_callee): Handle FDESC_EXPR.
1358 * decl2.c (mark_vtable_entries): Track vtables with consteval.
1359 (maybe_emit_vtables): Pass consteval_vtables through.
1360 (clear_consteval_vfns): Replace consteval with nullptr.
1361 (c_parse_final_cleanups): Call it.
1363 2020-07-01 Nathan Sidwell <nathan@acm.org>
1365 * class.c (copy_fndecl_with_name): Add additional predicate args, do
1366 not deduce them locally.
1367 (copy_operator_fn): Adjust copy_fndecl_with_name call.
1368 (build_clone): Add vtt and inherited predicate args. Pass through
1369 to copy_fndecl_with_name call.
1370 (build_cdtor_clones): Likewise, pass through to build_clone as
1372 (build_cdtor): Determine vtt and inherited here.
1373 * cp-tree.h (DECL_NEEDS_CTT_PARM_P): Delete.
1375 2020-06-30 Nathan Sidwell <nathan@acm.org>
1377 * cp-tree.h (copy_fndecl_with_name): Rename to ...
1378 (copy_operatorn_fn): ... this. Change arg type.
1379 (clone_function_decl): Rename to ...
1380 (clone_cdtor): ... this.
1381 * class.c (copy_fndecl_with_name): Make static.
1382 (copy_operator_fn): New wrapper.
1383 (build_clones): Rename to ...
1384 (build_cdtor_clones): ... this.
1385 (clone_function_decl): Rename to ...
1386 (clone_cdtor): ... this. Adjust build_clones calls.
1387 (clone_constructors_and_destructors): Adjust clone_function_decl
1389 * method.c (implicitly_declare_fn): Adjust copy_fndecl_with_name
1391 (lazily_declare_fn): Adjust clone_function_decl call.
1392 * pt.c (tsubst_function_decl): Likewise.
1393 (instantiate_template_1): Likewise.
1395 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
1397 * coroutines.cc (morph_fn_to_coro): Remove trailing
1398 space in a diagnostic.
1400 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
1402 * coroutines.cc (expand_one_await_expression): Remove
1403 code dealing with initial suspend.
1404 (build_actor_fn): Remove code special-casing initial
1405 and final suspend. Handle the final suspend and marking
1406 of the coroutine as done.
1407 (coro_rewrite_function_body): New.
1408 (bind_expr_find_in_subtree): Remove.
1409 (coro_body_contains_bind_expr_p): Remove.
1410 (morph_fn_to_coro): Split the rewrite of the original
1411 function into coro_rewrite_function_body and call it.
1413 2020-06-29 Marek Polacek <polacek@redhat.com>
1416 * decl.c (duplicate_decls): Make sure a concept or a variable
1417 template is unique in its declarative region.
1419 2020-06-29 Marek Polacek <polacek@redhat.com>
1422 * pt.c (collect_ctor_idx_types): Use TREE_TYPE.
1424 2020-06-28 Iain Sandoe <iain@sandoe.co.uk>
1427 * coroutines.cc (register_local_var_uses): Skip past
1430 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
1433 * coroutines.cc (get_awaitable_var): New helper.
1434 (build_co_await): Check more carefully before
1435 copying an awaitable.
1436 (expand_one_await_expression): No initializer
1437 is required when the awaitable is not a temp.
1438 (register_awaits): Remove handling that is now
1439 completed when the await expression is built.
1441 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
1443 * coroutines.cc (morph_fn_to_coro): Diagnose unavailable
1444 get_return_object_on_allocation_failure.
1446 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
1449 * coroutines.cc (struct coroutine_info):Add a field
1450 to hold computed p.return_void expressions.
1451 (coro_build_promise_expression): New.
1452 (get_coroutine_return_void_expr): New.
1453 (finish_co_yield_expr): Build the promise expression
1454 using coro_build_promise_expression.
1455 (finish_co_return_stmt): Likewise.
1456 (build_init_or_final_await): Likewise.
1457 (morph_fn_to_coro): Likewise, for several cases.
1459 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
1461 * coroutines.cc (morph_fn_to_coro): Handle error
1462 returns in building g-r-o-o-a-f expressions.
1464 2020-06-24 Nicholas Krause <xerofoify@gmail.com>
1467 * typeck2.c (cxx_incomplete_type_diagnostic): Add missing
1468 TYPE_EXPANSION_PACK check for diagnosing incomplete types in
1469 cxx_incomplete_type_diagnostic.
1471 2020-06-24 Iain Sandoe <iain@sandoe.co.uk>
1475 * coroutines.cc (act_des_fn): Copy function
1476 attributes onto the outlined coroutine helpers.
1478 2020-06-24 Jason Merrill <jason@redhat.com>
1480 * call.c (build_over_call): Only call build_base_path once.
1482 2020-06-24 Jason Merrill <jason@redhat.com>
1485 * call.c (build_over_call): Look up the overrider in base_binfo.
1486 * class.c (lookup_vfn_in_binfo): Look through BINFO_PRIMARY_P.
1488 2020-06-23 Jason Merrill <jason@redhat.com>
1491 Implement C++20 P2082R1, Fixing CTAD for aggregates.
1492 * cp-tree.h (TPARMS_PRIMARY_TEMPLATE): Split out from...
1493 (DECL_PRIMARY_TEMPLATE): ...here.
1494 (builtin_guide_p): Declare.
1495 * decl.c (reshape_init_class): Handle bases of a template.
1496 (reshape_init_r): An array with dependent bound takes a single
1498 * pt.c (tsubst_default_argument): Shortcut {}.
1499 (unify_pack_expansion): Allow omitted arguments to trailing pack.
1500 (builtin_guide_p): New.
1501 (collect_ctor_idx_types): Give a trailing pack a {} default
1502 argument. Handle arrays better.
1504 2020-06-23 Iain Sandoe <iain@sandoe.co.uk>
1507 * coroutines.cc (morph_fn_to_coro): Apply a cleanup to
1508 the get return object when the DTOR is non-trivial.
1510 2020-06-20 Iain Sandoe <iain@sandoe.co.uk>
1513 * coroutines.cc (morph_fn_to_coro): Update handling of
1514 get-return-object-on-allocation-fail and diagnose missing
1517 2020-06-20 Jason Merrill <jason@redhat.com>
1519 * call.c (joust): Only compare constraints for non-template
1520 candidates with matching parameters.
1521 * pt.c (tsubst_pack_expansion): Fix getting a type parameter
1523 (more_specialized_fn): Only compare constraints for candidates with
1524 matching parameters.
1526 2020-06-19 Jason Merrill <jason@redhat.com>
1528 * method.c (early_check_defaulted_comparison): Allow defaulting
1529 comparison outside class. Complain if non-member operator isn't a
1532 2020-06-18 Jason Merrill <jason@redhat.com>
1534 * method.c (early_check_defaulted_comparison): Check for &&.
1535 (build_comparison_op): Allow empty union. Diagnose non-category
1537 (common_comparison_type): Remove handling for non-category type.
1539 2020-06-18 Marek Polacek <polacek@redhat.com>
1542 * pt.c (finish_template_variable): Return if
1543 coerce_innermost_template_parms return error_mark_node.
1545 2020-06-18 Marek Polacek <polacek@redhat.com>
1548 * pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
1549 if placement is erroneous.
1551 2020-06-17 Jonathan Wakely <jwakely@redhat.com>
1554 * parser.c (cp_parser_elaborated_type_specifier): Do not warn
1555 unless in a declaration.
1557 2020-06-17 Jason Merrill <jason@redhat.com>
1559 * cp-tree.h (copy_fndecl_with_name): Declare.
1560 * class.c (copy_fndecl_with_name): Split out from...
1561 (build_clone): ...here.
1562 (add_implicitly_declared_members): Add op== to TYPE_FIELDS.
1563 * method.c (implicitly_declare_fn): Use copy_fndecl_with_name.
1565 2020-06-17 Jason Merrill <jason@redhat.com>
1567 * call.c (build_new_op_1): Don't look for a CALL_EXPR when
1568 calling a consteval function.
1570 2020-06-17 Jason Merrill <jason@redhat.com>
1572 * decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED.
1573 * decl.c (duplicate_decls): Reduce error for delete
1574 after earlier declaration to pedwarn.
1576 2020-06-17 Marek Polacek <polacek@redhat.com>
1579 * constexpr.c (maybe_fold_non_dependent_expr): New.
1580 * cp-tree.h (maybe_fold_non_dependent_expr): Declare.
1581 * typeck.c (cp_build_array_ref): Call maybe_fold_non_dependent_expr
1582 instead of maybe_constant_value.
1584 2020-06-16 Marek Polacek <polacek@redhat.com>
1587 * call.c (add_list_candidates): Return if a designated initializer
1588 is used with a non-aggregate.
1589 (implicit_conversion_error): Give an error for the case above.
1591 2020-06-16 Marek Polacek <polacek@redhat.com>
1594 * name-lookup.c (check_local_shadow): Check if types are
1595 non-null before calling same_type_p.
1597 2020-06-16 Jakub Jelinek <jakub@redhat.com>
1599 * semantics.c (handle_omp_for_class_iterator): Adjust
1600 c_omp_check_loop_iv_exprs caller.
1601 (finish_omp_for): Likewise. Don't call fold_build_cleanup_point_expr
1602 before calling c_finish_omp_for and c_omp_check_loop_iv, move it
1604 * pt.c (tsubst_omp_for_iterator): Handle non-rectangular loops.
1606 2020-06-16 Jakub Jelinek <jakub@redhat.com>
1608 * parser.c (cp_parser_omp_clause_schedule): Reject modifier separated
1609 from kind by comma rather than colon.
1611 2020-06-16 Patrick Palka <ppalka@redhat.com>
1613 * pt.c (perform_instantiation_time_access_checks): No need to
1615 * semantics.c (enforce_access): Verify that decl is not
1618 2020-06-16 Patrick Palka <ppalka@redhat.com>
1622 * cp-tree.h (qualified_typedef_usage_s): Delete.
1623 (qualified_typedef_usage_t): Delete.
1624 (deferred_access_check): Move up in file.
1625 (tree_template_info::typedefs_needing_access_checking): Delete.
1626 (tree_template_info::deferred_access_checks): New field.
1627 (TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Rename to ...
1628 (TI_DEFERRED_ACCESS_CHECKS): ... this, and adjust accordingly.
1629 * pt.c (perform_typedefs_access_check): Rename to ...
1630 (perform_instantiation_time_access_checks): ... this, and adjust
1631 accordingly. Remove unnecessary tree tests.
1632 (instantiate_class_template_1): Adjust accordingly.
1633 (instantiate_decl): Likewise.
1634 * semantics.c (enforce_access): Likewise.
1636 2020-06-16 Patrick Palka <ppalka@redhat.com>
1640 * call.c (enforce_access): Move to semantics.c.
1641 * cp-tree.h (enforce_access): Delete.
1642 (get_types_needing_access_check): Delete.
1643 (add_typedef_to_current_template_for_access_check): Delete.
1644 * decl.c (make_typename_type): Adjust accordingly. Use
1645 check_accessibility_of_qualified_id instead of directly using
1646 perform_or_defer_access_check.
1647 * parser.c (cp_parser_template_declaration_after_parameters):
1648 Don't push a dk_no_check access state when parsing a template.
1649 * pt.c (get_types_needing_access_check): Delete.
1650 (append_type_to_template_for_access_check_1): Delete.
1651 (perform_typedefs_access_check): Adjust. If type_decl is a
1652 FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
1653 tsubst_copy instead of tsubst to substitute into type_decl so
1654 that we substitute into the DECL_CONTEXT of a FIELD_DECL.
1655 (append_type_to_template_for_access_check): Delete.
1656 * search.c (accessible_p): Remove the processing_template_decl
1658 * semantics.c (enforce_access): Moved from call.c. If we're
1659 parsing a template and the access check failed, add the check to
1660 TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
1661 (perform_or_defer_access_check): Adjust comment.
1662 (add_typedef_to_current_template_for_access_check): Delete.
1663 (check_accessibility_of_qualified_id): Adjust accordingly.
1664 Exit early if the scope is dependent.
1666 2020-06-11 Patrick Palka <ppalka@redhat.com>
1669 * constraint.cc (associate_classtype_constraints): If there is a
1670 discrepancy between the current template depth and the template
1671 depth of the original declaration, then adjust the template
1672 parameter depth within the current constraints appropriately.
1673 * pt.c (tsubst_friend_class): Substitute into and set the
1674 constraints on the injected declaration.
1676 2020-06-11 Iain Sandoe <iain@sandoe.co.uk>
1678 * coroutines.cc (instantiate_coro_traits): Pass a reference
1679 to lambda closure objects to traits instantiation.
1680 (morph_fn_to_coro): Likewise for promise parameter
1681 preview and allocator lookup.
1683 2020-06-10 Iain Sandoe <iain@sandoe.co.uk>
1686 * call.c (add_candidates): Use vec_safe_length() for
1687 testing the arguments list.
1688 (build_new_method_call_1): Use vec_safe_is_empty() when
1689 checking for an empty args list.
1691 2020-06-10 Marek Polacek <polacek@redhat.com>
1694 * parser.c (cp_parser_direct_declarator): Clear
1695 CP_PARSER_FLAGS_DELAY_NOEXCEPT if the declarator kind is not
1698 2020-06-09 Iain Sandoe <iain@sandoe.co.uk>
1701 * coroutines.cc (expand_one_await_expression): Build separate
1702 DTOR trees for the awaitable object on the destroy and resume
1705 2020-06-09 Jason Merrill <jason@redhat.com>
1708 * cp-gimplify.c (predeclare_vla): Only predeclare a VLA if it's
1709 wrapped in a pointer type.
1711 2020-06-05 Marek Polacek <polacek@redhat.com>
1714 * call.c (build_converted_constant_expr_internal): Allow
1715 list-initialization.
1717 2020-06-05 Iain Sandoe <iain@sandoe.co.uk>
1719 * cp-tree.def (CO_RETURN_EXPR): Correct the class
1720 to use tcc_statement.
1722 2020-06-05 Jason Merrill <jason@redhat.com>
1724 * error.c (dump_binary_op): Handle negative operand to
1727 2020-06-04 Jason Merrill <jason@redhat.com>
1730 * constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
1731 Evaluate OBJ_TYPE_REF_EXPR.
1733 2020-06-04 Jason Merrill <jason@redhat.com>
1736 * class.c (lookup_vfn_in_binfo): New.
1737 * call.c (build_over_call): Use it.
1738 * cp-tree.h (resolves_to_fixed_type_p): Add default argument.
1739 (lookup_vfn_in_binfo): Declare.
1741 2020-06-04 Iain Sandoe <iain@sandoe.co.uk>
1744 * coroutines.cc (morph_fn_to_coro): Ensure that the get-
1745 return-object is constructed correctly; When it is not the
1746 final return value, pass it to the CTOR of the return type
1747 as an rvalue, per the standard comment.
1749 2020-06-04 Jakub Jelinek <jakub@redhat.com>
1753 * constexpr.c (cxx_eval_constant_expression): Diagnose CONVERT_EXPR
1754 conversions from pointer types to arithmetic types here...
1755 (cxx_eval_outermost_constant_expr): ... instead of here.
1757 2020-06-03 Mark Wielaard <mark@klomp.org>
1759 * parser.c (cp_lexer_safe_previous_token): New function.
1760 (cp_parser_error_1): Add name_hint if the previous token is
1761 a string literal and next token is a CPP_NAME and we have a
1762 missing header suggestion for the name.
1764 2020-06-03 Patrick Palka <ppalka@redhat.com>
1766 * pt.c (process_partial_specialization): Pass the full set of
1767 generic template arguments to strictly_subsumes.
1769 2020-06-03 Patrick Palka <ppalka@redhat.com>
1772 * pt.c (most_specialized_partial_spec): Reorganize the loop over
1773 DECL_TEMPLATE_SPECIALIZATIONS. Check constraints_satisfied_p on
1774 the original template declaration, not on the tsubsted one.
1776 2020-06-03 Iain Sandoe <iain@sandoe.co.uk>
1779 * coroutines.cc (finish_co_await_expr): Revise to allow for
1781 (finish_co_yield_expr): Likewise.
1783 2020-06-03 Jason Merrill <jason@redhat.com>
1786 * cp-tree.h (predeclare_vla): Declare.
1787 * cp-gimplify.c (predeclare_vla): Handle getting a decl.
1788 * pt.c (tsubst_expr) [DECL_EXPR]: Use it.
1790 2020-06-03 Tobias Burnus <tobias@codesourcery.com>
1792 * cp-gimplify.c (cxx_omp_predetermined_mapping): New.
1793 * cp-objcp-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redfine.
1794 * cp-tree.h (cxx_omp_predetermined_mapping): Declare.
1796 2020-06-02 Jason Merrill <jason@redhat.com>
1799 * pt.c (tsubst_decl): Relax assert.
1801 2020-06-02 Iain Sandoe <iain@sandoe.co.uk>
1804 * coroutines.cc (build_co_await): Wrap the co_await expression
1805 in a TARGET_EXPR, where needed.
1806 (finish_co_yield_expr): Likewise.
1808 2020-06-02 Patrick Palka <ppalka@redhat.com>
1812 * pt.c (tsubst_function_decl): Don't do set_constraints when
1813 regenerating a lambda.
1814 (tsubst_lambda_expr): Substitute into the lambda's constraints
1815 and do set_constraints here.
1817 2020-06-01 Jason Merrill <jason@redhat.com>
1822 * class.c (build_vfn_ref): Revert 95311 change.
1823 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): Build a
1826 2020-06-01 Iain Sandoe <iain@sandoe.co.uk>
1829 * coroutines.cc (struct param_info): Remove rv_ref field.
1830 (build_actor_fn): Remove specifial rvalue ref handling.
1831 (morph_fn_to_coro): Likewise.
1833 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
1836 * coroutines.cc (morph_fn_to_coro): If we see an
1837 early fatal error, drop the erroneous function body.
1839 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
1841 * coroutines.cc (build_co_await): Remove unused
1843 (finish_co_await_expr): Likewise.
1844 (finish_co_yield_expr): Likewise; revise comment.
1846 2020-05-30 Iain Sandoe <iain@sandoe.co.uk>
1848 * coroutines.cc (morph_fn_to_coro): Revise initialization
1849 of the frame pointer to avoid an unused value.
1851 2020-05-30 Patrick Palka <ppalka@redhat.com>
1854 * constraint.cc (satisfaction_value): Accept INTEGER_CST of any
1857 2020-05-29 Patrick Palka <ppalka@redhat.com>
1858 Jason Merrill <jason@redhat.com>
1861 * class.c (add_method): Let special member function templates
1862 coexist if they are not equivalently constrained, or in a class
1865 2020-05-29 Jason Merrill <jason@redhat.com>
1868 * pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
1869 on the DECL_TEMPLATE_RESULT.
1871 2020-05-29 Marek Polacek <polacek@redhat.com>
1874 * cp-gimplify.c (cp_fold) <case MODIFY_EXPR>: Don't set
1875 TREE_THIS_VOLATILE here.
1876 (cp_fold): Set it here along with TREE_NO_WARNING.
1878 2020-05-29 Jason Merrill <jason@redhat.com>
1882 * class.c (build_vfn_ref): Don't fold the INDIRECT_REF.
1884 2020-05-29 Patrick Palka <ppalka@redhat.com>
1889 * parser.c (cp_parser_requires_clause_expression): Temporarily
1890 increment processing_template_decl only if it is 0.
1891 (cp_parser_constraint_expression): Likewise.
1892 (cp_parser_requires_expression): Likewise.
1894 2020-05-29 Patrick Palka <ppalka@redhat.com>
1897 * constexpr.c (get_or_insert_ctor_field): Add limited support
1898 for RANGE_EXPR index lookups.
1900 2020-05-28 Jakub Jelinek <jakub@redhat.com>
1903 * decl.c (cp_finish_decomp): Call complete_type before checking
1906 2020-05-28 Jason Merrill <jason@redhat.com>
1909 * decl.c (cp_finish_decl): Revert r9-297 change.
1910 (check_static_variable_definition): Likewise.
1911 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
1912 * pt.c (instantiate_decl): Return early on type error.
1914 2020-05-27 Jason Merrill <jason@redhat.com>
1917 * decl.c (reshape_init_array_1): Don't reuse in overload context.
1919 2020-05-27 Jason Merrill <jason@redhat.com>
1922 * call.c (build_new_op_1): Suppress
1923 warn_zero_as_null_pointer_constant across comparison of <=> result
1926 2020-05-27 Jason Merrill <jason@redhat.com>
1929 * decl.c (grokdeclarator): Don't shift attributes in TYPENAME
1932 2020-05-27 Nathan Sidwell <nathan@acm.org>
1935 * pt.c (lookup_template_class_1): Restore alias template mutation.
1937 2020-05-26 Jakub Jelinek <jakub@redhat.com>
1940 * cp-gimplify.c: Include omp-general.h.
1941 (cp_genericize_r) <case OMP_DISTRIBUTE>: For class iteration
1942 variables in composite distribute parallel for, instantiate copy
1943 ctor of their types.
1945 2020-05-23 Patrick Palka <ppalka@redhat.com>
1948 * constexpr.c (cxx_eval_constant_expression)
1949 <case TEMPLATE_ID_EXPR>: Don't evaluate the concept when
1950 constexpr evaluation is uid-sensitive.
1952 2020-05-22 Jason Merrill <jason@redhat.com>
1954 * cp-gimplify.c (cp_gimplify_expr) [CALL_EXPR]: Don't preevaluate
1955 the function address if the call used operator syntax.
1957 2020-05-21 Jason Merrill <jason@redhat.com>
1960 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): For a virtual
1961 call, instrument the OBJ_TYPE_REF.
1963 * decl.c (compute_array_index_type_loc): Diagnose expressions
1964 in a template that can't be constant.
1965 * parser.c (cp_parser_direct_declarator): Don't check
1966 non-constant array bounds here.
1968 * cp-tree.h (is_rvalue_constant_expression): Declare.
1969 * constexpr.c (is_rvalue_constant_expression): New.
1970 * parser.c (cp_parser_constant_expression): Use it.
1971 * decl.c (cp_finish_decl): Try to treat a constexpr initializer in a
1972 template as constant.
1974 * typeck.c (build_x_modify_expr): Handle error_mark_node arguments.
1976 * decl.c (grokparms): Return NULL_TREE if any parms were erroneous.
1978 2020-05-21 Iain Sandoe <iain@sandoe.co.uk>
1980 * coroutines.cc (finish_co_return_stmt): Revert change to use
1983 2020-05-21 Patrick Palka <ppalka@redhat.com>
1986 * constexpr.c (constexpr_ctx::uid_sensitive): Remove field.
1987 (uid_sensitive_constexpr_evaluation_value): Define.
1988 (uid_sensitive_constexpr_evaluation_true_counter): Define.
1989 (uid_sensitive_constexpr_evaluation_p): Define.
1990 (uid_sensitive_constexpr_evaluation_sentinel): Define its
1992 (uid_sensitive_constexpr_evaluation_checker): Define its
1993 constructor and its evaluation_restricted_p method.
1994 (get_fundef_copy): Remove 'ctx' parameter. Use u_s_c_e_p
1995 instead of constexpr_ctx::uid_sensitive.
1996 (cxx_eval_call_expression): Use u_s_c_e_p instead, and test it
1997 last. Adjust call to get_fundef_copy.
1998 (instantiate_cx_fn_r): Test u_s_c_e_p so that we increment the
1999 counter if necessary.
2000 (cxx_eval_outermost_constant_expr): Remove 'uid_sensitive'
2001 parameter. Adjust function body accordingly.
2002 (maybe_constant_value): Remove 'uid_sensitive' parameter and
2003 adjust function body accordingly. Set up a
2004 uid_sensitive_constexpr_evaluation_checker, and use it to
2005 conditionally update the cv_cache.
2006 * cp-gimplify.c (cp_fold): Set up a
2007 uid_sensitive_constexpr_evaluation_checker, and use it to
2008 conditionally update the fold_cache.
2009 * cp-tree.h (maybe_constant_value): Update declaration.
2010 (struct uid_sensitive_constexpr_evaluation_sentinel): Define.
2011 (struct sensitive_constexpr_evaluation_checker): Define.
2012 * expr.c (fold_for_warn): Set up a
2013 uid_sensitive_constexpr_evaluation_sentinel before calling
2014 the folding subroutines. Drop all but the first argument to
2015 maybe_constant_value.
2017 2020-05-20 Marek Polacek <polacek@redhat.com>
2020 * parser.c (cp_parser_unqualified_id): Reject simple-template-id as
2021 the declarator-id of a destructor.
2022 (cp_parser_constructor_declarator_p): Reject simple-template-id as
2023 the declarator-id of a constructor.
2025 2020-05-20 Marek Polacek <polacek@redhat.com>
2029 * cp-tree.h (SD_DECOMPOSITION): New flag.
2030 * decl.c (duplicate_decls): Make sure a structured binding is unique
2031 in its declarative region.
2032 (start_decl): If INITIALIZED is SD_DECOMPOSITION, call
2033 fit_decomposition_lang_decl.
2034 (grokdeclarator): Compare INITIALIZED directly to SD_* flags.
2035 * parser.c (cp_parser_decomposition_declaration): Pass SD_DECOMPOSITION
2038 2020-05-20 Patrick Palka <ppalka@redhat.com>
2041 * typeck.c (structural_comptypes): Don't perform
2042 context-dependent resolution of TYPENAME_TYPEs when
2043 comparing_specializations.
2045 2020-05-19 Nathan Sidwell <nathan@acm.org>
2047 * pt.c (lookup_template_class_1): Do not reinit template_info of an
2050 2020-05-18 Martin Sebor <msebor@redhat.com>
2053 * call.c ((maybe_warn_class_memaccess): Use is_byte_access_type.
2054 * cp-tree.h (is_dummy_object): Return bool.
2055 (is_byte_access_type): Declare new function.
2056 * tree.c (is_dummy_object): Return bool.
2057 (is_byte_access_type): Define new function.
2059 2020-05-19 Patrick Palka <ppalka@redhat.com>
2062 * pt.c (init_template_processing): Enable sanitization for
2063 decl_specializations and type_specializations.
2066 * pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
2067 the 'in_decl' parameter to coerce_template_parms.
2069 2020-05-18 Marek Polacek <polacek@redhat.com>
2072 * typeck.c (cp_build_binary_op): Use fold_for_warn instead of
2075 2020-05-18 Marek Polacek <polacek@redhat.com>
2078 * cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
2079 type is not INDIRECT_TYPE_P.
2080 * decl.c (omp_declare_variant_finalize_one): Call
2081 cp_get_callee_fndecl_nofold instead of looking for the function decl
2084 2020-05-18 Marek Polacek <polacek@redhat.com>
2087 * parser.c (cp_parser_has_attribute_expression): Sorry on a
2088 type-dependent argument.
2090 2020-05-18 Marek Polacek <polacek@redhat.com>
2094 * call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
2095 operator functions when type is std::nullptr_t for ==/!=.
2096 * typeck.c (composite_pointer_type_r): Add a bool * parameter. Use it
2097 to maybe add "const" to the pointer type.
2098 (composite_pointer_type): Update the call to composite_pointer_type_r.
2099 (cp_build_binary_op): Turn two warning_at into error_at. Print the
2102 2020-05-18 Jason Merrill <jason@redhat.com>
2104 * call.c (build_over_call): Remove unnecessary
2105 cp_stabilize_reference.
2107 2020-05-18 Marek Polacek <polacek@redhat.com>
2109 * call.c (add_builtin_candidate): Don't create a builtin overload
2110 candidate for ++ when type is bool in C++17.
2112 2020-05-18 Marek Polacek <polacek@redhat.com>
2114 * cfns.h: Regenerated.
2116 2020-05-17 Iain Sandoe <iain@sandoe.co.uk>
2118 * coroutines.cc (morph_fn_to_coro): Initialize the gro variable.
2120 2020-05-16 Iain Sandoe <iain@sandoe.co.uk>
2122 * coroutines.cc (finish_co_return_stmt): Implement rules
2123 from [class.copy.elision] /3.
2125 2020-05-16 Patrick Palka <ppalka@redhat.com>
2128 * semantics.c (finish_decltype_type): Call
2129 instantiate_non_dependent_expr_sfinae on the expression.
2131 2020-05-15 Patrick Palka <ppalka@redhat.com>
2135 2020-04-07 Patrick Palka <ppalka@redhat.com>
2138 * typeck2.c (process_init_constructor_array): Propagate
2139 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
2140 the array initializer.
2142 2020-05-15 Jason Merrill <jason@redhat.com>
2144 PR c++/93286 - ICE with __is_constructible and variadic template.
2145 * pt.c (tsubst_tree_list): New.
2146 (tsubst, tsubst_copy_and_build): Use it.
2147 * decl2.c (is_late_template_attribute): Handle error_mark_node args.
2149 2020-05-15 Nathan Sidwell <nathan@acm.org>
2151 * pt.c (template_args_equal): Fix thinkos in previous 'cleanup'.
2153 2020-05-14 Jason Merrill <jason@redhat.com>
2156 * pt.c (maybe_instantiate_noexcept): Change clone handling.
2158 2020-05-14 Patrick Palka <ppalka@redhat.com>
2161 * call.c (build_op_call): Pass complain to lookup_fnfields.
2162 (build_special_member_call): Likewise.
2163 * class.c (type_requires_array_cookie): Pass tf_warning_or_error
2165 * cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter.
2166 * except.c (build_throw): Pass tf_warning_or_error to
2168 * init.c (build_new_1): Pass complain to lookup_fnfields.
2169 * method.c (locate_fn_flags): Likewise.
2170 * name-lookup.c (lookup_name_real_1): Pass tf_warning_or_error
2172 * pt.c (tsubst_baselink): Pass complain to lookup_fnfields.
2173 * search.c (lookup_fnfields): New 'complain' parameter. Pass it
2176 2020-05-14 Nathan Sidwell <nathan@acm.org>
2178 * parser.c (cp_parser_diagnose_invalid_typename): Mention
2179 std=c++20 not 2a, reformat dependent binfo inform loops.
2181 * pt.c (tsubst_template_decl): Reorder and commonize some control
2184 * pt.c (tsubst_friend_function): Simplify control flow.
2186 * pt.c (lookup_template_class_1): Remove unnecessary else by
2187 simply grabbing TYPE_NAME earlier.
2189 * pt.c (push_template_decl_real): Adjust friend pushing logic.
2190 Reinit template type.
2192 * pt.c (build_template_decl): Init DECL_TEMPLATE_RESULT &
2194 (process_partial_specialization): ... not here ...
2195 (push_template_decl_real, add_inherited_template_parms)
2196 (build_deduction_guide): ... or here.
2198 2020-05-14 Jakub Jelinek <jakub@redhat.com>
2200 * cp-gimplify.c (cp_genericize_r): Set cfun->has_omp_target.
2202 2020-05-13 Patrick Palka <ppalka@redhat.com>
2205 * init.c (build_vec_delete_1): Just return error_mark_node if
2206 deallocate_expr is error_mark_node.
2207 (build_delete): Just return error_mark_node if do_delete is
2210 2020-05-13 Patrick Palka <ppalka@redhat.com>
2213 * constraint.cc (tsubst_requires_expr): Produce a new
2214 requires-expression when processing_template_decl, even if
2215 template arguments are not dependent.
2217 2020-05-13 Marek Polacek <polacek@redhat.com>
2220 * decl.c (duplicate_decls): Set DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.
2222 2020-05-13 Nathan Sidwell <nathan@acm.org>
2224 * pt.c (template_args_equal): Reorder category checking for
2227 * pt.c (perform_typedefs_access_check): Cache expensively
2228 calculated object references.
2229 (check_auto_in_tmpl_args): Just assert we do not get unexpected
2230 nodes, rather than silently do nothing.
2231 (append_type_to_template_for_access): Likewise, cache expensie
2234 * pt.c (canonical_type_parameter): Simplify.
2236 Formatting fixups & some simplifications.
2237 * pt.c (spec_hash_table): New typedef.
2238 (decl_specializations, type_specializations): Use it.
2239 (retrieve_specialization): Likewise.
2240 (register_specialization): Remove unnecessary casts.
2241 (push_template_decl_real): Reformat.
2242 (instantiate_class_template_1): Use more RAII.
2243 (make_argument_pack): Simplify.
2244 (instantiate_template_1): Use gcc_checking_assert for expensive
2246 (instantiate_decl): Likewise.
2247 (resolve_typename_type): Reformat comment.
2248 * semantics.c (struct deferred_access): Remove unnecessary GTY on
2250 (begin_class_definition): Fix formatting.
2252 2020-05-13 Jason Merrill <jason@redhat.com>
2254 * call.c, class.c, constexpr.c, constraint.cc, decl.c, init.c,
2255 lambda.c, lex.c, method.c, name-lookup.c, parser.c, pt.c, tree.c,
2256 typeck2.c: Change cxx2a to cxx20.
2258 2020-05-12 Marek Polacek <polacek@redhat.com>
2261 * parser.c (cp_parser_postfix_expression) <case CPP_OPEN_PAREN>: When
2262 looking for a block-scope function declaration, look through the whole
2263 set, not just the first function in the overload set.
2265 2020-05-12 Jakub Jelinek <jakub@redhat.com>
2268 * pt.c (tsubst_decl): Deal with DECL_OMP_PRIVATIZED_MEMBER for
2271 2020-05-11 Jason Merrill <jason@redhat.com>
2273 Resolve C++20 NB comment CA104
2274 * pt.c (determine_specialization): Compare constraints for
2275 specialization of member template of class instantiation.
2277 2020-05-11 Jason Merrill <jason@redhat.com>
2281 * tree.c (cp_walk_subtrees): Stop at typedefs.
2282 Handle TYPENAME_TYPE here.
2283 * pt.c (find_parameter_packs_r): Not here.
2284 (for_each_template_parm_r): Clear *walk_subtrees.
2285 * decl2.c (min_vis_r): Look through typedefs.
2287 2020-05-11 Jason Merrill <jason@redhat.com>
2289 * call.c (implicit_conversion_error): Split out from...
2290 (perform_implicit_conversion_flags): ...here.
2291 (build_converted_constant_expr_internal): Use it.
2293 2020-05-11 Jason Merrill <jason@redhat.com>
2296 * parser.c (inject_parm_decls): Set current_class_ptr here.
2297 (cp_parser_direct_declarator): And here.
2298 (cp_parser_late_return_type_opt): Not here.
2299 (cp_parser_noexcept_specification_opt): Nor here.
2300 (cp_parser_exception_specification_opt)
2301 (cp_parser_late_noexcept_specifier): Remove unneeded parameters.
2303 2020-05-11 Jason Merrill <jason@redhat.com>
2305 * decl.c (cxx_init_decl_processing): Call declare_weak for
2308 2020-05-11 Jason Merrill <jason@redhat.com>
2310 * pt.c (instantiate_class_template_1): Call tsubst_expr for
2311 STATIC_ASSERT member.
2312 * ptree.c (cxx_print_xnode): Handle STATIC_ASSERT.
2314 2020-05-11 Jason Merrill <jason@redhat.com>
2316 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Remove redundant
2317 walking of capture list.
2319 2020-05-11 Jason Merrill <jason@redhat.com>
2321 * cp-tree.h (LOOKUP_EXPLICIT_TMPL_ARGS): Remove.
2322 * call.c (build_new_function_call): Don't set it.
2323 (build_new_method_call_1): Likewise.
2324 (build_over_call): Check cand->explicit_targs instead.
2326 2020-05-11 Jason Merrill <jason@redhat.com>
2328 * decl.c (compute_array_index_type_loc): Stabilize before building
2331 2020-05-11 Jason Merrill <jason@redhat.com>
2333 * decl.c (grokdeclarator): Adjust deprecated_state here.
2334 (start_decl): Not here.
2336 2020-05-08 Iain Sandoe <iain@sandoe.co.uk>
2339 * coroutines.cc (build_actor_fn): Ensure that bind scopes
2340 are marked as having side-effects where necessary.
2341 (replace_statement_captures): Likewise.
2342 (morph_fn_to_coro): Likewise.
2344 2020-05-08 Nathan Sidwell <nathan@acm.org>
2346 * NEWS: Delete, it is so stale.
2348 * parser.c (cp_lexer_set_source_position_from_token): EOF has a
2351 2020-05-07 Iain Sandoe <iain@sandoe.co.uk>
2355 * coroutines.cc (morph_fn_to_coro): Set unformed outline
2356 functions to error_mark_node. For early error returns suppress
2357 warnings about missing ramp return values. Fix reinstatement
2358 of the function body on pre-existing initial error.
2359 * decl.c (finish_function): Use the normal error path for fails
2360 in the ramp function, do not try to compile the helpers if the
2363 2020-05-07 Marek Polacek <polacek@redhat.com>
2365 PR c++/94590 - Detect long double -> double narrowing.
2366 * typeck2.c (check_narrowing): Detect long double -> double
2367 narrowing even when double and long double have the same
2368 precision. Make it handle conversions to float too.
2370 2020-05-07 Marek Polacek <polacek@redhat.com>
2373 * parser.c (cp_parser_class_specifier_1): Check that the scope is
2374 nested inside current scope before pushing it.
2376 2020-05-07 Marek Polacek <polacek@redhat.com>
2379 * typeck2.c (check_narrowing): Consider T* to bool narrowing
2382 2020-05-07 Marek Polacek <polacek@redhat.com>
2384 * decl.c (grok_op_properties): Fix spelling of non-static.
2385 * typeck.c (build_class_member_access_expr): Likewise.
2387 2020-05-07 Richard Biener <rguenther@suse.de>
2390 * optimize.c (update_cloned_parm): Copy DECL_NOT_GIMPLE_REG_P.
2392 2020-05-06 Marek Polacek <polacek@redhat.com>
2395 * pt.c (tsubst_copy_and_build): Call type_dependent_expression_p_push
2396 instead of uses_template_parms. Move the warning_sentinels after the
2399 2020-05-06 Jakub Jelinek <jakub@redhat.com>
2402 * typeck.c (cp_strict_aliasing_warning): New function.
2403 (cp_build_indirect_ref_1, build_reinterpret_cast_1): Use
2404 it instead of strict_aliasing_warning.
2407 * method.c (defaulted_late_check): Don't call synthesize_method
2408 on constexpr sfk_comparison if it has been called on it already.
2410 2020-05-06 Nathan Sidwell <nathan@acm.org>
2413 * decl.c (grokdeclarator): Don't splice template attributes in
2414 parm context -- they can apply to the parm.
2416 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
2418 * coroutines.cc: Remove references to n4849 throughout.
2420 2020-05-05 Jason Merrill <jason@redhat.com>
2423 * pt.c (more_specialized_fn): Do consider parms with no deducible
2424 template parameters.
2426 2020-05-05 Jason Merrill <jason@redhat.com>
2429 * constexpr.c (potential_constant_expression_1): In a lambda
2430 function, consider a captured variable directly.
2432 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
2434 * coroutines.cc (transform_await_wrapper): Check that we have
2435 no unlowered co_yields.
2436 (captures_temporary): Likewise.
2437 (register_awaits): Likewise.
2439 2020-05-05 Nathan Sidwell <nathan@acm.org>
2442 * coroutines.cc (morph_fn_to_coro): Just check for
2444 * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name.
2446 2020-05-05 Marek Polacek <polacek@redhat.com>
2447 Jason Merrill <jason@redhat.com>
2450 * parser.c (cp_parser_postfix_dot_deref_expression): If we have
2451 a type-dependent object of class type, stash it to
2452 parser->context->object_type. If the postfix expression doesn't have
2454 (cp_parser_class_name): Consider object scope too.
2455 (cp_parser_lookup_name): Remove code dealing with the case when
2456 object_type is unknown_type_node.
2458 2020-05-04 Patrick Palka <ppalka@redhat.com>
2461 * cp-gimplify.c (cp_fold) <case CALL_EXPR>: Move some variable
2462 declarations closer to their uses. Copy the CALL_EXPR only
2463 when one of its arguments has changed.
2464 <case TREE_VEC>: Instead of first collecting the folded
2465 arguments into a releasing_vec, just make a copy of the TREE_VEC
2466 as soon as folding changes one of its arguments.
2468 2020-05-04 Iain Sandoe <iain@sandoe.co.uk>
2470 * coroutines.cc (morph_fn_to_coro): Mark the coro.gro variable
2471 as artificial and ignored.
2473 2020-05-04 Nathan Sidwell <nathan@acm.org>
2475 pt.c (process_template_parm): Don't walk the template list twice,
2476 remember the final node instead.
2477 (end_template_parm_list): Refactor. Comment on why we do a pop
2480 PR c++/94827 -- don't save parms in nested requirement
2481 * constraint.cc (tsubst_nested_requirement): TYPE directly holds
2482 notmalized requirement.
2483 (finish_nested_requirement): Don't stash current tpl parms into
2485 (diagnose_nested_requirement): TYPE directly holds notmalized
2488 2020-05-01 Patrick Palka <ppalka@redhat.com>
2491 * cp-tree.h (check_accessibility_of_qualified_id): Add
2492 tsubst_flags_t parameter and change return type to bool.
2493 * parser.c (cp_parser_lookup_name): Pass tf_warning_to_error to
2494 check_accessibility_of_qualified_id.
2495 * pt.c (tsubst_qualified_id): Return error_mark_node if
2496 check_accessibility_of_qualified_id returns false.
2497 * semantics.c (check_accessibility_of_qualified_id): Add
2498 complain parameter. Pass complain instead of
2499 tf_warning_or_error to perform_or_defer_access_check. Return
2500 true unless perform_or_defer_access_check returns false.
2502 2020-05-01 Marek Polacek <polacek@redhat.com>
2505 * typeck2.c (process_init_constructor_record): Return PICFLAG_ERRONEOUS
2506 if an initializer element was erroneous.
2508 2020-05-01 Jason Merrill <jason@redhat.com>
2511 * init.c (get_nsdmi): Don't push_to_top_level for a local class.
2513 2020-05-01 Jason Merrill <jason@redhat.com>
2516 * decl.c (cp_finish_decl): Also clear TREE_READONLY if
2517 -fmerge-all-constants.
2519 2020-05-01 Jason Merrill <jason@redhat.com>
2522 * pt.c (tsubst_decl): Make sure DECL_VALUE_EXPR continues to have
2523 the same type as the variable.
2525 2020-04-30 Jason Merrill <jason@redhat.com>
2526 Nathan Sidwell <nathan@acm.org>
2529 * constraint.cc (map_arguments): If ARGS is null, it's a
2530 self-mapping of parms.
2531 (finish_nested_requirement): Do not pass argified
2532 current_template_parms to normalization.
2533 (tsubst_nested_requirement): Don't assert no template parms.
2535 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2538 * coroutines.cc (transform_local_var_uses): Defer walking
2539 the DECL_INITIALs of BIND_EXPR vars until all the frame
2540 allocations have been made.
2542 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2545 * coroutines.cc (register_awaits): Update target
2546 expressions for awaitable and suspend handle
2549 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2552 * coroutines.cc (build_co_await): Account for variables
2553 with DECL_VALUE_EXPRs.
2554 (captures_temporary): Likewise.
2555 (register_awaits): Likewise.
2557 2020-04-29 Patrick Palka <ppalka@redhat.com>
2560 * pt.c (find_template_parameter_info::parm_list): New field.
2561 (keep_template_parm): Use the new field to build up the
2562 parameter list here instead of ...
2563 (find_template_parameters): ... here. Return ftpi.parm_list.
2565 2020-04-29 Jakub Jelinek <jakub@redhat.com>
2568 * class.c (build_base_field): Set DECL_FIELD_ABI_IGNORED on C++17 empty
2569 base artificial FIELD_DECLs.
2570 (layout_class_type): Set DECL_FIELD_ABI_IGNORED on empty class
2571 field_poverlapping_p FIELD_DECLs.
2573 2020-04-29 Patrick Palka <ppalka@redhat.com>
2576 * constraint.cc (satisfy_declaration_constraints): Use saved_t
2577 instead of t as the key to decl_satisfied_cache.
2580 * error.c (print_requires_expression_info): Print the dependent
2581 form of the parameter list with its template parameter mapping,
2582 rather than printing the substituted form.
2584 2020-04-28 Jason Merrill <jason@redhat.com>
2587 * decl.c (use_eh_spec_block): Check nothrow type after
2589 * pt.c (maybe_instantiate_noexcept): Call synthesize_method for
2590 DECL_MAYBE_DELETED fns here.
2591 * decl2.c (mark_used): Not here.
2592 * method.c (get_defaulted_eh_spec): Reject DECL_MAYBE_DELETED here.
2594 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
2597 * coroutines.cc (instantiate_coro_traits): Pass a reference to
2598 object type rather than a pointer type for 'this', for method
2600 (struct param_info): Add a field to hold that the parm is a lambda
2602 (morph_fn_to_coro): Check for lambda closure pointers in the
2603 args. Use a reference to *this when building the args list for the
2604 promise allocator lookup.
2606 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
2609 * coroutines.cc (coro_promise_type_found_p): Do not
2610 exclude non-classes here (this needs to be handled in the
2612 (morph_fn_to_coro): Allow for the case where the coroutine
2615 2020-04-27 Iain Sandoe <iain@sandoe.co.uk>
2618 * coroutines.cc (struct local_var_info): Add fields for static
2619 variables and those with DECL_VALUE_EXPR redirection.
2620 (transform_local_var_uses): Skip past typedefs and static vars
2621 and then account for redirected variables.
2622 (register_local_var_uses): Likewise.
2624 2020-04-27 Jason Merrill <jason@redhat.com>
2628 * decl.c (grokdeclarator): Move dependent attribute to decl.
2629 * decl2.c (splice_template_attributes): No longer static.
2631 2020-04-27 Patrick Palka <ppalka@redhat.com>
2634 * constexpr.c (cxx_eval_call_expression): Don't set new_obj if we're
2635 evaluating the target constructor of a delegating constructor.
2636 (cxx_eval_store_expression): Don't set TREE_READONLY if the LHS of the
2637 INIT_EXPR is '*this'.
2639 2020-04-26 Marek Polacek <polacek@redhat.com>
2642 * call.c (struct conversion): Add copy_init_p.
2643 (standard_conversion): Set copy_init_p in ck_base and ck_rvalue
2644 if FLAGS demands LOOKUP_ONLYCONVERTING.
2645 (convert_like_real) <case ck_base>: If copy_init_p is set, or
2646 LOOKUP_ONLYCONVERTING into FLAGS.
2648 2020-04-26 Iain Sandoe <iain@sandoe.co.uk>
2651 * coroutines.cc (morph_fn_to_coro): Ensure that
2652 unnamed function params have a usable and distinct
2655 2020-04-24 Jason Merrill <jason@redhat.com>
2658 * decl.c (redeclaration_error_message): Reject defaulted comparison
2659 operator that has been previously declared.
2661 2020-04-25 Patrick Palka <ppalka@redhat.com>
2663 * parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
2664 concepts if the invalid identifier is 'requires'.
2666 2020-04-25 Jakub Jelinek <jakub@redhat.com>
2669 * semantics.c (finish_call_expr): When looking if all overloads
2670 are noreturn, use STRIP_TEMPLATE to look through TEMPLATE_DECLs.
2672 2020-04-24 Martin Liska <mliska@suse.cz>
2674 * coroutines.cc: Fix compilation error for release checking
2675 where we miss declaration of ‘coro_body_contains_bind_expr_p’.
2677 2020-04-23 Patrick Palka <ppalka@redhat.com>
2679 * tree.c (zero_init_expr_p): Use uses_template_parms instead of
2683 * pt.c (template_class_depth): Walk into the DECL_FRIEND_CONTEXT of a
2684 friend declaration rather than into its CP_DECL_CONTEXT.
2686 2020-04-23 Iain Sandoe <iain@sandoe.co.uk>
2689 * coroutines.cc (await_statement_expander): Simplify cases.
2690 (struct susp_frame_data): Add fields for truth and/or if
2691 cases, rename one field.
2692 (analyze_expression_awaits): New.
2693 (expand_one_truth_if): New.
2694 (add_var_to_bind): New helper.
2695 (coro_build_add_if_not_cond_break): New helper.
2696 (await_statement_walker): Handle conditional expressions,
2697 handle expansion of truth-and/or-if cases.
2698 (bind_expr_find_in_subtree): New, checking-only.
2699 (coro_body_contains_bind_expr_p): New, checking-only.
2700 (morph_fn_to_coro): Ensure that we have a top level bind
2703 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
2705 PR translation/94698
2706 * class.c (check_field_decls): Change "define" to "declare" in
2707 -Weffc++ diagnostics.
2709 2020-04-22 Patrick Palka <ppalka@redhat.com>
2713 * constraint.cc (satisfy_declaration_constraints): If the inherited
2714 constructor points to an instantiation of a constructor template,
2715 remember and use its attached template arguments.
2717 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
2719 PR translation/94698
2720 * class.c (check_field_decls): Change "override" to "define" in
2721 -Weffc++ diagnostics.
2723 2020-04-22 Iain Sandoe <iain@sandoe.co.uk>
2726 * coroutines.cc (struct param_info): Add a field to note that
2727 the param is 'this'.
2728 (morph_fn_to_coro): Convert this to a reference before using it
2729 in the promise parameter preview.
2731 2020-04-22 Jason Merrill <jason@redhat.com>
2734 * pt.c (register_parameter_specializations): If the instantiation is
2735 still a parameter pack, don't wrap it in a NONTYPE_ARGUMENT_PACK.
2736 (tsubst_pack_expansion, tsubst_expr): Adjust.
2738 2020-04-22 Martin Sebor <msebor@redhat.com>
2739 Jason Merrill <jason@redhat.com>
2742 * decl.c (reshape_init_array_1): Avoid stripping redundant trailing
2743 zero initializers...
2744 * mangle.c (write_expression): ...and handle them here even for
2745 pointers to members by calling zero_init_expr_p.
2746 * cp-tree.h (zero_init_expr_p): Declare.
2747 * tree.c (zero_init_expr_p): Define.
2748 (type_initializer_zero_p): Remove.
2749 * pt.c (tparm_obj_values): New hash_map.
2750 (get_template_parm_object): Store to it.
2751 (tparm_object_argument): New.
2753 2020-04-22 Patrick Palka <ppalka@redhat.com>
2756 * constraint.cc (diagnose_valid_expression): Check convert_to_void here
2757 as well as in tsubst_valid_expression_requirement.
2759 2020-04-21 Patrick Palka <ppalka@redhat.com>
2762 * constraint.cc (satisfy_declaration_constraints): Don't strip the
2763 inherited constructor if it already has template information.
2766 * pt.c (any_template_parm_r) <case IDENTIFIER_NODE>: New case. If this
2767 is a conversion operator, visit its TREE_TYPE.
2769 2020-04-21 Nathan Sidwell <nathan@acm.org>
2771 * pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for
2774 2020-04-21 Iain Sandoe <iain@sandoe.co.uk>
2777 * coroutines.cc (morph_fn_to_coro): Simplify return
2780 2020-04-17 Marek Polacek <polacek@redhat.com>
2783 * constexpr.c (cxx_eval_outermost_constant_expr): Return when T is
2784 a BRACE_ENCLOSED_INITIALIZER_P.
2785 (is_nondependent_constant_expression): Don't check
2786 BRACE_ENCLOSED_INITIALIZER_P.
2787 (is_nondependent_static_init_expression): Likewise.
2789 2020-04-20 Patrick Palka <ppalka@redhat.com>
2792 * cp-tree.h (lss_policy::lss_nop): New enumerator.
2793 * pt.c (local_specialization_stack::local_specialization_stack): Handle
2795 (local_specialization_stack::~local_specialization_stack): Likewise.
2796 (tsubst_pack_expansion): Use a local_specialization_stack instead of
2797 manually saving and restoring local_specializations. Conditionally
2798 replace local_specializations sooner, before the handling of the
2799 unsubstituted_packs case.
2801 2020-04-20 Marek Polacek <polacek@redhat.com>
2803 PR c++/94505 - bogus -Wparentheses warning with fold-expression.
2804 * pt.c (fold_expression): Add warning_sentinel for -Wparentheses
2805 before calling build_x_binary_op.
2807 2020-04-20 Marek Polacek <polacek@redhat.com>
2809 * coroutines.cc (captures_temporary): Don't assign the result of
2810 STRIP_NOPS to the same variable.
2812 2020-04-20 Nathan Sidwell <nathan@acm.org>
2814 PR c++/94454 - tpl-tpl-parms are not canonicalizable types
2815 * pt.c (canonical_type_parameter): Assert not a tpl-tpl-parm.
2816 (process_template_parm): tpl-tpl-parms are structural.
2817 (rewrite_template_parm): Propagate structuralness.
2819 PR c++/94454 - Expr pack expansion equality
2820 * tree.c (cp_tree_equal) [TEMPLATE_ID_EXPR, default]: Refactor.
2821 [EXPR_PACK_EXPANSION]: Add.
2823 PR c++/94454 Template Argument Hashing
2824 * pt.c (iterative_hash_template_arg): Strip nodes as
2825 template_args_equal does.
2826 [ARGUMENT_PACK_SELECT, TREE_VEC, CONSTRUCTOR]: Refactor.
2827 [node_class:TEMPLATE_TEMPLATE_PARM]: Hash by level & index.
2828 [node_class:default]: Refactor.
2830 2020-04-18 Patrick Palka <ppalka@redhat.com>
2833 * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
2834 comparing_specializations if the parameters' contexts are identical.
2837 * pt.c (splice_late_return_type): Propagate cv-qualifiers and
2838 PLACEHOLDER_TYPE_CONSTRAINTS from the original auto node to the new one.
2840 2020-04-17 Patrick Palka <ppalka@redhat.com>
2843 * lambda.c (lambda_capture_field_type): Avoid doing auto deduction if
2844 the explicit initializer has parameter packs.
2847 * parser.c (cp_parser_check_template_parameters): Before issuing a hard
2848 error, first try simulating an error instead.
2850 2020-04-17 Jakub Jelinek <jakub@redhat.com>
2853 * call.c (build_conditional_expr_1): Remove redundant assignment to
2856 2020-04-16 Patrick Palka <ppalka@redhat.com>
2859 * cvt.c (ocp_convert): If the result of scalar_constant_value is
2860 erroneous, ignore it and use the original expression.
2862 2020-04-16 Jakub Jelinek <jakub@redhat.com>
2865 * parser.c (cp_parser_simple_declaration): Fix up a pasto in
2868 2020-04-15 Jakub Jelinek <jakub@redhat.com>
2871 * parser.c (cp_parser_pragma) <case PRAGMA_OMP_REQUIRES>: Reject
2872 requires directive when not at file or namespace scope.
2874 2020-04-14 Iain Sandoe <iain@sandoe.co.uk>
2877 * coroutines.cc (build_actor_fn): Check that the target can
2878 support the resume tailcall before mandating it.
2880 2020-04-14 Patrick Palka <ppalka@redhat.com>
2883 * cxx-pretty-print.c (cxx_pretty_printer:simple_type_specifier)
2884 <case DECLTYPE_TYPE>: Handle DECLTYPE_TYPE here instead of ...
2885 (pp_cxx_type_specifier_seq) <case DECLTYPE_TYPE>: ... here.
2886 (cxx_pretty_printer::direct_abstract_declarator) <case DECLTYPE_TYPE>:
2890 * constexpr.c (replace_result_decl_data): New struct.
2891 (replace_result_decl_data_r): New function.
2892 (replace_result_decl): New function.
2893 (cxx_eval_call_expression): Use it.
2894 * tree.c (build_aggr_init_expr): Set the location of the AGGR_INIT_EXPR
2895 to that of its initializer.
2897 2020-04-13 Marek Polacek <polacek@redhat.com>
2900 * name-lookup.c (check_local_shadow): Add an inform call.
2902 2020-04-13 Patrick Palka <ppalka@redhat.com>
2905 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
2906 dump_function_decl when printing a function template instantiation as a
2910 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
2912 (cxx_eval_bare_aggregate): Use get_or_insert_ctor_field instead of
2913 assuming the the next index belongs at the end of the new CONSTRUCTOR.
2914 (cxx_eval_store_expression): Revert PR c++/78572 fix.
2916 2020-04-13 Nathan Sidwell <nathan@acm.org>
2918 PR c++/94426 lambdas with internal linkage are different to no-linkage
2919 * decl2.c (determine_visibility): A lambda's visibility is
2920 affected by its extra scope.
2921 * pt.c (instantiate_decl): Determine var's visibility before
2922 instantiating its initializer.
2923 * tree.c (no_linkage_check): Revert code looking at visibility of
2924 lambda's extra scope.
2926 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
2929 * coroutines.cc (co_await_expander): Remove.
2930 (expand_one_await_expression): New.
2931 (process_one_statement): New.
2932 (await_statement_expander): New.
2933 (build_actor_fn): Revise to use per-statement expander.
2934 (struct susp_frame_data): Reorder and comment.
2935 (register_awaits): Factor code.
2936 (replace_statement_captures): New, factored from...
2937 (maybe_promote_captured_temps):.. here.
2938 (await_statement_walker): Revise to process per statement.
2939 (morph_fn_to_coro): Use revised susp_frame_data layout.
2941 2020-04-10 Marek Polacek <polacek@redhat.com>
2944 * method.c (constructible_expr): In C++20, try using parenthesized
2945 initialization of aggregates to determine the result of
2948 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
2950 * coroutines.cc (co_await_expander): Simplify.
2952 2020-04-09 Jason Merrill <jason@redhat.com>
2955 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
2956 ctx->object and ctx->global->values first.
2958 2020-04-09 Marek Polacek <polacek@redhat.com>
2961 * call.c (initialize_reference): If the reference binding failed, maybe
2962 try initializing from { }.
2963 * decl.c (grok_reference_init): For T& t(e), set
2964 LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet.
2966 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
2967 Jun Ma <JunMa@linux.alibaba.com>
2969 * coroutines.cc (maybe_promote_captured_temps): Add a cleanup
2970 expression, if needed, to any call from which we promoted
2971 temporaries captured by reference.
2973 2020-04-08 Marek Polacek <polacek@redhat.com>
2975 PR c++/94507 - ICE-on-invalid with lambda template.
2976 * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
2977 tsubst_function_decl returns error_mark_node.
2979 2020-04-08 Martin Liska <mliska@suse.cz>
2982 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
2983 (cxx_init_decl_processing): Mark replaceable all implicitly defined
2986 2020-04-08 Patrick Palka <ppalka@redhat.com>
2988 Core issues 1001 and 1322
2990 * pt.c (rebuild_function_or_method_type): Split function out from ...
2991 (tsubst_function_type): ... here.
2992 (maybe_rebuild_function_decl_type): New function.
2993 (tsubst_function_decl): Use it.
2995 2020-04-08 Jakub Jelinek <jakub@redhat.com>
2998 * decl.c (begin_destructor_body): For CLASSTYPE_VBASECLASSES class
2999 dtors, if CLASSTYPE_PRIMARY_BINFO is non-NULL, but not BINFO_VIRTUAL_P,
3000 look at CLASSTYPE_PRIMARY_BINFO of its BINFO_TYPE if it is not
3001 BINFO_VIRTUAL_P, and so on.
3003 2020-04-08 Marek Polacek <polacek@redhat.com>
3005 PR c++/94478 - ICE with defaulted comparison operator
3006 * method.c (early_check_defaulted_comparison): Give an error when the
3009 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
3012 * paser.c (cp_parser_oacc_declare): Add check that variables
3013 are declared in the same scope as the directive.
3015 2020-04-07 Jason Merrill <jason@redhat.com>
3018 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
3021 * parser.c (cp_parser_placeholder_type_specifier): Use
3024 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
3026 * coroutines.cc (maybe_promote_captured_temps): Ensure that
3027 reference capture placeholder vars are properly declared.
3029 2020-04-07 Patrick Palka <ppalka@redhat.com>
3032 * tree.c (replace_placeholders): Look through all handled components,
3033 not just COMPONENT_REFs.
3034 * typeck2.c (process_init_constructor_array): Propagate
3035 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
3036 the array initializer.
3038 2020-04-07 Jakub Jelinek <jakub@redhat.com>
3041 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
3042 if cp_parser_omp_master succeeded.
3044 2020-04-06 Jason Merrill <jason@redhat.com>
3047 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
3049 2020-04-04 Marek Polacek <polacek@redhat.com>
3050 Jason Merrill <jason@redhat.com>
3052 PR c++/94155 - crash in gimplifier with paren init of aggregates.
3053 * init.c (build_vec_init): Fill in indexes.
3055 2020-04-04 Jason Merrill <jason@redhat.com>
3058 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
3060 2020-04-04 Patrick Palka <ppalka@redhat.com>
3064 * constexpr.c (struct constexpr_ctx): New field 'parent'.
3065 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
3066 flag from the original constructor to the reduced constructor.
3067 (lookup_placeholder): Prefer to return the outermost matching object
3068 by recursively calling lookup_placeholder on the 'parent' context,
3069 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
3070 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
3071 context via 'new_ctx.parent' when being expanded without an explicit
3072 target. Don't call replace_placeholders.
3073 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
3077 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
3078 support for VECTOR_TYPEs, and optimizations for the common case)
3080 (cxx_eval_store_expression): ... here. Rename local variable
3081 'changed_active_union_member_p' to 'activated_union_member_p'. Record
3082 the sequence of indexes into 'indexes' that yields the subobject we're
3083 assigning to. Record the integer offsets of the constructor indexes
3084 we're assigning through into 'index_pos_hints'. After evaluating the
3085 initializer of the store expression, recompute 'valp' using 'indexes'
3086 and using 'index_pos_hints' as hints.
3087 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
3088 to recompute the constructor_elt pointer we're assigning through after
3089 evaluating each initializer.
3091 2020-04-04 Jason Merrill <jason@redhat.com>
3094 * constraint.cc (tsubst_valid_expression_requirement): Call
3097 2020-04-04 Jason Merrill <jason@redhat.com>
3100 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
3101 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
3104 2020-04-04 Jakub Jelinek <jakub@redhat.com>
3107 * parser.c (cp_parser_omp_for_loop): Use
3108 protected_set_expr_location_if_unset.
3109 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
3112 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
3113 omp_parallel_combined_clauses.
3115 2020-04-03 Jason Merrill <jason@redhat.com>
3118 * pt.c (complex_pack_expansion_r): New.
3119 (complex_alias_template_p): Use it.
3121 2020-03-31 Jason Merrill <jason@redhat.com>
3124 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
3125 replace_placeholders.
3126 * typeck2.c (store_init_value): Fix arguments to
3127 fold_non_dependent_expr.
3129 2020-03-31 Jason Merrill <jason@redhat.com>
3131 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
3134 2020-03-30 Jason Merrill <jason@redhat.com>
3137 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
3138 (called_fns_equal): Check DECL_CONTEXT.
3140 2020-03-30 Jakub Jelinek <jakub@redhat.com>
3143 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
3144 STATEMENT_CODE_P code.
3146 2020-03-28 Patrick Palka <ppalka@redhat.com>
3149 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
3150 "requires {" when "requires requires {" was probably intended.
3153 * constraint.cc (tsubst_compound_requirement): Always suppress errors
3154 from type_deducible_p and expression_convertible_p, as they're not
3155 substitution errors.
3156 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
3157 that we diagnose INTEGER_CST expressions of non-bool type via the
3159 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
3160 * parser.c (cp_parser_requires_expression): Always parse the requirement
3161 body as if we're processing a template, by temporarily incrementing
3162 processing_template_decl. Afterwards, if we're not actually in a
3163 template context, perform semantic processing to diagnose any invalid
3164 types and expressions.
3165 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
3166 * semantics.c (finish_static_assert): Explain an assertion failure
3167 when the condition is a REQUIRES_EXPR like we do when it is a concept
3170 * constraint.cc (diagnose_compound_requirement): When diagnosing a
3171 compound requirement, maybe replay the satisfaction failure, subject to
3172 the current diagnosis depth.
3174 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
3175 as well as its range, because build_x_binary_op doesn't always do so.
3176 (current_constraint_diagnosis_depth): New.
3177 (concepts_diagnostics_max_depth_exceeded_p): New.
3178 (collect_operands_of_disjunction): New.
3179 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
3180 replay each branch of the disjunction, subject to the current diagnosis
3182 (diagnose_valid_expression): When diagnosing a satisfaction failure,
3183 maybe replay the substitution error, subject to the current diagnosis
3185 (diagnose_valid_type): Likewise.
3186 (diagnose_nested_requiremnet): Likewise.
3187 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
3188 current_constraint_diagnosis_depth when diagnosing.
3189 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
3190 current_constraint_diagnosis_depth when diagnosing.
3191 (diagnosing_failed_constraint::replay_errors_p): New static member
3193 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
3194 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
3195 the limit was exceeded.
3196 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
3198 2020-03-27 Nathan Sidwell <nathan@acm.org>
3201 * name-lookup.c (do_pushdecl): Look through cleanp levels.
3203 2020-03-27 Martin Sebor <msebor@redhat.com>
3208 * cp-tree.h (most_specialized_partial_spec): Declare.
3209 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
3211 (specialization_of): New function.
3212 (cp_parser_check_class_key): Move code...
3213 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
3214 -Wredundant-tags on first-time declarations in other declarators.
3215 Correct handling of template specializations.
3216 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
3217 when -Wredundant-tags is enabled. Use primary template or partial
3218 specialization as the guide for uses of implicit instantiations.
3219 * pt.c (most_specialized_partial_spec): Declare extern.
3221 2020-03-27 Nathan Sidwell <nathan@acm.org>
3224 * name-lookup.c (push_namespace): Triage ambiguous lookups that
3227 2020-03-27 Jakub Jelinek <jakub@redhat.com>
3230 * call.c (set_flags_from_callee): Don't update
3231 cp_function_chain->can_throw or current_function_returns_abnormally
3232 if cp_unevaluated_operand.
3235 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
3236 operand and creating a new COMPOUND_EXPR if anything changed.
3238 2020-03-26 Marek Polacek <polacek@redhat.com>
3240 PR c++/94336 - template keyword accepted before destructor names.
3241 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
3242 is followed by a destructor name.
3244 2020-03-27 Patrick Palka <ppalka@redhat.com>
3246 * decl.c (compute_array_index_type_loc): Remove redundant
3247 type_dependent_expression_p check that is subsumed by
3248 value_dependent_expression_p.
3249 * decl2.c (is_late_template_attribute): Likewise.
3250 * pt.c (uses_template_parms): Likewise.
3251 (dependent_template_arg_p): Likewise.
3253 2020-03-26 Marek Polacek <polacek@redhat.com>
3256 PR c++/94057 - template keyword in a typename-specifier.
3257 * parser.c (check_template_keyword_in_nested_name_spec): New.
3258 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
3259 'template'. Call check_template_keyword_in_nested_name_spec.
3260 (cp_parser_simple_type_specifier): Assume that a <
3261 following a qualified-id in a typename-specifier begins
3262 a template argument list.
3264 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
3266 * coroutines.cc (coro_init_identifiers): Initialize an identifier
3267 for the cororoutine handle 'address' method name.
3268 (struct coro_aw_data): Add fields to cover the continuations.
3269 (co_await_expander): Determine the kind of await_suspend in use.
3270 If we have the case that returns a continuation handle, then save
3271 this and make the target for 'scope exit without cleanup' be the
3272 continuation resume label.
3273 (expand_co_awaits): Remove.
3274 (struct suspend_point_info): Remove fields that kept the returned
3275 await_suspend handle type.
3276 (transform_await_expr): Remove code tracking continuation handles.
3277 (build_actor_fn): Add the continuation handle as an actor-function
3278 scope var. Build the symmetric transfer continuation point. Call
3279 the tree walk for co_await expansion directly, rather than via a
3280 trivial shim function.
3281 (register_await_info): Remove fields tracking continuation handles.
3282 (get_await_suspend_return_type): Remove.
3283 (register_awaits): Remove code tracking continuation handles.
3284 (morph_fn_to_coro): Remove code tracking continuation handles.
3286 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
3288 * coroutines.cc (co_await_expander): If we are expanding the
3289 initial await expression, set a boolean flag to show that we
3290 have now reached the initial await_resume() method call.
3291 (expand_co_awaits): Handle the 'initial await resume called' flag.
3292 (build_actor_fn): Insert the initial await expression into the
3293 start of the user-authored function-body. Handle the 'initial await
3294 resume called' flag.
3295 (morph_fn_to_coro): Initialise the 'initial await resume called'
3296 flag. Modify the unhandled exception catch clause to recognise
3297 exceptions that occur before the initial await_resume() and re-
3300 2020-03-26 Jakub Jelinek <jakub@redhat.com>
3303 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
3304 true for all TEMPLATE_DECLs.
3307 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
3309 2020-03-25 Patrick Palka <ppalka@redhat.com>
3312 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
3313 current condition chain when the if-statement has a non-empty
3316 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
3319 * coroutines.cc (captures_temporary): Fix a missing dereference.
3321 2020-03-24 Marek Polacek <polacek@redhat.com>
3323 PR c++/94190 - wrong no post-decrement operator error in template.
3324 * call.c (convert_like_real): Use convert_from_reference on the result.
3326 2020-03-24 Jason Merrill <jason@redhat.com>
3329 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
3331 (tsubst_nested_requirement): Likewise.
3332 (get_constraint_error_location): Allow missing context.
3333 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
3334 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
3336 2020-03-24 Jason Merrill <jason@redhat.com>
3338 * pt.c (any_template_parm_r): Look into the type of a non-type
3341 2020-03-24 Jason Merrill <jason@redhat.com>
3343 * cp-tree.h (cp_expr): When constructing from an expr and a
3344 location, call protected_set_expr_location.
3346 2020-03-23 Patrick Palka <ppalka@redhat.com>
3349 * except.c (maybe_noexcept_warning): Add TODO.
3350 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
3352 2020-03-23 nathans <nathan@acm.org>
3355 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
3358 2020-03-21 Patrick Palka <ppalka@redhat.com>
3361 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
3362 handle unions without an initializer.
3363 (cxx_eval_component_reference): Emit a different diagnostic when the
3364 constructor element corresponding to a union member is NULL.
3365 (cxx_eval_bare_aggregate): When constructing a union, always set the
3366 active union member before evaluating the initializer. Relax assertion
3367 that verifies the index of the constructor element we're initializing
3368 hasn't been changed.
3369 (cxx_eval_store_expression): Diagnose changing the active union member
3370 while the union is in the process of being initialized. After setting
3371 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
3373 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
3374 CONSTRUCTOR returned by lookup_placeholder.
3376 2020-03-20 Patrick Palka <ppalka@redhat.com>
3378 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
3379 the "[with ]" bits to here from ...
3380 (pp_cxx_atomic_constraint): ... here.
3381 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
3382 * error.c (rebuild_concept_check): Delete.
3383 (print_concept_check_info): Print the dependent form of the constraint and the
3384 preferably substituted parameter mapping alongside it.
3386 2020-03-19 Jason Merrill <jason@redhat.com>
3389 * cp-gimplify.c (simple_empty_class_p): Look through
3390 SIMPLE_TARGET_EXPR_P.
3391 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
3392 [RETURN_EXPR]: Avoid producing 'return *retval;'.
3393 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
3394 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
3397 2020-03-19 Jakub Jelinek <jakub@redhat.com>
3400 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
3401 on outer_automatic_var_p decls.
3402 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
3403 capture proxy decls.
3405 2020-03-18 Nathan Sidwell <nathan@acm.org>
3407 PR c++/94147 - mangling of lambdas assigned to globals
3408 * parser.c (cp_parser_init_declarator): Namespace-scope variables
3409 provide a lambda scope.
3410 * tree.c (no_linkage_check): Lambdas with a variable for extra
3411 scope have a linkage from the variable.
3413 2020-03-18 Jakub Jelinek <jakub@redhat.com>
3415 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
3416 strictly_subsumes): Fix up duplicated word issue in a comment.
3417 * coroutines.cc (build_init_or_final_await, captures_temporary):
3419 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
3420 * pt.c (append_type_to_template_for_access_check): Likewise.
3423 * decl.c (grokfndecl): Restore old diagnostics about deduction
3424 guide declared in different scope if in_namespace is NULL_TREE.
3426 2020-03-17 Jakub Jelinek <jakub@redhat.com>
3429 * parser.c (cp_parser_enum_specifier): Use temp_override for
3430 parser->colon_corrects_to_scope_p, replace goto out with return.
3431 If scoped enum or enum with underlying type is not followed by
3432 { or ;, call cp_parser_commit_to_tentative_parse before calling
3433 cp_parser_error and make sure to return error_mark_node instead of
3434 NULL_TREE. Formatting fixes.
3436 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
3439 * method.c (assignable_expr): Use cp_unevaluated.
3440 (is_xible_helper): Push a non-deferred access check for
3441 the stub objects created by assignable_expr and constructible_expr.
3443 2020-03-17 Jakub Jelinek <jakub@redhat.com>
3445 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
3446 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
3448 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
3449 cp_parser_placeholder_type_specifier,
3450 cp_parser_constraint_requires_parens): Likewise.
3451 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
3453 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
3455 * coroutines.cc (co_await_expander): Fix indentation.
3457 2020-03-14 Jason Merrill <jason@redhat.com>
3460 * pt.c (process_partial_specialization): Error rather than crash on
3461 extra pack expansion.
3463 2020-03-14 Jason Merrill <jason@redhat.com>
3466 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
3467 DECL_ORIGINAL_TYPE of a typedef.
3469 2020-03-14 Jason Merrill <jason@redhat.com>
3472 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
3473 substituting DECL_ARGUMENTS.
3475 2020-03-14 Jakub Jelinek <jakub@redhat.com>
3477 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
3478 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
3481 2020-03-13 Patrick Palka <ppalka@redhat.com>
3484 * call.c (build_over_call): Use a warning_sentinel to disable
3485 warn_deprecated_decl before calling build_addr_func.
3487 2020-03-12 Jakub Jelinek <jakub@redhat.com>
3490 * decl.c (reshape_init_array_1): Don't unshare constructor if there
3491 aren't any trailing zero elts, otherwise only unshare the first
3494 2020-03-11 Jason Merrill <jason@redhat.com>
3497 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
3500 2020-03-11 Marek Polacek <polacek@redhat.com>
3501 Jason Merrill <jason@redhat.com>
3503 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
3504 * constexpr.c (cref_has_const_field): New function.
3505 (modifying_const_object_p): Consider a COMPONENT_REF
3506 const only if any of its fields are const.
3507 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
3508 as readonly after its initialization has been done.
3510 2020-03-10 Marek Polacek <polacek@redhat.com>
3512 PR c++/94124 - wrong conversion error with non-viable overload.
3513 * decl.c (reshape_init_array_1): Unshare a constructor if we
3514 stripped trailing zero-initializers.
3516 2020-03-10 Jason Merrill <jason@redhat.com>
3519 * pt.c (maybe_instantiate_noexcept): Always update clones.
3521 2020-03-10 Jason Merrill <jason@redhat.com>
3524 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
3526 2020-03-10 Jason Merrill <jason@redhat.com>
3532 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
3533 66139: Don't split_nonconstant_init. Remove pre_p parameter.
3535 2020-03-09 Marek Polacek <polacek@redhat.com>
3537 PR c++/92031 - bogus taking address of rvalue error.
3538 PR c++/91465 - ICE with template codes in check_narrowing.
3539 PR c++/93870 - wrong error when converting template non-type arg.
3540 PR c++/94068 - ICE with template codes in check_narrowing.
3541 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
3542 in a template when not ck_identity and we're dealing with a class.
3543 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
3544 in a template if we need a temporary.
3545 * decl.c (compute_array_index_type_loc): Remove
3546 instantiate_non_dependent_expr_sfinae call. Call
3547 fold_non_dependent_expr instead of maybe_constant_value.
3548 (build_explicit_specifier): Don't instantiate or create a sentinel
3549 before converting the expression.
3550 * except.c (build_noexcept_spec): Likewise.
3551 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
3552 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
3553 build_converted_constant_expr returned.
3554 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
3555 of maybe_constant_value.
3557 2020-03-09 Jakub Jelinek <jakub@redhat.com>
3561 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
3563 * constexpr.c (cxx_eval_constant_expression): Do not handle
3564 RROTATE_EXPR and LROTATE_EXPR.
3566 2020-03-09 Marek Polacek <polacek@redhat.com>
3568 PR c++/94050 - ABI issue with alignas on armv7hl.
3569 * class.c (layout_class_type): Don't replace a class's
3570 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
3572 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
3574 * coroutines.cc (build_actor_fn): Factor out code inserting the
3575 default return_void call to...
3576 (morph_fn_to_coro): ...here, also hoist local var declarations.
3578 2020-03-08 Patrick Palka <ppalka@redhat.com>
3581 * call.c (convert_like_real): Check complain before emitting an error
3582 about binding a bit-field to a reference.
3584 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
3585 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
3588 2020-03-06 Nathan Sidwell <nathan@acm.org>
3591 * mangle.c (find_substitution): Don't call same_type_p on template
3592 args that cannot match.
3594 2020-03-04 Martin Sebor <msebor@redhat.com>
3597 * tree.c (type_initializer_zero_p): Fail for structs initialized
3600 2020-03-04 Jason Merrill <jason@redhat.com>
3603 * init.c (perform_member_init): Don't do aggregate initialization of
3605 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
3606 initialization of empty field.
3608 2020-03-04 Martin Liska <mliska@suse.cz>
3610 * method.c: Wrap array in ctor with braces in order
3611 to silent clang warnings.
3613 2020-03-03 Jason Merrill <jason@redhat.com>
3614 Marek Polacek <polacek@redhat.com>
3616 PR c++/90505 - mismatch in template argument deduction.
3617 * pt.c (tsubst): Don't reduce the template level of template
3618 parameters when tf_partial.
3620 2020-03-03 Jakub Jelinek <jakub@redhat.com>
3623 * constexpr.c (cxx_eval_constant_expression)
3624 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
3625 *non_constant_p is true.
3627 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
3629 * coroutines.cc (captures_temporary): Strip component_ref
3632 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
3634 * coroutines.cc (finish_co_await_expr): Build co_await_expr
3635 with unknown_type_node.
3636 (finish_co_yield_expr): Ditto.
3637 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
3638 with unknown type as dependent.
3640 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
3642 * coroutines.cc (struct local_var_info): Adjust to remove the
3643 reference to the captured var, and just to note that this is a
3644 lambda capture proxy.
3645 (transform_local_var_uses): Handle lambda captures specially.
3646 (struct param_frame_data): Add a visited set.
3647 (register_param_uses): Also check for param uses in lambda
3649 (struct local_vars_frame_data): Remove captures list.
3650 (register_local_var_uses): Handle lambda capture proxies by
3651 noting and bypassing them.
3652 (morph_fn_to_coro): Update to remove lifetime extension of
3653 lambda capture-by-copy vars.
3655 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
3657 * coroutines.cc (build_co_await): Do not build frame
3658 awaitable proxy vars when the co_await expression is
3659 a function parameter or local var.
3660 (co_await_expander): Do not initialise a frame var with
3662 (transform_await_expr): Only substitute the awaitable
3663 frame var if it's needed.
3664 (register_awaits): Do not make frame copies for param
3665 or local vars that are awaitables.
3667 2020-02-28 Jason Merrill <jason@redhat.com>
3669 Implement P2092R0, Disambiguating Nested-Requirements
3670 * parser.c (cp_parser_requirement_parameter_list): Pass
3671 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
3673 * call.c (build_user_type_conversion_1): Don't look at the second
3674 conversion of a non-viable candidate.
3676 2020-02-28 Jakub Jelinek <jakub@redhat.com>
3678 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
3679 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
3680 functions in unevaluated contexts.
3682 2020-02-27 Nathan Sidwell <nathan@acm.org>
3685 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
3687 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
3688 * typeck.c (comptypes): Assert we don't get any argument packs.
3690 * class.c (adjust_clone_args): Correct arg-checking assert.
3691 * typeck.c (comptypes): Assert not nulls.
3693 2020-02-26 Marek Polacek <polacek@redhat.com>
3695 PR c++/93789 - ICE with invalid array bounds.
3696 * decl.c (compute_array_index_type_loc): Don't use the folded
3697 size when folding cleared TREE_CONSTANT.
3699 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
3701 * class.c (classtype_has_non_deleted_copy_ctor): New.
3702 * coroutines.cc (struct param_info): Keep track of params
3703 that are references, and cache the original type and whether
3704 the DTOR is trivial.
3705 (build_actor_fn): Handle param copies always, and adjust the
3706 handling for references.
3707 (register_param_uses): Only handle uses here.
3708 (classtype_has_non_deleted_copy_ctor): New.
3709 (morph_fn_to_coro): Adjust param copy handling to match n4849
3710 by reordering ahead of the promise CTOR and always making a
3711 frame copy, even if the param is unused in the coroutine body.
3712 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
3714 2020-02-26 Patrick Palka <ppalka@redhat.com>
3716 * constraint.cc (finish_constraint_binary_op): Set expr's location range
3717 to the range of its operands.
3718 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
3719 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
3720 instead of the corresponding template arguments ARGS and adjust body
3722 (diagnose_requires_expr): Likewise.
3723 (diagnose_atomic_constraint): Likewise. When printing an atomic
3724 constraint expression, print the instantiated parameter mapping
3726 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
3727 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
3728 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
3730 2020-02-26 Marek Polacek <polacek@redhat.com>
3732 PR c++/93676 - value-init crash in template.
3733 * init.c (build_new_1): Don't call build_vec_init in a template.
3735 2020-02-26 Marek Polacek <polacek@redhat.com>
3737 PR c++/93862 - ICE with static_cast when converting from int[].
3738 * call.c (reference_compatible_p): No longer static.
3739 * cp-tree.h (reference_compatible_p): Declare.
3740 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
3741 of reference_related_p.
3743 2020-02-26 Marek Polacek <polacek@redhat.com>
3745 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
3746 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
3749 2020-02-24 Martin Sebor <msebor@redhat.com>
3752 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
3753 in shared C/C++ code in headers.
3754 Remove a duplicate hunk of code.
3756 2020-02-24 Marek Polacek <polacek@redhat.com>
3758 PR c++/93869 - ICE with -Wmismatched-tags.
3759 * parser.c (cp_parser_check_class_key): Check class_key earlier.
3761 2020-02-24 Marek Polacek <polacek@redhat.com>
3763 PR c++/93712 - ICE with ill-formed array list-initialization.
3764 * call.c (next_conversion): Return NULL for ck_aggr.
3765 (build_aggr_conv): Set u.expr instead of u.next.
3766 (build_array_conv): Likewise.
3767 (build_complex_conv): Likewise.
3768 (conv_get_original_expr): Handle ck_aggr.
3770 2020-02-24 Jakub Jelinek <jakub@redhat.com>
3772 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
3773 * call.c (build_over_call): Don't evaluate immediate functions in
3774 unevaluated operands.
3776 2020-02-24 Jason Merrill <jason@redhat.com>
3778 P0780R2: Resolve lambda init-capture pack grammar.
3779 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
3782 2020-02-22 Marek Polacek <polacek@redhat.com>
3785 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
3787 2020-02-21 Martin Sebor <msebor@redhat.com>
3789 PR gcov-profile/93753
3790 * class.c (check_flexarrays): Tighten up a test for potential members
3791 of anonymous structs or unions.
3793 2020-02-20 Martin Sebor <msebor@redhat.com>
3796 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
3798 2020-02-20 Martin Liska <mliska@suse.cz>
3800 PR translation/93841
3801 * config/or1k/or1k.opt: Remove superfluous word.
3802 * doc/invoke.texi: Likewise.
3804 2020-02-20 Martin Liska <mliska@suse.cz>
3806 PR translation/93838
3807 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
3809 2020-02-19 Marek Polacek <polacek@redhat.com>
3811 PR c++/93169 - wrong-code with a non-constexpr constructor.
3812 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
3813 on constant CONSTRUCTORs.
3815 2020-02-15 Marek Polacek <polacek@redhat.com>
3817 PR c++/93710 - poor diagnostic for array initializer.
3818 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
3821 2020-02-15 Jason Merrill <jason@redhat.com>
3824 * pt.c (any_template_parm_r): Look into lambda body.
3827 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
3829 2020-02-14 Jakub Jelinek <jakub@redhat.com>
3832 * class.c (enum_min_precision): Change prec type from int to int &.
3835 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
3836 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
3837 (fallback_dfloat32_type, fallback_dfloat64_type,
3838 fallback_dfloat128_type): Define.
3839 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
3841 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
3842 is disabled for compatibility.
3844 2020-02-13 Jason Merrill <jason@redhat.com>
3847 * name-lookup.c (matching_fn_p): A function does not match a
3852 * tree.c (decl_linkage): Always lk_none for locals.
3854 2020-02-12 Jason Merrill <jason@redhat.com>
3858 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
3859 * pt.c (find_parameter_packs_r): Not here.
3861 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
3863 * coroutines.cc (build_actor_fn): Implement deallocation function
3864 selection per n4849, dcl.fct.def.coroutine bullet 12.
3865 (morph_fn_to_coro): Implement allocation function selection per
3866 n4849, dcl.fct.def.coroutine bullets 9 and 10.
3868 2020-02-12 Marek Polacek <polacek@redhat.com>
3870 PR c++/93684 - ICE-on-invalid with broken attribute.
3871 * parser.c (cp_parser_std_attribute): Peek a token first before
3874 2020-02-11 Jason Merrill <jason@redhat.com>
3877 * class.c (add_implicitly_declared_members): Use do_friend.
3878 * method.c (implicitly_declare_fn): Fix friend handling.
3879 (decl_remember_implicit_trigger_p): New.
3880 (synthesize_method): Use it.
3881 * decl2.c (mark_used): Use it.
3883 2020-02-11 Jason Merrill <jason@redhat.com>
3887 * constexpr.c (maybe_constant_value): Correct earlier change.
3888 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
3889 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
3891 2020-02-12 Patrick Palka <ppalka@redhat.com>
3895 * type-utils.h (find_type_usage): Refactor to take a tree * and to
3896 return a tree *, and update documentation accordingly.
3897 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
3898 decltype(auto) node.
3899 (make_constrained_decltype_auto): No need to explicitly set
3900 AUTO_IS_DECLTYPE anymore.
3901 (splice_late_return_type): Use find_type_usage to find and
3902 replace a possibly nested auto node instead of using is_auto.
3903 Check test for is_auto into an assert when deciding whether
3904 to late_return_type.
3905 (type_uses_auto): Adjust the call to find_type_usage.
3906 * parser.c (cp_parser_decltype): No need to explicitly set
3907 AUTO_IS_DECLTYPE anymore.
3909 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
3910 (dump_simple_decl): Handle standard concept definitions as well as
3911 variable concept definitions.
3913 2020-02-10 Jakub Jelinek <jakub@redhat.com>
3916 * error.c (dump_decl_name): Fix up last argument to strncmp.
3918 2020-02-10 Jason Merrill <jason@redhat.com>
3921 * tree.c (array_of_unknown_bound_p): New.
3922 * init.c (perform_member_init): Do nothing for flexible arrays.
3924 2020-02-09 Jakub Jelinek <jakub@redhat.com>
3927 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
3928 ARRAY_TYPE, use the element type. Punt if objtype after that is not
3931 2020-02-08 Jason Merrill <jason@redhat.com>
3934 * expr.c (fold_for_warn): Call maybe_constant_value.
3935 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
3936 (maybe_constant_value): Add uid_sensitive parm.
3937 (get_fundef_copy): Don't copy if it's true.
3938 (cxx_eval_call_expression): Don't instantiate if it's true.
3939 (cxx_eval_outermost_constant_expr): Likewise.
3942 * constexpr.c (maybe_constant_value): Don't unshare if the cached
3943 value is the same as the argument.
3945 * typeck.c (maybe_warn_about_returning_address_of_local): Add
3948 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
3951 2020-02-08 Jakub Jelinek <jakub@redhat.com>
3954 * constexpr.c (find_array_ctor_elt): If last element has no index,
3955 for flag_checking verify all elts have no index. If i is within the
3956 elts, return it directly, if it is right after the last elt, append
3957 if NULL index, otherwise force indexes on all elts.
3958 (cxx_eval_store_expression): Allow cep->index to be NULL.
3960 2020-02-07 Marek Polacek <polacek@redhat.com>
3962 PR c++/92947 - Paren init of aggregates in unevaluated context.
3963 * call.c (build_new_method_call_1): Don't check
3964 cp_unevaluated_operand. Check the return value of digest_init.
3966 2020-02-06 Jason Merrill <jason@redhat.com>
3969 * tree.c (cp_walk_subtrees): Walk into type template arguments.
3970 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
3971 instead of TYPE_ALIAS_P.
3972 * pt.c (push_template_decl_real): Likewise.
3973 (find_parameter_packs_r): Likewise. Remove dead code.
3974 * error.c (find_typenames_r): Remove dead code.
3976 2020-02-06 Jason Merrill <jason@redhat.com>
3979 * parser.c (cp_parser_constraint_primary_expression): Do the main
3980 parse non-tentatively.
3982 2020-02-06 Marek Polacek <polacek@redhat.com>
3984 PR c++/93597 - ICE with lambda in operator function.
3985 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
3987 2020-02-05 Jason Merrill <jason@redhat.com>
3990 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
3991 handling of TREE_CHAIN for empty pack.
3993 2020-02-05 Jakub Jelinek <jakub@redhat.com>
3996 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
3997 prior to passing it to c_build_vec_convert.
3999 2020-02-05 Marek Polacek <polacek@redhat.com>
4001 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
4002 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
4005 2020-02-05 Jason Merrill <jason@redhat.com>
4008 * decl.c (grokdeclarator): Reject field of current class type even
4011 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
4013 * coroutines.cc (maybe_promote_captured_temps): Increase the index
4014 number for temporary variables' name.
4016 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
4018 * coroutines.cc (build_co_await): Call convert_from_reference
4019 to wrap co_await_expr with indirect_ref which avoid
4020 reference/non-reference type confusion.
4022 (co_await_expander): Sink to call_expr if await_resume
4023 is wrapped by indirect_ref.
4025 2020-02-04 Jason Merrill <jason@redhat.com>
4028 * constraint.cc (satisfy_declaration_constraints): Check return
4029 value of push_tinst_level.
4032 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
4033 elements instead of value-initializing them.
4036 * init.c (perform_member_init): Simplify.
4037 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
4039 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
4041 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
4043 * coroutines.cc (find_promise_type): Delete unused forward
4045 (struct coroutine_info): Add a bool for no promise type error.
4046 (coro_promise_type_found_p): Only emit the error for a missing
4047 promise once in each affected coroutine.
4049 2020-02-03 Jason Merrill <jason@redhat.com>
4052 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
4053 defer loading the value of a reference.
4055 2020-02-03 Jason Merrill <jason@redhat.com>
4058 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
4060 [COMPONENT_REF]: A member function reference doesn't use the object
4063 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
4066 * coroutines.cc (struct coroutine_info): Add a bool flag to note
4067 that we emitted an error for a bad function return type.
4068 (get_coroutine_info): Tolerate an unset info table in case of
4070 (find_coro_traits_template_decl): In case of error or if we didn't
4071 find a type template, note we emitted the error and suppress
4073 (find_coro_handle_template_decl): Likewise.
4074 (instantiate_coro_traits): Only check for error_mark_node in the
4075 return from lookup_qualified_name.
4076 (coro_promise_type_found_p): Reorder initialization so that we check
4077 for the traits and their usability before allocation of the info
4078 table. Check for a suitable return type and emit a diagnostic for
4079 here instead of relying on the lookup machinery. This allows the
4080 error to have a better location, and means we can suppress multiple
4082 (coro_function_valid_p): Re-check for a valid promise (and thus the
4083 traits) before proceeding. Tolerate missing info as a fatal error.
4085 2020-02-03 Jason Merrill <jason@redhat.com>
4088 * cp-gimplify.c (predeclare_vla): New.
4089 (cp_genericize_r) [NOP_EXPR]: Call it.
4091 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
4093 * coroutines.cc (transform_await_wrapper): Set actor funcion as
4094 new context of label_decl.
4095 (build_actor_fn): Fill new field of await_xform_data.
4097 2020-02-02 Marek Polacek <polacek@redhat.com>
4099 PR c++/93530 - ICE on invalid alignas in a template.
4100 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
4103 2020-01-31 Jason Merrill <jason@redhat.com>
4106 * semantics.c (process_outer_var_ref): Capture VLAs even in
4107 unevaluated context.
4110 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
4111 non-aggregate elements.
4112 (reshape_init_array): Add first_initializer_p parm.
4113 (reshape_init_r): Change first_initializer_p from bool to tree.
4114 (reshape_init): Pass init to it.
4117 * parser.c (cp_parser_initializer_list): Suppress location wrappers
4120 2020-01-29 Jason Merrill <jason@redhat.com>
4123 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
4124 the expression was dependent before substitution.
4126 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
4128 * coroutines.cc (act_des_fn): New.
4129 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
4130 Access promise via actor function's frame pointer argument.
4131 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
4133 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
4135 * coroutines.cc (co_await_expander): Handle type conversion case.
4137 2020-01-29 Jason Merrill <jason@redhat.com>
4142 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
4143 a trailing return type.
4144 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
4147 2020-01-29 Marek Polacek <polacek@redhat.com>
4149 PR c++/91754 - Fix template arguments comparison with class NTTP.
4150 * pt.c (class_nttp_const_wrapper_p): New.
4151 (template_args_equal): See through class_nttp_const_wrapper_p
4154 2020-01-29 Marek Polacek <polacek@redhat.com>
4156 PR c++/92948 - Fix class NTTP with template arguments.
4157 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
4158 converting a value-dependent expression to a class type.
4159 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
4160 as the result of the tsubst_copy call.
4162 2020-01-29 Jakub Jelinek <jakub@redhat.com>
4165 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
4166 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
4168 2020-01-28 Jason Merrill <jason@redhat.com>
4171 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
4175 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
4178 * call.c (build_user_type_conversion_1): Allow a template conversion
4179 returning an rvalue reference to bind directly to an lvalue.
4182 * decl.c (grokdeclarator): Propagate eh spec from typedef.
4184 2020-01-28 Martin Liska <mliska@suse.cz>
4187 * pt.c (redeclare_class_template): Group couple of
4188 errors and inform messages with auto_diagnostic_group.
4190 2020-01-28 Martin Liska <mliska@suse.cz>
4193 * pt.c (redeclare_class_template): Use inform
4194 for the second location.
4196 2020-01-27 Jason Merrill <jason@redhat.com>
4199 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
4201 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
4204 * coroutines.cc (morph_fn_to_coro): Check the ramp return
4205 value when it is constructed from the 'get return object'.
4207 2020-01-27 Nathan Sidwell <nathan@acm.org>
4210 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
4212 2020-01-26 Jason Merrill <jason@redhat.com>
4215 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
4216 temporarily enable -Wsystem-headers. Change second warning to
4220 * semantics.c (finish_call_expr): Don't call
4221 instantiate_non_dependent_expr before warn_for_memset.
4223 2020-01-25 Marek Polacek <polacek@redhat.com>
4225 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
4226 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
4227 dynamic_cast diagnostic.
4229 2020-01-24 Jason Merrill <jason@redhat.com>
4231 PR c++/93400 - ICE with constrained friend.
4232 * constraint.cc (maybe_substitute_reqs_for): New.
4233 * decl.c (function_requirements_equivalent_p): Call it.
4234 * pt.c (tsubst_friend_function): Only substitute
4235 TEMPLATE_PARMS_CONSTRAINTS.
4236 (tsubst_template_parms): Copy constraints.
4238 2020-01-24 Jason Merrill <jason@redhat.com>
4240 PR c++/93279 - ICE with lambda in member operator.
4241 * name-lookup.c (maybe_save_operator_binding): Don't remember
4242 class-scope bindings.
4244 2020-01-24 Jason Merrill <jason@redhat.com>
4246 PR c++/93377 - ICE with member alias in constraint.
4247 * pt.c (any_template_parm_r): Look at template arguments for all
4248 aliases, not only alias templates.
4250 2020-01-24 Marek Polacek <polacek@redhat.com>
4252 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
4253 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
4255 2020-01-24 Jason Merrill <jason@redhat.com>
4257 PR c++/92852 - ICE with generic lambda and reference var.
4258 * constexpr.c (maybe_constant_value): Likewise.
4260 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
4263 * parser.c (cp_parser_nested_name_specifier_opt): Properly
4264 diagnose concept-ids.
4266 2020-01-23 Jason Merrill <jason@redhat.com>
4268 PR c++/93331 - ICE with __builtin_strchr.
4269 * constexpr.c (cxx_eval_builtin_function_call): Use the original
4270 argument if we didn't manage to extract a STRING_CST.
4272 PR c++/93345 - ICE with defaulted dtor and template.
4274 * decl.c (cxx_maybe_build_cleanup): Don't try to set
4275 throwing_cleanup in a template.
4277 2020-01-22 Marek Polacek <polacek@redhat.com>
4279 PR c++/92907 - noexcept does not consider "const" in member functions.
4280 * g++.dg/cpp0x/noexcept56.C: New test.
4282 2020-01-22 Marek Polacek <polacek@redhat.com>
4284 PR c++/93324 - ICE with -Wall on constexpr if.
4285 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
4287 2020-01-22 Patrick Palka <ppalka@redhat.com>
4289 * constraint.cc (get_mapped_args): Avoid using auto_vec
4290 as a vector element. Release the vectors inside the lists
4292 * parser.c (cp_literal_operator_id): Free the buffer.
4294 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
4296 * coroutines.cc (finish_co_await_expr): Add error check on return
4297 value of build_co_await.
4298 (finish_co_yield_expr,): Ditto.
4300 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
4302 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
4303 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
4304 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
4306 2020-01-21 Jason Merrill <jason@redhat.com>
4308 PR c++/60855 - ICE with sizeof VLA capture.
4309 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
4311 PR c++/90732 - ICE with VLA capture and generic lambda.
4312 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
4314 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
4315 Bin Cheng <bin.cheng@linux.alibaba.com>
4317 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
4318 from complete_type_or_else.
4319 (register_param_uses): Likewise.
4320 (build_co_await): Do not try to use complete_type_or_else for void
4321 types, otherwise for incomplete types, check for NULL return from
4322 complete_type_or_else.
4324 2020-01-21 Jason Merrill <jason@redhat.com>
4326 PR c++/91476 - anon-namespace reference temp clash between TUs.
4327 * decl2.c (copy_linkage): Factor out of get_guard.
4328 * call.c (make_temporary_var_for_ref_to_temp): Use it.
4329 * decl.c (cp_finish_decomp): Use it.
4330 (cp_finish_decl): determine_visibility sooner.
4332 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
4334 * coroutines.cc (finish_co_await_expr): Set return value flag.
4335 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
4337 2020-01-19 Jason Merrill <jason@redhat.com>
4339 PR c++/33799 - destroy return value, take 2.
4340 * cp-tree.h (current_retval_sentinel): New macro.
4341 (struct language_function): Add throwing_cleanup bitfield.
4342 * decl.c (cxx_maybe_build_cleanup): Set it.
4343 * except.c (maybe_set_retval_sentinel)
4344 (maybe_splice_retval_cleanup): New functions.
4345 * parser.c (cp_parser_compound_statement): Call
4346 maybe_splice_retval_cleanup.
4347 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
4349 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
4351 2020-01-18 Jakub Jelinek <jakub@redhat.com>
4353 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
4354 but non-NO_DOLLAR_IN_LABEL case build.
4356 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
4358 * Make-lang.in: Add coroutines.o.
4359 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
4360 (DECL_COROUTINE_P): New.
4361 * lex.c (init_reswords): Enable keywords when the coroutine flag
4363 * operators.def (co_await): New operator.
4364 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
4365 (op_error): Likewise.
4366 (build_new_op_1): Likewise.
4367 (build_new_function_call): Validate coroutine builtin arguments.
4368 * constexpr.c (potential_constant_expression_1): Handle
4369 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
4370 * coroutines.cc: New file.
4371 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
4372 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
4373 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
4374 * cp-tree.h (coro_validate_builtin_call): New.
4375 * decl.c (emit_coro_helper): New.
4376 (finish_function): Handle the case when a function is found to
4377 be a coroutine, perform the outlining and emit the outlined
4378 functions. Set a bit to signal that this is a coroutine component.
4379 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
4380 (cp_parser_unary_expression): Handle co_await.
4381 (cp_parser_assignment_expression): Handle co_yield.
4382 (cp_parser_statement): Handle RID_CO_RETURN.
4383 (cp_parser_jump_statement): Handle co_return.
4384 (cp_parser_operator): Handle co_await operator.
4385 (cp_parser_yield_expression): New.
4386 (cp_parser_required_error): Handle RT_CO_YIELD.
4387 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
4388 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
4390 * tree.c (cp_walk_subtrees): Likewise.
4392 2020-01-17 Jason Merrill <jason@redhat.com>
4394 PR c++/92531 - ICE with noexcept(lambda).
4395 * pt.c (uses_template_parms): Don't try to enumerate all the
4398 2020-01-17 Jakub Jelinek <jakub@redhat.com>
4401 * parser.c (cp_parser_template_name): Look up deprecated attribute
4402 in DECL_TEMPLATE_RESULT or its type's attributes.
4404 2020-01-16 Jason Merrill <jason@redhat.com>
4406 PR c++/93286 - ICE with __is_constructible and variadic template.
4407 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
4408 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
4410 PR c++/93280 - ICE with aggregate assignment and DMI.
4411 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
4412 * typeck2.c (digest_nsdmi_init): Not here.
4414 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4417 * cp-tree.h (is_constrained_auto): New.
4418 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
4419 handle concept-check expressions; take a cp_decl_specifier_seq*
4421 (cp_parser_condition): Update call.
4422 (cp_parser_simple_declaration): Likewise.
4423 (cp_parser_placeholder_type_specifier): Correctly handle
4424 concept-check expressions.
4426 2020-01-15 Jason Merrill <jason@redhat.com>
4429 PR c++/33799 - destroy return value if local cleanup throws.
4430 * cp-tree.h (current_retval_sentinel): New macro.
4431 * decl.c (start_preparsed_function): Set up cleanup for retval.
4432 * typeck.c (check_return_expr): Set current_retval_sentinel.
4434 PR c++/93257 - consteval void function.
4435 * constexpr.c (verify_constant): Allow void_node.
4437 PR c++/92871 - bad code with xvalue and GNU ?: extension.
4438 * call.c (prevent_lifetime_extension): New.
4439 (build_conditional_expr_1): Use it.
4441 2020-01-14 Nathan Sidwell <nathan@acm.org>
4444 * pt.c (retrieve_specialization): Use get_template_info, not open
4448 * pt.c (retrieve_specialization): Get the TI from the decl or the
4449 classtype as appropriate.
4451 2020-01-14 David Malcolm <dmalcolm@redhat.com>
4453 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
4454 New static constant.
4455 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
4456 (struct named_label_hash::empty_zero_p): Likewise.
4457 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
4459 2020-01-14 Jason Merrill <jason@redhat.com>
4461 PR c++/92590 - wrong handling of inherited default ctor.
4462 * class.c (add_method): A constrained inherited ctor doesn't hide an
4463 implicit derived ctor.
4465 PR c++/92552 - ICE with inherited constrained default ctor.
4466 * pt.c (instantiate_class_template_1): Copy
4467 TYPE_HAS_USER_CONSTRUCTOR.
4468 PR c++/91930 - ICE with constrained inherited default ctor.
4469 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
4470 for inherited constructor.
4471 PR c++/92594 - ICE with inherited trivial default ctor.
4472 * method.c (trivial_fn_p): Treat an inherited default constructor
4473 like a normal default constructor.
4475 PR c++/92594 - ICE with inherited trivial default ctor.
4476 * method.c (trivial_fn_p): Treat an inherited default constructor
4477 like a normal default constructor.
4479 PR c++/92009 - ICE with punning of typeid.
4480 * rtti.c (get_tinfo_desc): Call xref_basetypes.
4481 * constexpr.c (cxx_fold_indirect_ref): Don't strip
4484 2020-01-13 Jason Merrill <jason@redhat.com>
4486 PR c++/92746 - ICE with noexcept of function concept check.
4487 * except.c (check_noexcept_r): Handle concept-check.
4489 PR c++/92582 - ICE with member template as requirement.
4490 * pt.c (struct find_template_parameter_info): Add ctx_parms.
4491 (any_template_parm_r): Handle TEMPLATE_DECL.
4492 (find_template_parameters): Take parms instead of their depth.
4493 * constraint.cc (build_parameter_mapping): Pass them.
4495 PR c++/33799 - destroy return value if local cleanup throws.
4496 * cp-tree.h (current_retval_sentinel): New macro.
4497 * decl.c (start_preparsed_function): Set up cleanup for retval.
4498 * typeck.c (check_return_expr): Set current_retval_sentinel.
4500 PR c++/93238 - short right-shift with enum.
4501 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
4503 2020-01-10 Jason Merrill <jason@redhat.com>
4505 * typeck.c (cp_build_binary_op): Restore short_shift code.
4507 PR c++/93143 - incorrect tree sharing with constexpr.
4508 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
4509 CONSTRUCTORs are already unshared.
4511 PR c++/93173 - incorrect tree sharing.
4513 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
4514 copy_if_shared after cp_genericize_tree.
4515 * typeck2.c (split_nonconstant_init): Don't unshare here.
4517 2020-01-08 Jason Merrill <jason@redhat.com>
4519 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
4520 TARGET_EXPR_DIRECT_INIT_P.
4521 * constexpr.c (cxx_eval_constant_expression): Likewise.
4523 2020-01-08 Jason Merrill <jason@redhat.com>
4525 PR c++/91369 - constexpr destructor and member initializer.
4526 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
4527 when not preevaluating.
4529 2020-01-08 Jason Merrill <jason@redhat.com>
4531 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
4534 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
4536 * init.c (build_new): Add location_t parameter and use it throughout.
4537 (build_raw_new_expr): Likewise.
4538 * parser.c (cp_parser_new_expression): Pass the combined_loc.
4539 * pt.c (tsubst_copy_and_build): Adjust call.
4540 * cp-tree.h: Update declarations.
4542 2020-01-07 Jason Merrill <jason@redhat.com>
4544 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
4545 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
4546 explicit class visibility for a template.
4548 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
4550 * mangle.c (mangle_type_attribute_p): New function, split out from...
4551 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
4552 that contain a space.
4554 2020-01-07 Jakub Jelinek <jakub@redhat.com>
4557 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
4558 member, initialize it to zero in ctor.
4559 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
4560 a heap object. Don't cache calls to functions which allocate some
4561 heap objects and don't deallocate them or deallocate some heap
4562 objects they didn't allocate.
4564 2020-01-06 Jason Merrill <jason@redhat.com>
4566 PR c++/92552 - ICE with inherited constrained default ctor.
4567 * pt.c (instantiate_class_template_1): Copy
4568 TYPE_HAS_USER_CONSTRUCTOR.
4569 * class.c (one_inherited_ctor): Don't set it here.
4571 2020-01-06 Andrew Sutton <asutton@lock3software.com>
4573 PR c++/92739 - parsing requires clause with attributes.
4574 * parser.c (cp_parser_constraint_requires_parens): Exclude
4575 attributes as postfix expressions.
4577 2020-01-05 Jakub Jelinek <jakub@redhat.com>
4580 * parser.c (cp_parser_check_class_key): Disable access checks for the
4582 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
4583 !warn_redundant_tags.
4585 2010-01-05 Jakub Jelinek <jakub@redhat.com>
4588 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
4589 TARGET_EXPR if it has been gimplified already.
4591 2020-01-03 Jason Merrill <jason@redhat.com>
4593 PR c++/93033 - incorrect tree node sharing with array init.
4594 * typeck2.c (split_nonconstant_init): Unshare non-decl.
4595 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
4597 2020-01-02 Jason Merrill <jason@redhat.com>
4599 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
4602 2020-01-02 Jakub Jelinek <jakub@redhat.com>
4605 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
4606 has not been found, rather than error_mark_node.
4608 2020-01-01 Jakub Jelinek <jakub@redhat.com>
4610 Update copyright years.
4612 Copyright (C) 2020 Free Software Foundation, Inc.
4614 Copying and distribution of this file, with or without modification,
4615 are permitted in any medium without royalty provided the copyright
4616 notice and this notice are preserved.