472fcbe7e26151aa52ca0aef87b388785889e4ee
[gcc.git] / gcc / cp / ChangeLog
1 2020-10-02 Marek Polacek <polacek@redhat.com>
2
3 PR c++/97014
4 * cxx-pretty-print.c (pp_cxx_template_argument_list): If the
5 argument is template_parm_object_p, print its DECL_INITIAL.
6
7 2020-10-02 Nathan Sidwell <nathan@acm.org>
8
9 * cp-tree.h (lang_decl_base): anticipated_p is not used for
10 anticipatedness.
11 (DECL_ANTICIPATED): Delete.
12 * decl.c (duplicate_decls): Delete DECL_ANTICIPATED_management,
13 use was_hidden.
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.
25
26 2020-10-02 Nathan Sidwell <nathan@acm.org>
27
28 * name-lookup.c (consider_decl): New, broken out of ...
29 (consider_binding_level): ... here. Iterate the hash table for
30 namespace bindings.
31
32 2020-10-02 Nathan Sidwell <nathan@acm.org>
33
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
40 ...
41 (ctor_omit_inherited_parms): ... here, call it with
42 DECL_CLONED_FUNCTION.
43
44 2020-10-02 Nathan Sidwell <nathan@acm.org>
45
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.
49
50 2020-10-02 Jason Merril <jason@redhat.com>
51
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.
55 (build_delete):
56
57 2020-10-02 Jason Merril <jason@redhat.com>
58
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.
65
66 2020-10-01 Nathan Sidwell <nathan@acm.org>
67
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.
72
73 2020-10-01 Nathan Sidwell <nathan@acm.org>
74
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
79 pushing.
80 * semantics.c (finish_compound_literal): Likewise.
81
82 2020-10-01 Nathan Sidwell <nathan@acm.org>
83
84 * decl.c (lookup_and_check_tag): Refactor.
85
86 2020-10-01 Jakub Jelinek <jakub@redhat.com>
87
88 PR c++/96994
89 * call.c (build_over_call): If obj_arg is non-NULL, return INIT_EXPR
90 setting obj_arg to call.
91
92 2020-10-01 Jakub Jelinek <jakub@redhat.com>
93
94 PR c++/97195
95 * constexpr.c (cxx_eval_call_expression): Don't VERIFY_CONSTANT the
96 second argument.
97
98 2020-10-01 Marek Polacek <polacek@redhat.com>
99
100 PR c++/90210
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.
104
105 2020-09-30 Nathan Sidwell <nathan@acm.org>
106
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
110 decl.
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
116 explicitly.
117
118 2020-09-29 Marek Polacek <polacek@redhat.com>
119
120 PR c++/94695
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.
125
126 2020-09-29 Nathan Sidwell <nathan@acm.org>
127
128 * cp-tree.h (ovl_insert): Change final parm to hidden-or-using
129 indicator.
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,
133 adjust.
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
142 ignoring.
143 (lookup_elaborated_type_1): Use new hidden markers. Reveal the
144 decl here.
145
146 2020-09-29 Nathan Sidwell <nathan@acm.org>
147
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
160 pushing.
161
162 2020-09-29 Nathan Sidwell <nathan@acm.org>
163
164 * name-lookup.c (update_binding): We never meet two implicit
165 typedefs.
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.
169
170 2020-09-25 Nathan Sidwell <nathan@acm.org>
171
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'
175 with 'hiding'.
176 (pushdecl): Likewise.
177 (pushdecl_top_level): Drop is_friend parm.
178 * decl.c (check_no_redeclaration_friend_default_args): Rename parm
179 olddelc_hidden_p.
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
185 duplicate_decls.
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
190 decl's hiddennes.
191 (pushdecl): Replace 'is_friend' with 'hiding'.
192 (set_identifier_type_value_with_scope): Adjust update_binding
193 call.
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
200 args.
201 (push_template_decl): Commont pushdecl_namespace_level.
202 (tsubst_friend_function, tsubst_friend_class): Likewise.
203
204 2020-09-25 Nathan Sidwell <nathan@acm.org>
205
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.
220 (pushtag): Likewise.
221 * parser.c (cp_parser_elaborated_type_specifier): Adjust.
222 (cp_parser_class_head): Likewise.
223
224 2020-09-25 Nathan Sidwell <nathan@acm.org>
225
226 * cp-tree.h (DECL_BUILTIN_P): New.
227 * decl.c (duplicate_decls): Use it. Do not treat omp-udr as a
228 builtin.
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.
235
236 2020-09-24 Nathan Sidwell <nathan@acm.org>
237
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
241 ...
242 (push_template_decl): ... here. Delete original decl.
243 * name-lookup.h (pushdecl_namespace_level): Default is_friend to
244 false.
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
250 push_template_decl.
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
268 pushtag.
269
270 2020-09-24 Nathan Sidwell <nathan@acm.org>
271
272 PR c++/97186
273 * pt.c (maybe_instantiate_noexcept): Local externs are never
274 member fns.
275
276 2020-09-23 Nathan Sidwell <nathan@acm.org>
277
278 * name-lookup.h (typedef cxx_binding): Delete tdef.
279 (typedef cp_binding_level): Likewise.
280 (struct cxx_binding): Flags are bools.
281
282 2020-09-23 Nathan Sidwell <nathan@acm.org>
283
284 PR c++/97171
285 * pt.c (tsubst_copy) [FUNCTION_DECL,VAR_DECL]: Retrieve local
286 specialization for DECL_LOCAL_P decls.
287
288 2020-09-22 Patrick Palka <ppalka@redhat.com>
289
290 PR c++/95310
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.
294
295 2020-09-22 Nathan Sidwell <nathan@acm.org>
296
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
301 namespace.
302
303 2020-09-22 Jakub Jelinek <jakub@redhat.com>
304
305 PR c++/97145
306 * constexpr.c (cxx_eval_builtin_function_call): Return void_node for
307 calls to __sanitize_ptr_{sub,cmp} builtins.
308
309 2020-09-22 Nathan Sidwell <nathan@acm.org>
310
311 * pt.c (instantiate_class_template_1): Do not repush and unhide
312 injected friend.
313
314 2020-09-21 Marek Polacek <polacek@redhat.com>
315
316 PR c++/90583
317 DR 1722
318 * lambda.c (maybe_add_lambda_conv_op): Mark the conversion function
319 as noexcept.
320
321 2020-09-21 Marek Polacek <polacek@redhat.com>
322
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.
326
327 2020-09-21 Nathan Sidwell <nathan@acm.org>
328
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.
332
333 2020-09-21 Marek Polacek <polacek@redhat.com>
334
335 PR c++/97099
336 * decl.c (redeclaration_error_message): Detect a redeclaration of
337 deduction guides.
338
339 2020-09-19 Sandra Loosemore <sandra@codesourcery.com>
340
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.
368
369 2020-09-19 Patrick Palka <ppalka@redhat.com>
370
371 PR c++/96531
372 PR c++/97103
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.
384
385 2020-09-19 Patrick Palka <ppalka@redhat.com>
386
387 PR c++/97051
388 * constraint.cc (satisfy_atom): Pass true as the
389 manifestly_const_eval argument to maybe_constant_value.
390
391 2020-09-18 Jason Merrill <jason@redhat.com>
392
393 PR bootstrap/97118
394 * decl.c (complete_vars): Only call layout_var_decl if completing
395 the type succeeded.
396
397 2020-09-18 Jason Merrill <jason@redhat.com>
398
399 * decl.c (complete_vars): Call layout_var_decl.
400
401 2020-09-17 Patrick Palka <ppalka@redhat.com>
402
403 PR c++/96409
404 PR c++/96410
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.
415
416 2020-09-16 Nathan Sidwell <nathan@acm.org>
417
418 * cp-tree.h (cp_check_omp_declare_reduction): Return bool.
419 * semantics.c (cp_check_omp_declare_reduction): Return true on for
420 success.
421 * pt.c (push_template_decl_real): OMP reductions do not get a
422 template header.
423 (tsubst_function_decl): Remove special casing for local decl omp
424 reductions.
425 (tsubst_expr): Call instantiate_body for a local omp reduction.
426 (instantiate_body): Add nested_p parm, and deal with such
427 instantiations.
428 (instantiate_decl): Reject FUNCTION_SCOPE entities, adjust
429 instantiate_body call.
430
431 2020-09-16 Nathan Sidwell <nathan@acm.org>
432
433 * pt.c (instantiate_body): Remove 'nested' var, simplify
434 push_to_top logic.
435
436 2020-09-16 Nathan Sidwell <nathan@acm.org>
437
438 * pt.c (instantiate_body): New, broken out of ..
439 (instantiate_decl): ... here. Call it.
440
441 2020-09-15 Nathan Sidwell <nathan@acm.org>
442
443 * pt.c (push_template_decl_real): OMP reductions retain a template
444 header.
445 (tsubst_function_decl): Likewise.
446
447 2020-09-15 Tobias Burnus <tobias@codesourcery.com>
448
449 PR fortran/96668
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.
453
454 2020-09-14 Marek Polacek <polacek@redhat.com>
455
456 * pt.c (push_template_decl_real): Use VAR_OR_FUNCTION_DECL_P.
457
458 2020-09-14 Nathan Sidwell <nathan@acm.org>
459
460 * pt.c (push_template_decl_real): Don't attach a template head to
461 local externs.
462 (tsubst_function_decl): Add support for headless local extern
463 decls.
464 (tsubst_decl): Add support for headless local extern decls.
465
466 2020-09-11 Nathan Sidwell <nathan@acm.org>
467
468 * decl.c (grokfndecl): Don't attach to local extern.
469
470 2020-09-11 Nathan Sidwell <nathan@acm.org>
471
472 * parser.c (cp_parser_objc_method_definition_list): Reimplement
473 loop, make sure we pop scope.
474
475 2020-09-11 Marek Polacek <polacek@redhat.com>
476
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
481 LOOKUP_CONSTINIT.
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
492 of LOOKUP_CONSTINIT.
493
494 2020-09-10 Nathan Sidwell <nathan@acm.org>
495
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
499 flag.
500 (cp_finish_decl): Use DECL_DECLARED_CONSTINIT_P.
501 * pt.c (tsubst_decl): No need to handle constinit flag
502 propagation.
503 (tsubst_expr): Or here.
504
505 2020-09-10 Nathan Sidwell <nathan@acm.org>
506
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.
523
524 2020-09-09 Marek Polacek <polacek@redhat.com>
525
526 PR c++/77841
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
533 special way.
534
535 2020-09-09 Marek Polacek <polacek@redhat.com>
536
537 PR c++/95164
538 * decl.c (reshape_init_r): When initializing an aggregate member
539 with an initializer from an initializer-list, also consider
540 COMPOUND_LITERAL_P.
541
542 2020-09-09 Nathan Sidwell <nathan@acm.org>
543
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
549 decl context.
550
551 2020-09-09 Patrick Palka <ppalka@redhat.com>
552
553 PR c++/96647
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
557 in the overload set.
558 * cp-tree.h (maybe_instantiate_decl): Declare.
559 * decl2.c (maybe_instantiate_decl): Remove static.
560
561 2020-09-04 Jason Merrill <jason@redhat.com>
562
563 * expr.c (mark_use): Use iloc_sentinel.
564
565 2020-09-03 Jakub Jelinek <jakub@redhat.com>
566
567 PR c++/96901
568 * constexpr.c (fundef_copies_table): Change type from
569 hash_map<tree, tree> * to decl_tree_map *.
570
571 2020-09-03 Marek Polacek <polacek@redhat.com>
572
573 PR c++/92812
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.
580
581 2020-09-03 Jakub Jelinek <jakub@redhat.com>
582
583 PR c++/96862
584 * constexpr.c (cxx_eval_outermost_constant_expr): Temporarily disable
585 flag_rounding_math during manifestly constant evaluation.
586
587 2020-09-01 Marek Polacek <polacek@redhat.com>
588
589 PR c++/77841
590 * init.c (build_new_1): Call reshape_init.
591
592 2020-09-01 Jakub Jelinek <jakub@redhat.com>
593
594 PR c++/96867
595 * semantics.c (handle_omp_array_sections_1): Test
596 DECL_ARRAY_PARAMETER_P only on PARM_DECLs.
597
598 2020-08-31 Marek Polacek <polacek@redhat.com>
599 Jason Merrill <jason@redhat.com>
600
601 PR c++/93529
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
609 a string literal.
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.
614
615 2020-08-27 Martin Liska <mliska@suse.cz>
616
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.
625
626 2020-08-26 Nathan Sidwell <nathan@acm.org>
627
628 * decl.c (poplevel): A local-binding tree list holds the name in
629 TREE_PURPOSE.
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
635 result.
636 (push_operator_bindings): Deal with 'ignore' marker.
637
638 2020-08-25 Tobias Burnus <tobias@codesourcery.com>
639
640 PR c/96678
641 * semantics.c (handle_omp_array_sections_1): Talk about
642 array function parameter in the error message.
643
644 2020-08-25 Jakub Jelinek <jakub@redhat.com>
645
646 PR c++/96721
647 * cp-tree.h (build_trivial_dtor_call): Add bool argument defaulted
648 to false.
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.
654
655 2020-08-25 Jason Merrill <jason@redhat.com>
656
657 PR c++/95428
658 * optimize.c (populate_clone_array): Revert PR70462 change.
659 (maybe_clone_body): Likewise.
660
661 2020-08-24 Nathan Sidwell <nathan@acm.org>
662
663 * ptree.c (debug_overload): New.
664
665 2020-08-19 Jason Merrill <jason@redhat.com>
666
667 DR 2369
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
675 conversions.
676
677 2020-08-18 Nathan Sidwell <nathan@acm.org>
678
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.
682
683 2020-08-18 Jason Merrill <jason@redhat.com>
684
685 PR c++/96199
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.
691
692 2020-08-18 Jason Merrill <jason@redhat.com>
693
694 PR c++/96199
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.
699
700 2020-08-18 Nathan Sidwell <nathan@acm.org>
701
702 * name-lookup.c (qualify_lookup): Drop lambda checking here.
703 Reorder namespace & type checking.
704 (lookup_name_1): Do hidden lambda checking here.
705
706 2020-08-14 Nathan Sidwell <nathan@acm.org>
707
708 * name-lookup.h (lookup_name_real, lookup_name_nonclass): Rename
709 to ...
710 (lookup_name): ... these new overloads.
711 * name-lookup.c (identifier_type_value_1): Rename lookup_name_real
712 call.
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.
725
726 2020-08-14 Nathan Sidwell <nathan@acm.org>
727
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
731 HIDDEN_LAMBDA flags.
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
735 ctors.
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
744 calls.
745 (lookup_name_real): Drop flags parm.
746 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real
747 calls.
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
752 call.
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
761 look in namespaces.
762
763 2020-08-14 Jason Merrill <jason@redhat.com>
764
765 PR c++/90254
766 PR c++/93711
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.
773
774 2020-08-14 Nathan Sidwell <nathan@acm.org>
775
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
783 LOOK_want parm.
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
799 LOOK_want parm.
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
816 value.
817 (cp_parser_lookup_name): Adjust lookup_member, lookup_name_real
818 calls.
819 * pt.c (check_explicit_specialization): Adjust lookup_qualified_name
820 call.
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.
828
829 2020-08-13 Nathan Sidwell <nathan@acm.org>
830
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.
847
848 2020-08-13 Marek Polacek <polacek@redhat.com>
849
850 PR c++/92812
851 * typeck.c (build_static_cast_1): Implement P1975R0 by allowing
852 static_cast to aggregate type.
853
854 2020-08-10 Jakub Jelinek <jakub@redhat.com>
855
856 PR c++/96497
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.
860
861 2020-08-10 Patrick Palka <ppalka@redhat.com>
862
863 * pt.c (resolve_overloaded_unification): Drop functions with
864 unsatisfied constraints.
865 (resolve_nondeduced_context): Likewise.
866
867 2020-08-05 Patrick Palka <ppalka@redhat.com>
868 Jason Merrill <jason@redhat.com>
869
870 PR c++/96282
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
874 array object.
875
876 2020-08-04 Marek Polacek <polacek@redhat.com>
877
878 PR c++/96082
879 * parser.c (cp_parser_elaborated_type_specifier): Allow
880 'template' following ::.
881
882 2020-08-04 Nathan Sidwell <nathan@acm.org>
883
884 * parser.c (cp_parser_explicit_specialization): Refactor
885 to avoid leak of num_template_parameter_lists value.
886
887 2020-08-04 Patrick Palka <ppalka@redhat.com>
888
889 PR c++/94024
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.
899
900 2020-08-03 Marek Polacek <polacek@redhat.com>
901
902 * cp-tree.h (after_nsdmi_defaulted_late_checks): Remove.
903
904 2020-08-03 Marek Polacek <polacek@redhat.com>
905
906 DR 2032
907 PR c++/96218
908 * pt.c (check_default_tmpl_args): Also consider variable
909 templates.
910
911 2020-07-31 Jakub Jelinek <jakub@redhat.com>
912
913 PR c++/96182
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.
918
919 2020-07-31 Martin Sebor <msebor@redhat.com>
920
921 PR c++/96003
922 * class.c (build_base_path): Set no-warning bit on the synthesized
923 conditional expression in static_cast.
924
925 2020-07-31 Richard Biener <rguenther@suse.de>
926
927 PR debug/96383
928 * cp-objcp-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
929 Define to c_common_finalize_early_debug.
930
931 2020-07-31 Patrick Palka <ppalka@redhat.com>
932
933 PR c++/96197
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
938 bool parameter.
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
945 bool parameter.
946 (decl_really_constant_value): Add bool parameter and forward it
947 to constant_value_1.
948 (decl_constant_value): Likewise, but instead define a new
949 overload with an added bool parameter.
950
951 2020-07-30 Patrick Palka <ppalka@redhat.com>
952
953 PR c++/64194
954 * pt.c (resolve_overloaded_unification): If the function
955 template specialization has a placeholder return type,
956 then instantiate it before attempting unification.
957
958 2020-07-30 Patrick Palka <ppalka@redhat.com>
959
960 PR c++/95486
961 * pt.c (alias_ctad_tweaks): Call remove_constraints before
962 calling set_constraints.
963
964 2020-07-30 Patrick Palka <ppalka@redhat.com>
965
966 PR c++/96106
967 * pt.c (reduce_template_parm_level): Propagate DECL_VIRTUAL_P
968 from the original TEMPLATE_PARM_DECL to the new lowered one.
969
970 2020-07-30 Patrick Palka <ppalka@redhat.com>
971
972 PR c++/96164
973 * constraint.cc (constraints_satisfied_p): Return true if
974 !flags_concepts.
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.
978
979 2020-07-29 Jason Merrill <jason@redhat.com>
980
981 PR c++/91427
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
990 IMPLICIT_RVALUE_P.
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.
995
996 2020-07-29 Jason Merrill <jason@redhat.com>
997
998 PR c++/91212
999 * call.c (build_over_call): Don't call a const ref
1000 overload for implicit move.
1001
1002 2020-07-28 Nathan Sidwell <nathan@acm.org>
1003
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.
1007
1008 2020-07-28 Nathan Sidwell <nathan@acm.org>
1009
1010 * class.c (fixup_type_variants): Copy TYPE_SIZE and
1011 TYPE_SIZE_UINIT.
1012 (finish_struct): Call it.
1013
1014 2020-07-28 Nathan Sidwell <nathan@acm.org>
1015
1016 * ptree.c (cxx_print_decl): Better indentation.
1017
1018 2020-07-28 Jakub Jelinek <jakub@redhat.com>
1019 Mark Wielaard <mark@klomp.org>
1020
1021 PR c++/96328
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
1025 one are purged.
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
1029 case too.
1030
1031 2020-07-27 Nathan Sidwell <nathan@acm.org>
1032
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
1036 identifier.
1037 * class.c (layout_class_type): Name the as-base type. Zap
1038 NSDMI its fields may have.
1039
1040 2020-07-22 Nathan Sidwell <nathan@acm.org>
1041
1042 * class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.
1043
1044 2020-07-22 Nathan Sidwell <nathan@acm.org>
1045
1046 * typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
1047 apart complex if.
1048 [UNDERLYING_TYPE]: Use an if.
1049 [TYPEOF_TYPE]: New.
1050
1051 2020-07-22 Nathan Sidwell <nathan@acm.org>
1052
1053 * decl.c (decls_match): Move variables into scopes
1054 they're needed in.
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
1061 'decl', not 'name'.
1062
1063 2020-07-22 Nathan Sidwell <nathan@acm.org>
1064
1065 * cp-tree.h (struct tree_lambda_expr): Shrink
1066 default_capture_mode & discriminator.
1067
1068 2020-07-22 Nathan Sidwell <nathan@acm.org>
1069
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
1074 local check.
1075
1076 2020-07-22 Tobias Burnus <tobias@codesourcery.com>
1077
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.
1081
1082 2020-07-21 Sunil K Pandey <skpgkp2@gmail.com>
1083
1084 PR target/95237
1085 * decl.c (cp_finish_decl): Call target hook
1086 lower_local_decl_alignment to lower local decl alignment.
1087
1088 2020-07-21 Nathan Sidwell <nathan@acm.org>
1089
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.
1095
1096 2020-07-20 Jason Merrill <jason@redhat.com>
1097
1098 * pt.c (type_dependent_expression_p): A pseudo-dtor can be
1099 dependent.
1100 * semantics.c (finish_call_expr): Use build_trivial_dtor_call for
1101 pseudo-destructor.
1102 (finish_pseudo_destructor_expr): Leave type NULL for dependent arg.
1103
1104 2020-07-20 Jason Merrill <jason@redhat.com>
1105
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.
1110
1111 2020-07-20 Jason Merrill <jason@redhat.com>
1112
1113 * pt.c (collect_ctor_idx_types): Add 'const' when deducing from
1114 a string constant.
1115
1116 2020-07-17 Marek Polacek <polacek@redhat.com>
1117
1118 PR c++/79815
1119 * decl.c (grokdeclarator): Detect cv-qual decltype(auto).
1120 * pt.c (do_auto_deduction): Likewise.
1121
1122 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
1123
1124 PR c++/95591
1125 PR c++/95599
1126 PR c++/95823
1127 PR c++/95824
1128 PR c++/95895
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
1137 warning.
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
1157 to COND_EXPR).
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.
1164
1165 2020-07-16 Marek Polacek <polacek@redhat.com>
1166
1167 * call.c (convert_like): Remove macro and introduce a new
1168 wrapper instead.
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.
1175
1176 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
1177
1178 * coroutines.cc: Correct some spelling errors
1179 in comments.
1180
1181 2020-07-15 Nathan Sidwell <nathan@acm.org>
1182
1183 * parser.c (cp_parser_declaration): Avoid copying tokens.
1184 (cp_parser_block_declaration): RAII token pointer.
1185
1186 2020-07-15 Nathan Sidwell <nathan@acm.org>
1187
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.
1196
1197 2020-07-14 Marek Polacek <polacek@redhat.com>
1198
1199 PR c++/95789
1200 PR c++/96104
1201 PR c++/96179
1202 * call.c (convert_like_real_1): Renamed from convert_like_real.
1203 (convert_like_real): New wrapper for convert_like_real_1.
1204
1205 2020-07-14 Nathan Sidwell <nathan@acm.org>
1206
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
1209 into the buffer.
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
1217 confusion.
1218
1219 2020-07-14 Nathan Sidwell <nathan@acm.org>
1220
1221 * ptree.c (cxx_print_type): Add TYPEOF_TYPE and BASES.
1222
1223 2020-07-14 Nathan Sidwell <nathan@acm.org>
1224
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.
1228
1229 2020-07-14 Marek Polacek <polacek@redhat.com>
1230
1231 PR c++/95820
1232 * decl.c (grokdeclarator) <case cdk_function>: Check also
1233 pointers/references/... to functions.
1234
1235 2020-07-14 Nathan Sidwell <nathan@acm.org>
1236
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.
1255 * pt.c: Whitespace
1256 * ptree.c: Whitespace.
1257 * rtti.c: Whitespace & comment.
1258 * tree.c: Comment.
1259 * typeck.c (structural_comptypes): Add comment.
1260
1261 2020-07-13 Nathan Sidwell <nathan@acm.org>
1262
1263 * Make-lang.in (c++.disclean): Likewise.
1264
1265 2020-07-13 Marek Polacek <polacek@redhat.com>
1266
1267 PR c++/96077
1268 * parser.c (cp_parser_enum_specifier): Commit to tentative parse
1269 after we've seen an opening brace.
1270
1271 2020-07-10 Jason Merrill <jason@redhat.com>
1272
1273 * tree.c (structural_type_p): Allow unions.
1274 * mangle.c (write_expression): Express unions with a designator.
1275
1276 2020-07-10 Jason Merrill <jason@redhat.com>
1277
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.
1281
1282 2020-07-10 Jason Merrill <jason@redhat.com>
1283
1284 PR c++/96105
1285 PR c++/96052
1286 PR c++/95976
1287 * class.c (check_field_decls): An array of empty classes is not an
1288 empty data member.
1289 (layout_empty_base_or_field): Handle explicit alignment.
1290 Fix union handling.
1291
1292 2020-07-09 Julian Brown <julian@codesourcery.com>
1293 Thomas Schwinge <thomas@codesourcery.com>
1294
1295 PR middle-end/95270
1296 * semantics.c (finish_omp_clauses): Likewise.
1297
1298 2020-07-09 Patrick Palka <ppalka@redhat.com>
1299
1300 PR c++/96132
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.
1304
1305 2020-07-08 Patrick Palka <ppalka@redhat.com>
1306
1307 PR c++/95497
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.
1311
1312 2020-07-08 Marek Polacek <polacek@redhat.com>
1313
1314 PR c++/96103
1315 * parser.c (cp_parser_decltype): Print error about using decltype(auto)
1316 in C++11. Check that the token following "auto" is ")".
1317
1318 2020-07-07 Patrick Palka <ppalka@redhat.com>
1319
1320 PR c++/95303
1321 * cxx-pretty-print.c (pp_cxx_unqualified_id): Check
1322 PRIMARY_TEMPLATE_P before printing the innermost template
1323 arguments.
1324
1325 2020-07-07 Martin Sebor <msebor@redhat.com>
1326
1327 PR c++/96063
1328 * parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
1329 if warning_at returns nonzero.
1330
1331 2020-07-06 Martin Sebor <msebor@redhat.com>
1332
1333 PR c++/95984
1334 * call.c (build_over_call): Check calls only when tf_warning is set.
1335
1336 2020-07-06 Nathan Sidwell <nathan@acm.org>
1337
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.
1343
1344 2020-07-06 Jonathan Wakely <jwakely@redhat.com>
1345
1346 PR c++/96068
1347 * parser.c (cp_parser_toplevel_declaration): Only do pedwarn for
1348 empty-declaration in C++98.
1349
1350 2020-07-02 Jason Merrill <jason@redhat.com>
1351 Jakub Jelinek <jakub@redhat.com>
1352
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.
1362
1363 2020-07-01 Nathan Sidwell <nathan@acm.org>
1364
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
1371 needed.
1372 (build_cdtor): Determine vtt and inherited here.
1373 * cp-tree.h (DECL_NEEDS_CTT_PARM_P): Delete.
1374
1375 2020-06-30 Nathan Sidwell <nathan@acm.org>
1376
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
1388 calls.
1389 * method.c (implicitly_declare_fn): Adjust copy_fndecl_with_name
1390 call.
1391 (lazily_declare_fn): Adjust clone_function_decl call.
1392 * pt.c (tsubst_function_decl): Likewise.
1393 (instantiate_template_1): Likewise.
1394
1395 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
1396
1397 * coroutines.cc (morph_fn_to_coro): Remove trailing
1398 space in a diagnostic.
1399
1400 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
1401
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.
1412
1413 2020-06-29 Marek Polacek <polacek@redhat.com>
1414
1415 PR c++/94553
1416 * decl.c (duplicate_decls): Make sure a concept or a variable
1417 template is unique in its declarative region.
1418
1419 2020-06-29 Marek Polacek <polacek@redhat.com>
1420
1421 PR c++/95568
1422 * pt.c (collect_ctor_idx_types): Use TREE_TYPE.
1423
1424 2020-06-28 Iain Sandoe <iain@sandoe.co.uk>
1425
1426 PR c++/95711
1427 * coroutines.cc (register_local_var_uses): Skip past
1428 namespace decls.
1429
1430 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
1431
1432 PR c++/95736
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.
1440
1441 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
1442
1443 * coroutines.cc (morph_fn_to_coro): Diagnose unavailable
1444 get_return_object_on_allocation_failure.
1445
1446 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
1447
1448 PR c++/95519
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.
1458
1459 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
1460
1461 * coroutines.cc (morph_fn_to_coro): Handle error
1462 returns in building g-r-o-o-a-f expressions.
1463
1464 2020-06-24 Nicholas Krause <xerofoify@gmail.com>
1465
1466 PR c++/95672
1467 * typeck2.c (cxx_incomplete_type_diagnostic): Add missing
1468 TYPE_EXPANSION_PACK check for diagnosing incomplete types in
1469 cxx_incomplete_type_diagnostic.
1470
1471 2020-06-24 Iain Sandoe <iain@sandoe.co.uk>
1472
1473 PR c++/95518
1474 PR c++/95813
1475 * coroutines.cc (act_des_fn): Copy function
1476 attributes onto the outlined coroutine helpers.
1477
1478 2020-06-24 Jason Merrill <jason@redhat.com>
1479
1480 * call.c (build_over_call): Only call build_base_path once.
1481
1482 2020-06-24 Jason Merrill <jason@redhat.com>
1483
1484 PR c++/95719
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.
1487
1488 2020-06-23 Jason Merrill <jason@redhat.com>
1489
1490 PR c++/93976
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
1497 initializer.
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.
1503
1504 2020-06-23 Iain Sandoe <iain@sandoe.co.uk>
1505
1506 PR c++/95477
1507 * coroutines.cc (morph_fn_to_coro): Apply a cleanup to
1508 the get return object when the DTOR is non-trivial.
1509
1510 2020-06-20 Iain Sandoe <iain@sandoe.co.uk>
1511
1512 PR c++/95505
1513 * coroutines.cc (morph_fn_to_coro): Update handling of
1514 get-return-object-on-allocation-fail and diagnose missing
1515 std::nothrow.
1516
1517 2020-06-20 Jason Merrill <jason@redhat.com>
1518
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
1522 pack.
1523 (more_specialized_fn): Only compare constraints for candidates with
1524 matching parameters.
1525
1526 2020-06-19 Jason Merrill <jason@redhat.com>
1527
1528 * method.c (early_check_defaulted_comparison): Allow defaulting
1529 comparison outside class. Complain if non-member operator isn't a
1530 friend.
1531
1532 2020-06-18 Jason Merrill <jason@redhat.com>
1533
1534 * method.c (early_check_defaulted_comparison): Check for &&.
1535 (build_comparison_op): Allow empty union. Diagnose non-category
1536 type.
1537 (common_comparison_type): Remove handling for non-category type.
1538
1539 2020-06-18 Marek Polacek <polacek@redhat.com>
1540
1541 PR c++/95735
1542 * pt.c (finish_template_variable): Return if
1543 coerce_innermost_template_parms return error_mark_node.
1544
1545 2020-06-18 Marek Polacek <polacek@redhat.com>
1546
1547 PR c++/95728
1548 * pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
1549 if placement is erroneous.
1550
1551 2020-06-17 Jonathan Wakely <jwakely@redhat.com>
1552
1553 PR c++/66159
1554 * parser.c (cp_parser_elaborated_type_specifier): Do not warn
1555 unless in a declaration.
1556
1557 2020-06-17 Jason Merrill <jason@redhat.com>
1558
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.
1564
1565 2020-06-17 Jason Merrill <jason@redhat.com>
1566
1567 * call.c (build_new_op_1): Don't look for a CALL_EXPR when
1568 calling a consteval function.
1569
1570 2020-06-17 Jason Merrill <jason@redhat.com>
1571
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.
1575
1576 2020-06-17 Marek Polacek <polacek@redhat.com>
1577
1578 PR c++/95508
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.
1583
1584 2020-06-16 Marek Polacek <polacek@redhat.com>
1585
1586 PR c++/95369
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.
1590
1591 2020-06-16 Marek Polacek <polacek@redhat.com>
1592
1593 PR c++/95560
1594 * name-lookup.c (check_local_shadow): Check if types are
1595 non-null before calling same_type_p.
1596
1597 2020-06-16 Jakub Jelinek <jakub@redhat.com>
1598
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
1603 after those calls.
1604 * pt.c (tsubst_omp_for_iterator): Handle non-rectangular loops.
1605
1606 2020-06-16 Jakub Jelinek <jakub@redhat.com>
1607
1608 * parser.c (cp_parser_omp_clause_schedule): Reject modifier separated
1609 from kind by comma rather than colon.
1610
1611 2020-06-16 Patrick Palka <ppalka@redhat.com>
1612
1613 * pt.c (perform_instantiation_time_access_checks): No need to
1614 tsubst into decl.
1615 * semantics.c (enforce_access): Verify that decl is not
1616 dependent.
1617
1618 2020-06-16 Patrick Palka <ppalka@redhat.com>
1619
1620 PR c++/41437
1621 PR c++/47346
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.
1635
1636 2020-06-16 Patrick Palka <ppalka@redhat.com>
1637
1638 PR c++/41437
1639 PR c++/47346
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
1657 early exit.
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.
1665
1666 2020-06-11 Patrick Palka <ppalka@redhat.com>
1667
1668 PR c++/93467
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.
1675
1676 2020-06-11 Iain Sandoe <iain@sandoe.co.uk>
1677
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.
1682
1683 2020-06-10 Iain Sandoe <iain@sandoe.co.uk>
1684
1685 PR c++/95440
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.
1690
1691 2020-06-10 Marek Polacek <polacek@redhat.com>
1692
1693 PR c++/95562
1694 * parser.c (cp_parser_direct_declarator): Clear
1695 CP_PARSER_FLAGS_DELAY_NOEXCEPT if the declarator kind is not
1696 cdk_id.
1697
1698 2020-06-09 Iain Sandoe <iain@sandoe.co.uk>
1699
1700 PR c++/95137
1701 * coroutines.cc (expand_one_await_expression): Build separate
1702 DTOR trees for the awaitable object on the destroy and resume
1703 paths.
1704
1705 2020-06-09 Jason Merrill <jason@redhat.com>
1706
1707 PR c++/95552
1708 * cp-gimplify.c (predeclare_vla): Only predeclare a VLA if it's
1709 wrapped in a pointer type.
1710
1711 2020-06-05 Marek Polacek <polacek@redhat.com>
1712
1713 PR c++/95369
1714 * call.c (build_converted_constant_expr_internal): Allow
1715 list-initialization.
1716
1717 2020-06-05 Iain Sandoe <iain@sandoe.co.uk>
1718
1719 * cp-tree.def (CO_RETURN_EXPR): Correct the class
1720 to use tcc_statement.
1721
1722 2020-06-05 Jason Merrill <jason@redhat.com>
1723
1724 * error.c (dump_binary_op): Handle negative operand to
1725 POINTER_PLUS_EXPR.
1726
1727 2020-06-04 Jason Merrill <jason@redhat.com>
1728
1729 PR c++/93310
1730 * constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
1731 Evaluate OBJ_TYPE_REF_EXPR.
1732
1733 2020-06-04 Jason Merrill <jason@redhat.com>
1734
1735 PR c++/95158
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.
1740
1741 2020-06-04 Iain Sandoe <iain@sandoe.co.uk>
1742
1743 PR c++/95346
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.
1748
1749 2020-06-04 Jakub Jelinek <jakub@redhat.com>
1750
1751 PR c++/82304
1752 PR c++/95307
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.
1756
1757 2020-06-03 Mark Wielaard <mark@klomp.org>
1758
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.
1763
1764 2020-06-03 Patrick Palka <ppalka@redhat.com>
1765
1766 * pt.c (process_partial_specialization): Pass the full set of
1767 generic template arguments to strictly_subsumes.
1768
1769 2020-06-03 Patrick Palka <ppalka@redhat.com>
1770
1771 PR c++/92103
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.
1775
1776 2020-06-03 Iain Sandoe <iain@sandoe.co.uk>
1777
1778 PR c++/95345
1779 * coroutines.cc (finish_co_await_expr): Revise to allow for
1780 parameter packs.
1781 (finish_co_yield_expr): Likewise.
1782
1783 2020-06-03 Jason Merrill <jason@redhat.com>
1784
1785 PR c++/95232
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.
1789
1790 2020-06-03 Tobias Burnus <tobias@codesourcery.com>
1791
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.
1795
1796 2020-06-02 Jason Merrill <jason@redhat.com>
1797
1798 PR c++/95193
1799 * pt.c (tsubst_decl): Relax assert.
1800
1801 2020-06-02 Iain Sandoe <iain@sandoe.co.uk>
1802
1803 PR c++/95050
1804 * coroutines.cc (build_co_await): Wrap the co_await expression
1805 in a TARGET_EXPR, where needed.
1806 (finish_co_yield_expr): Likewise.
1807
1808 2020-06-02 Patrick Palka <ppalka@redhat.com>
1809
1810 PR c++/92633
1811 PR c++/92838
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.
1816
1817 2020-06-01 Jason Merrill <jason@redhat.com>
1818
1819 PR c++/95466
1820 PR c++/95311
1821 PR c++/95221
1822 * class.c (build_vfn_ref): Revert 95311 change.
1823 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): Build a
1824 COMPOUND_EXPR.
1825
1826 2020-06-01 Iain Sandoe <iain@sandoe.co.uk>
1827
1828 PR c++/95350
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.
1832
1833 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
1834
1835 PR c++/95087
1836 * coroutines.cc (morph_fn_to_coro): If we see an
1837 early fatal error, drop the erroneous function body.
1838
1839 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
1840
1841 * coroutines.cc (build_co_await): Remove unused
1842 variable.
1843 (finish_co_await_expr): Likewise.
1844 (finish_co_yield_expr): Likewise; revise comment.
1845
1846 2020-05-30 Iain Sandoe <iain@sandoe.co.uk>
1847
1848 * coroutines.cc (morph_fn_to_coro): Revise initialization
1849 of the frame pointer to avoid an unused value.
1850
1851 2020-05-30 Patrick Palka <ppalka@redhat.com>
1852
1853 PR c++/95386
1854 * constraint.cc (satisfaction_value): Accept INTEGER_CST of any
1855 boolean type.
1856
1857 2020-05-29 Patrick Palka <ppalka@redhat.com>
1858 Jason Merrill <jason@redhat.com>
1859
1860 PR c++/95181
1861 * class.c (add_method): Let special member function templates
1862 coexist if they are not equivalently constrained, or in a class
1863 template.
1864
1865 2020-05-29 Jason Merrill <jason@redhat.com>
1866
1867 PR c++/95371
1868 * pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
1869 on the DECL_TEMPLATE_RESULT.
1870
1871 2020-05-29 Marek Polacek <polacek@redhat.com>
1872
1873 PR c++/95344
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.
1877
1878 2020-05-29 Jason Merrill <jason@redhat.com>
1879
1880 PR c++/95311
1881 PR c++/95221
1882 * class.c (build_vfn_ref): Don't fold the INDIRECT_REF.
1883
1884 2020-05-29 Patrick Palka <ppalka@redhat.com>
1885
1886 PR c++/92652
1887 PR c++/93698
1888 PR c++/94128
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.
1893
1894 2020-05-29 Patrick Palka <ppalka@redhat.com>
1895
1896 PR c++/95241
1897 * constexpr.c (get_or_insert_ctor_field): Add limited support
1898 for RANGE_EXPR index lookups.
1899
1900 2020-05-28 Jakub Jelinek <jakub@redhat.com>
1901
1902 PR c++/95328
1903 * decl.c (cp_finish_decomp): Call complete_type before checking
1904 COMPLETE_TYPE_P.
1905
1906 2020-05-28 Jason Merrill <jason@redhat.com>
1907
1908 PR c++/94926
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.
1913
1914 2020-05-27 Jason Merrill <jason@redhat.com>
1915
1916 PR c++/95319
1917 * decl.c (reshape_init_array_1): Don't reuse in overload context.
1918
1919 2020-05-27 Jason Merrill <jason@redhat.com>
1920
1921 PR c++/95242
1922 * call.c (build_new_op_1): Suppress
1923 warn_zero_as_null_pointer_constant across comparison of <=> result
1924 to 0.
1925
1926 2020-05-27 Jason Merrill <jason@redhat.com>
1927
1928 PR c++/95222
1929 * decl.c (grokdeclarator): Don't shift attributes in TYPENAME
1930 context.
1931
1932 2020-05-27 Nathan Sidwell <nathan@acm.org>
1933
1934 PR c++/95263
1935 * pt.c (lookup_template_class_1): Restore alias template mutation.
1936
1937 2020-05-26 Jakub Jelinek <jakub@redhat.com>
1938
1939 PR c++/95197
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.
1944
1945 2020-05-23 Patrick Palka <ppalka@redhat.com>
1946
1947 PR c++/94038
1948 * constexpr.c (cxx_eval_constant_expression)
1949 <case TEMPLATE_ID_EXPR>: Don't evaluate the concept when
1950 constexpr evaluation is uid-sensitive.
1951
1952 2020-05-22 Jason Merrill <jason@redhat.com>
1953
1954 * cp-gimplify.c (cp_gimplify_expr) [CALL_EXPR]: Don't preevaluate
1955 the function address if the call used operator syntax.
1956
1957 2020-05-21 Jason Merrill <jason@redhat.com>
1958
1959 PR c++/95221
1960 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): For a virtual
1961 call, instrument the OBJ_TYPE_REF.
1962
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.
1967
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.
1973
1974 * typeck.c (build_x_modify_expr): Handle error_mark_node arguments.
1975
1976 * decl.c (grokparms): Return NULL_TREE if any parms were erroneous.
1977
1978 2020-05-21 Iain Sandoe <iain@sandoe.co.uk>
1979
1980 * coroutines.cc (finish_co_return_stmt): Revert change to use
1981 finish_expr_stmt.
1982
1983 2020-05-21 Patrick Palka <ppalka@redhat.com>
1984
1985 PR c++/94038
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
1991 constructor.
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.
2016
2017 2020-05-20 Marek Polacek <polacek@redhat.com>
2018
2019 DR 2237
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.
2024
2025 2020-05-20 Marek Polacek <polacek@redhat.com>
2026
2027 DR 2289
2028 PR c++/94553
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
2036 to start_decl.
2037
2038 2020-05-20 Patrick Palka <ppalka@redhat.com>
2039
2040 PR c++/95223
2041 * typeck.c (structural_comptypes): Don't perform
2042 context-dependent resolution of TYPENAME_TYPEs when
2043 comparing_specializations.
2044
2045 2020-05-19 Nathan Sidwell <nathan@acm.org>
2046
2047 * pt.c (lookup_template_class_1): Do not reinit template_info of an
2048 alias here.
2049
2050 2020-05-18 Martin Sebor <msebor@redhat.com>
2051
2052 PR c++/94923
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.
2058
2059 2020-05-19 Patrick Palka <ppalka@redhat.com>
2060
2061 PR c++/87847
2062 * pt.c (init_template_processing): Enable sanitization for
2063 decl_specializations and type_specializations.
2064
2065 PR c++/66439
2066 * pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
2067 the 'in_decl' parameter to coerce_template_parms.
2068
2069 2020-05-18 Marek Polacek <polacek@redhat.com>
2070
2071 PR c++/94955
2072 * typeck.c (cp_build_binary_op): Use fold_for_warn instead of
2073 cp_fold_rvalue.
2074
2075 2020-05-18 Marek Polacek <polacek@redhat.com>
2076
2077 PR c++/94937
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
2082 manually.
2083
2084 2020-05-18 Marek Polacek <polacek@redhat.com>
2085
2086 PR c++/90915
2087 * parser.c (cp_parser_has_attribute_expression): Sorry on a
2088 type-dependent argument.
2089
2090 2020-05-18 Marek Polacek <polacek@redhat.com>
2091
2092 DR 1512
2093 PR c++/87699
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
2100 types.
2101
2102 2020-05-18 Jason Merrill <jason@redhat.com>
2103
2104 * call.c (build_over_call): Remove unnecessary
2105 cp_stabilize_reference.
2106
2107 2020-05-18 Marek Polacek <polacek@redhat.com>
2108
2109 * call.c (add_builtin_candidate): Don't create a builtin overload
2110 candidate for ++ when type is bool in C++17.
2111
2112 2020-05-18 Marek Polacek <polacek@redhat.com>
2113
2114 * cfns.h: Regenerated.
2115
2116 2020-05-17 Iain Sandoe <iain@sandoe.co.uk>
2117
2118 * coroutines.cc (morph_fn_to_coro): Initialize the gro variable.
2119
2120 2020-05-16 Iain Sandoe <iain@sandoe.co.uk>
2121
2122 * coroutines.cc (finish_co_return_stmt): Implement rules
2123 from [class.copy.elision] /3.
2124
2125 2020-05-16 Patrick Palka <ppalka@redhat.com>
2126
2127 PR c++/57943
2128 * semantics.c (finish_decltype_type): Call
2129 instantiate_non_dependent_expr_sfinae on the expression.
2130
2131 2020-05-15 Patrick Palka <ppalka@redhat.com>
2132
2133 Revert:
2134
2135 2020-04-07 Patrick Palka <ppalka@redhat.com>
2136
2137 PR c++/90996
2138 * typeck2.c (process_init_constructor_array): Propagate
2139 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
2140 the array initializer.
2141
2142 2020-05-15 Jason Merrill <jason@redhat.com>
2143
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.
2148
2149 2020-05-15 Nathan Sidwell <nathan@acm.org>
2150
2151 * pt.c (template_args_equal): Fix thinkos in previous 'cleanup'.
2152
2153 2020-05-14 Jason Merrill <jason@redhat.com>
2154
2155 PR c++/93901
2156 * pt.c (maybe_instantiate_noexcept): Change clone handling.
2157
2158 2020-05-14 Patrick Palka <ppalka@redhat.com>
2159
2160 PR c++/78446
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
2164 to lookup_fnfields.
2165 * cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter.
2166 * except.c (build_throw): Pass tf_warning_or_error to
2167 lookup_fnfields.
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
2171 to lookup_fnfields.
2172 * pt.c (tsubst_baselink): Pass complain to lookup_fnfields.
2173 * search.c (lookup_fnfields): New 'complain' parameter. Pass it
2174 to lookup_member.
2175
2176 2020-05-14 Nathan Sidwell <nathan@acm.org>
2177
2178 * parser.c (cp_parser_diagnose_invalid_typename): Mention
2179 std=c++20 not 2a, reformat dependent binfo inform loops.
2180
2181 * pt.c (tsubst_template_decl): Reorder and commonize some control
2182 paths.
2183
2184 * pt.c (tsubst_friend_function): Simplify control flow.
2185
2186 * pt.c (lookup_template_class_1): Remove unnecessary else by
2187 simply grabbing TYPE_NAME earlier.
2188
2189 * pt.c (push_template_decl_real): Adjust friend pushing logic.
2190 Reinit template type.
2191
2192 * pt.c (build_template_decl): Init DECL_TEMPLATE_RESULT &
2193 TREE_TYPE here ...
2194 (process_partial_specialization): ... not here ...
2195 (push_template_decl_real, add_inherited_template_parms)
2196 (build_deduction_guide): ... or here.
2197
2198 2020-05-14 Jakub Jelinek <jakub@redhat.com>
2199
2200 * cp-gimplify.c (cp_genericize_r): Set cfun->has_omp_target.
2201
2202 2020-05-13 Patrick Palka <ppalka@redhat.com>
2203
2204 PR c++/79706
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
2208 error_mark_node.
2209
2210 2020-05-13 Patrick Palka <ppalka@redhat.com>
2211
2212 PR c++/95020
2213 * constraint.cc (tsubst_requires_expr): Produce a new
2214 requires-expression when processing_template_decl, even if
2215 template arguments are not dependent.
2216
2217 2020-05-13 Marek Polacek <polacek@redhat.com>
2218
2219 PR c++/95066
2220 * decl.c (duplicate_decls): Set DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.
2221
2222 2020-05-13 Nathan Sidwell <nathan@acm.org>
2223
2224 * pt.c (template_args_equal): Reorder category checking for
2225 clarity.
2226
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
2232 object reference.
2233
2234 * pt.c (canonical_type_parameter): Simplify.
2235
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
2245 asserts.
2246 (instantiate_decl): Likewise.
2247 (resolve_typename_type): Reformat comment.
2248 * semantics.c (struct deferred_access): Remove unnecessary GTY on
2249 member.
2250 (begin_class_definition): Fix formatting.
2251
2252 2020-05-13 Jason Merrill <jason@redhat.com>
2253
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.
2257
2258 2020-05-12 Marek Polacek <polacek@redhat.com>
2259
2260 PR c++/95074
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.
2264
2265 2020-05-12 Jakub Jelinek <jakub@redhat.com>
2266
2267 PR c++/95063
2268 * pt.c (tsubst_decl): Deal with DECL_OMP_PRIVATIZED_MEMBER for
2269 a bit-field.
2270
2271 2020-05-11 Jason Merrill <jason@redhat.com>
2272
2273 Resolve C++20 NB comment CA104
2274 * pt.c (determine_specialization): Compare constraints for
2275 specialization of member template of class instantiation.
2276
2277 2020-05-11 Jason Merrill <jason@redhat.com>
2278
2279 PR c++/92583
2280 PR c++/92654
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.
2286
2287 2020-05-11 Jason Merrill <jason@redhat.com>
2288
2289 * call.c (implicit_conversion_error): Split out from...
2290 (perform_implicit_conversion_flags): ...here.
2291 (build_converted_constant_expr_internal): Use it.
2292
2293 2020-05-11 Jason Merrill <jason@redhat.com>
2294
2295 PR c++/90748
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.
2302
2303 2020-05-11 Jason Merrill <jason@redhat.com>
2304
2305 * decl.c (cxx_init_decl_processing): Call declare_weak for
2306 __cxa_pure_virtual.
2307
2308 2020-05-11 Jason Merrill <jason@redhat.com>
2309
2310 * pt.c (instantiate_class_template_1): Call tsubst_expr for
2311 STATIC_ASSERT member.
2312 * ptree.c (cxx_print_xnode): Handle STATIC_ASSERT.
2313
2314 2020-05-11 Jason Merrill <jason@redhat.com>
2315
2316 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Remove redundant
2317 walking of capture list.
2318
2319 2020-05-11 Jason Merrill <jason@redhat.com>
2320
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.
2325
2326 2020-05-11 Jason Merrill <jason@redhat.com>
2327
2328 * decl.c (compute_array_index_type_loc): Stabilize before building
2329 the MINUS_EXPR.
2330
2331 2020-05-11 Jason Merrill <jason@redhat.com>
2332
2333 * decl.c (grokdeclarator): Adjust deprecated_state here.
2334 (start_decl): Not here.
2335
2336 2020-05-08 Iain Sandoe <iain@sandoe.co.uk>
2337
2338 PR c++/95003
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.
2343
2344 2020-05-08 Nathan Sidwell <nathan@acm.org>
2345
2346 * NEWS: Delete, it is so stale.
2347
2348 * parser.c (cp_lexer_set_source_position_from_token): EOF has a
2349 location too.
2350
2351 2020-05-07 Iain Sandoe <iain@sandoe.co.uk>
2352
2353 PR c++/94817
2354 PR c++/94829
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
2361 transform fails.
2362
2363 2020-05-07 Marek Polacek <polacek@redhat.com>
2364
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.
2369
2370 2020-05-07 Marek Polacek <polacek@redhat.com>
2371
2372 PR c++/94255
2373 * parser.c (cp_parser_class_specifier_1): Check that the scope is
2374 nested inside current scope before pushing it.
2375
2376 2020-05-07 Marek Polacek <polacek@redhat.com>
2377
2378 P1957R2
2379 * typeck2.c (check_narrowing): Consider T* to bool narrowing
2380 in C++11 and up.
2381
2382 2020-05-07 Marek Polacek <polacek@redhat.com>
2383
2384 * decl.c (grok_op_properties): Fix spelling of non-static.
2385 * typeck.c (build_class_member_access_expr): Likewise.
2386
2387 2020-05-07 Richard Biener <rguenther@suse.de>
2388
2389 PR middle-end/94703
2390 * optimize.c (update_cloned_parm): Copy DECL_NOT_GIMPLE_REG_P.
2391
2392 2020-05-06 Marek Polacek <polacek@redhat.com>
2393
2394 PR c++/94938
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
2397 RECURs.
2398
2399 2020-05-06 Jakub Jelinek <jakub@redhat.com>
2400
2401 PR c++/94951
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.
2405
2406 PR c++/94907
2407 * method.c (defaulted_late_check): Don't call synthesize_method
2408 on constexpr sfk_comparison if it has been called on it already.
2409
2410 2020-05-06 Nathan Sidwell <nathan@acm.org>
2411
2412 PR c++/94946
2413 * decl.c (grokdeclarator): Don't splice template attributes in
2414 parm context -- they can apply to the parm.
2415
2416 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
2417
2418 * coroutines.cc: Remove references to n4849 throughout.
2419
2420 2020-05-05 Jason Merrill <jason@redhat.com>
2421
2422 CWG 2235
2423 * pt.c (more_specialized_fn): Do consider parms with no deducible
2424 template parameters.
2425
2426 2020-05-05 Jason Merrill <jason@redhat.com>
2427
2428 PR c++/90212
2429 * constexpr.c (potential_constant_expression_1): In a lambda
2430 function, consider a captured variable directly.
2431
2432 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
2433
2434 * coroutines.cc (transform_await_wrapper): Check that we have
2435 no unlowered co_yields.
2436 (captures_temporary): Likewise.
2437 (register_awaits): Likewise.
2438
2439 2020-05-05 Nathan Sidwell <nathan@acm.org>
2440
2441 PR c++/94807
2442 * coroutines.cc (morph_fn_to_coro): Just check for
2443 closure_identifier.
2444 * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name.
2445
2446 2020-05-05 Marek Polacek <polacek@redhat.com>
2447 Jason Merrill <jason@redhat.com>
2448
2449 PR c++/94799
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
2453 a type, use typeof.
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.
2457
2458 2020-05-04 Patrick Palka <ppalka@redhat.com>
2459
2460 PR c++/94038
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.
2467
2468 2020-05-04 Iain Sandoe <iain@sandoe.co.uk>
2469
2470 * coroutines.cc (morph_fn_to_coro): Mark the coro.gro variable
2471 as artificial and ignored.
2472
2473 2020-05-04 Nathan Sidwell <nathan@acm.org>
2474
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
2478 and a push.
2479
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
2484 the requirement.
2485 (diagnose_nested_requirement): TYPE directly holds notmalized
2486 requirement.
2487
2488 2020-05-01 Patrick Palka <ppalka@redhat.com>
2489
2490 PR c++/90880
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.
2501
2502 2020-05-01 Marek Polacek <polacek@redhat.com>
2503
2504 PR c++/94885
2505 * typeck2.c (process_init_constructor_record): Return PICFLAG_ERRONEOUS
2506 if an initializer element was erroneous.
2507
2508 2020-05-01 Jason Merrill <jason@redhat.com>
2509
2510 PR c++/90479
2511 * init.c (get_nsdmi): Don't push_to_top_level for a local class.
2512
2513 2020-05-01 Jason Merrill <jason@redhat.com>
2514
2515 PR c++/91529
2516 * decl.c (cp_finish_decl): Also clear TREE_READONLY if
2517 -fmerge-all-constants.
2518
2519 2020-05-01 Jason Merrill <jason@redhat.com>
2520
2521 PR c++/93822
2522 * pt.c (tsubst_decl): Make sure DECL_VALUE_EXPR continues to have
2523 the same type as the variable.
2524
2525 2020-04-30 Jason Merrill <jason@redhat.com>
2526 Nathan Sidwell <nathan@acm.org>
2527
2528 PR c++/94827
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.
2534
2535 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2536
2537 PR c++/94886
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.
2541
2542 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2543
2544 PR c++/94883
2545 * coroutines.cc (register_awaits): Update target
2546 expressions for awaitable and suspend handle
2547 initializers.
2548
2549 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2550
2551 PR c++/94879
2552 * coroutines.cc (build_co_await): Account for variables
2553 with DECL_VALUE_EXPRs.
2554 (captures_temporary): Likewise.
2555 (register_awaits): Likewise.
2556
2557 2020-04-29 Patrick Palka <ppalka@redhat.com>
2558
2559 PR c++/94830
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.
2564
2565 2020-04-29 Jakub Jelinek <jakub@redhat.com>
2566
2567 PR target/94707
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.
2572
2573 2020-04-29 Patrick Palka <ppalka@redhat.com>
2574
2575 PR c++/94819
2576 * constraint.cc (satisfy_declaration_constraints): Use saved_t
2577 instead of t as the key to decl_satisfied_cache.
2578
2579 PR c++/94808
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.
2583
2584 2020-04-28 Jason Merrill <jason@redhat.com>
2585
2586 PR c++/94583
2587 * decl.c (use_eh_spec_block): Check nothrow type after
2588 DECL_DEFAULTED_FN.
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.
2593
2594 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
2595
2596 PR c++/94760
2597 * coroutines.cc (instantiate_coro_traits): Pass a reference to
2598 object type rather than a pointer type for 'this', for method
2599 coroutines.
2600 (struct param_info): Add a field to hold that the parm is a lambda
2601 closure pointer.
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.
2605
2606 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
2607
2608 PR c++/94759
2609 * coroutines.cc (coro_promise_type_found_p): Do not
2610 exclude non-classes here (this needs to be handled in the
2611 coroutine header).
2612 (morph_fn_to_coro): Allow for the case where the coroutine
2613 returns void.
2614
2615 2020-04-27 Iain Sandoe <iain@sandoe.co.uk>
2616
2617 PR c++/94701
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.
2623
2624 2020-04-27 Jason Merrill <jason@redhat.com>
2625
2626 PR c++/90750
2627 PR c++/79585
2628 * decl.c (grokdeclarator): Move dependent attribute to decl.
2629 * decl2.c (splice_template_attributes): No longer static.
2630
2631 2020-04-27 Patrick Palka <ppalka@redhat.com>
2632
2633 PR c++/94772
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'.
2638
2639 2020-04-26 Marek Polacek <polacek@redhat.com>
2640
2641 PR c++/90320
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.
2647
2648 2020-04-26 Iain Sandoe <iain@sandoe.co.uk>
2649
2650 PR c++/94752
2651 * coroutines.cc (morph_fn_to_coro): Ensure that
2652 unnamed function params have a usable and distinct
2653 frame field name.
2654
2655 2020-04-24 Jason Merrill <jason@redhat.com>
2656
2657 PR c++/94583
2658 * decl.c (redeclaration_error_message): Reject defaulted comparison
2659 operator that has been previously declared.
2660
2661 2020-04-25 Patrick Palka <ppalka@redhat.com>
2662
2663 * parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
2664 concepts if the invalid identifier is 'requires'.
2665
2666 2020-04-25 Jakub Jelinek <jakub@redhat.com>
2667
2668 PR c++/94742
2669 * semantics.c (finish_call_expr): When looking if all overloads
2670 are noreturn, use STRIP_TEMPLATE to look through TEMPLATE_DECLs.
2671
2672 2020-04-24 Martin Liska <mliska@suse.cz>
2673
2674 * coroutines.cc: Fix compilation error for release checking
2675 where we miss declaration of ‘coro_body_contains_bind_expr_p’.
2676
2677 2020-04-23 Patrick Palka <ppalka@redhat.com>
2678
2679 * tree.c (zero_init_expr_p): Use uses_template_parms instead of
2680 dependent_type_p.
2681
2682 PR c++/94645
2683 * pt.c (template_class_depth): Walk into the DECL_FRIEND_CONTEXT of a
2684 friend declaration rather than into its CP_DECL_CONTEXT.
2685
2686 2020-04-23 Iain Sandoe <iain@sandoe.co.uk>
2687
2688 PR c++/94288
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
2701 expression.
2702
2703 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
2704
2705 PR translation/94698
2706 * class.c (check_field_decls): Change "define" to "declare" in
2707 -Weffc++ diagnostics.
2708
2709 2020-04-22 Patrick Palka <ppalka@redhat.com>
2710
2711 PR c++/94719
2712 PR c++/94549
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.
2716
2717 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
2718
2719 PR translation/94698
2720 * class.c (check_field_decls): Change "override" to "define" in
2721 -Weffc++ diagnostics.
2722
2723 2020-04-22 Iain Sandoe <iain@sandoe.co.uk>
2724
2725 PR c++/94682
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.
2730
2731 2020-04-22 Jason Merrill <jason@redhat.com>
2732
2733 PR c++/94546
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.
2737
2738 2020-04-22 Martin Sebor <msebor@redhat.com>
2739 Jason Merrill <jason@redhat.com>
2740
2741 PR c++/94510
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.
2752
2753 2020-04-22 Patrick Palka <ppalka@redhat.com>
2754
2755 PR c++/67825
2756 * constraint.cc (diagnose_valid_expression): Check convert_to_void here
2757 as well as in tsubst_valid_expression_requirement.
2758
2759 2020-04-21 Patrick Palka <ppalka@redhat.com>
2760
2761 PR c++/94549
2762 * constraint.cc (satisfy_declaration_constraints): Don't strip the
2763 inherited constructor if it already has template information.
2764
2765 PR c++/94597
2766 * pt.c (any_template_parm_r) <case IDENTIFIER_NODE>: New case. If this
2767 is a conversion operator, visit its TREE_TYPE.
2768
2769 2020-04-21 Nathan Sidwell <nathan@acm.org>
2770
2771 * pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for
2772 error_mark_node.
2773
2774 2020-04-21 Iain Sandoe <iain@sandoe.co.uk>
2775
2776 PR c++/94661
2777 * coroutines.cc (morph_fn_to_coro): Simplify return
2778 value computation.
2779
2780 2020-04-17 Marek Polacek <polacek@redhat.com>
2781
2782 PR c++/94592
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.
2788
2789 2020-04-20 Patrick Palka <ppalka@redhat.com>
2790
2791 PR c++/94628
2792 * cp-tree.h (lss_policy::lss_nop): New enumerator.
2793 * pt.c (local_specialization_stack::local_specialization_stack): Handle
2794 an lss_nop policy.
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.
2800
2801 2020-04-20 Marek Polacek <polacek@redhat.com>
2802
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.
2806
2807 2020-04-20 Marek Polacek <polacek@redhat.com>
2808
2809 * coroutines.cc (captures_temporary): Don't assign the result of
2810 STRIP_NOPS to the same variable.
2811
2812 2020-04-20 Nathan Sidwell <nathan@acm.org>
2813
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.
2818
2819 PR c++/94454 - Expr pack expansion equality
2820 * tree.c (cp_tree_equal) [TEMPLATE_ID_EXPR, default]: Refactor.
2821 [EXPR_PACK_EXPANSION]: Add.
2822
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.
2829
2830 2020-04-18 Patrick Palka <ppalka@redhat.com>
2831
2832 PR c++/94632
2833 * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
2834 comparing_specializations if the parameters' contexts are identical.
2835
2836 PR c++/92187
2837 * pt.c (splice_late_return_type): Propagate cv-qualifiers and
2838 PLACEHOLDER_TYPE_CONSTRAINTS from the original auto node to the new one.
2839
2840 2020-04-17 Patrick Palka <ppalka@redhat.com>
2841
2842 PR c++/94483
2843 * lambda.c (lambda_capture_field_type): Avoid doing auto deduction if
2844 the explicit initializer has parameter packs.
2845
2846 PR c++/88754
2847 * parser.c (cp_parser_check_template_parameters): Before issuing a hard
2848 error, first try simulating an error instead.
2849
2850 2020-04-17 Jakub Jelinek <jakub@redhat.com>
2851
2852 PR other/94629
2853 * call.c (build_conditional_expr_1): Remove redundant assignment to
2854 arg2.
2855
2856 2020-04-16 Patrick Palka <ppalka@redhat.com>
2857
2858 PR c++/94475
2859 * cvt.c (ocp_convert): If the result of scalar_constant_value is
2860 erroneous, ignore it and use the original expression.
2861
2862 2020-04-16 Jakub Jelinek <jakub@redhat.com>
2863
2864 PR c++/94571
2865 * parser.c (cp_parser_simple_declaration): Fix up a pasto in
2866 diagnostics.
2867
2868 2020-04-15 Jakub Jelinek <jakub@redhat.com>
2869
2870 PR c/94593
2871 * parser.c (cp_parser_pragma) <case PRAGMA_OMP_REQUIRES>: Reject
2872 requires directive when not at file or namespace scope.
2873
2874 2020-04-14 Iain Sandoe <iain@sandoe.co.uk>
2875
2876 PR c++/94359
2877 * coroutines.cc (build_actor_fn): Check that the target can
2878 support the resume tailcall before mandating it.
2879
2880 2020-04-14 Patrick Palka <ppalka@redhat.com>
2881
2882 PR c++/85278
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>:
2887 New no-op case.
2888
2889 PR c++/94034
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.
2896
2897 2020-04-13 Marek Polacek <polacek@redhat.com>
2898
2899 PR c++/94588
2900 * name-lookup.c (check_local_shadow): Add an inform call.
2901
2902 2020-04-13 Patrick Palka <ppalka@redhat.com>
2903
2904 PR c++/94521
2905 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
2906 dump_function_decl when printing a function template instantiation as a
2907 scope.
2908
2909 PR c++/94470
2910 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
2911 'pos_hint' to -1.
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.
2915
2916 2020-04-13 Nathan Sidwell <nathan@acm.org>
2917
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.
2925 `
2926 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
2927
2928 PR c++/94528
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.
2940
2941 2020-04-10 Marek Polacek <polacek@redhat.com>
2942
2943 PR c++/94149
2944 * method.c (constructible_expr): In C++20, try using parenthesized
2945 initialization of aggregates to determine the result of
2946 __is_constructible.
2947
2948 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
2949
2950 * coroutines.cc (co_await_expander): Simplify.
2951
2952 2020-04-09 Jason Merrill <jason@redhat.com>
2953
2954 PR c++/94523
2955 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
2956 ctx->object and ctx->global->values first.
2957
2958 2020-04-09 Marek Polacek <polacek@redhat.com>
2959
2960 PR c++/93790
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.
2965
2966 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
2967 Jun Ma <JunMa@linux.alibaba.com>
2968
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.
2972
2973 2020-04-08 Marek Polacek <polacek@redhat.com>
2974
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.
2978
2979 2020-04-08 Martin Liska <mliska@suse.cz>
2980
2981 PR c++/94314
2982 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
2983 (cxx_init_decl_processing): Mark replaceable all implicitly defined
2984 operators.
2985
2986 2020-04-08 Patrick Palka <ppalka@redhat.com>
2987
2988 Core issues 1001 and 1322
2989 PR c++/92010
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.
2994
2995 2020-04-08 Jakub Jelinek <jakub@redhat.com>
2996
2997 PR c++/94325
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.
3002
3003 2020-04-08 Marek Polacek <polacek@redhat.com>
3004
3005 PR c++/94478 - ICE with defaulted comparison operator
3006 * method.c (early_check_defaulted_comparison): Give an error when the
3007 context is null.
3008
3009 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
3010
3011 PR middle-end/94120
3012 * paser.c (cp_parser_oacc_declare): Add check that variables
3013 are declared in the same scope as the directive.
3014
3015 2020-04-07 Jason Merrill <jason@redhat.com>
3016
3017 PR c++/94480
3018 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
3019
3020 PR c++/94481
3021 * parser.c (cp_parser_placeholder_type_specifier): Use
3022 matching_parens.
3023
3024 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
3025
3026 * coroutines.cc (maybe_promote_captured_temps): Ensure that
3027 reference capture placeholder vars are properly declared.
3028
3029 2020-04-07 Patrick Palka <ppalka@redhat.com>
3030
3031 PR c++/90996
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.
3037
3038 2020-04-07 Jakub Jelinek <jakub@redhat.com>
3039
3040 PR c++/94512
3041 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
3042 if cp_parser_omp_master succeeded.
3043
3044 2020-04-06 Jason Merrill <jason@redhat.com>
3045
3046 PR c++/94462
3047 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
3048
3049 2020-04-04 Marek Polacek <polacek@redhat.com>
3050 Jason Merrill <jason@redhat.com>
3051
3052 PR c++/94155 - crash in gimplifier with paren init of aggregates.
3053 * init.c (build_vec_init): Fill in indexes.
3054
3055 2020-04-04 Jason Merrill <jason@redhat.com>
3056
3057 PR c++/91377
3058 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
3059
3060 2020-04-04 Patrick Palka <ppalka@redhat.com>
3061
3062 PR c++/94205
3063 PR c++/79937
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.
3074
3075 PR c++/94219
3076 PR c++/94205
3077 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
3078 support for VECTOR_TYPEs, and optimizations for the common case)
3079 from ...
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.
3090
3091 2020-04-04 Jason Merrill <jason@redhat.com>
3092
3093 PR c++/67825
3094 * constraint.cc (tsubst_valid_expression_requirement): Call
3095 convert_to_void.
3096
3097 2020-04-04 Jason Merrill <jason@redhat.com>
3098
3099 PR c++/94453
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
3102 NON_LVALUE_EXPR.
3103
3104 2020-04-04 Jakub Jelinek <jakub@redhat.com>
3105
3106 PR debug/94441
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.
3110
3111 PR c++/94477
3112 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
3113 omp_parallel_combined_clauses.
3114
3115 2020-04-03 Jason Merrill <jason@redhat.com>
3116
3117 PR c++/91966
3118 * pt.c (complex_pack_expansion_r): New.
3119 (complex_alias_template_p): Use it.
3120
3121 2020-03-31 Jason Merrill <jason@redhat.com>
3122
3123 PR c++/94205
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.
3128
3129 2020-03-31 Jason Merrill <jason@redhat.com>
3130
3131 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
3132 local variables.
3133
3134 2020-03-30 Jason Merrill <jason@redhat.com>
3135
3136 PR c++/90711
3137 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
3138 (called_fns_equal): Check DECL_CONTEXT.
3139
3140 2020-03-30 Jakub Jelinek <jakub@redhat.com>
3141
3142 PR c++/94385
3143 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
3144 STATEMENT_CODE_P code.
3145
3146 2020-03-28 Patrick Palka <ppalka@redhat.com>
3147
3148 PR c++/94306
3149 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
3150 "requires {" when "requires requires {" was probably intended.
3151
3152 PR c++/94252
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
3158 default case.
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
3168 check.
3169
3170 * constraint.cc (diagnose_compound_requirement): When diagnosing a
3171 compound requirement, maybe replay the satisfaction failure, subject to
3172 the current diagnosis depth.
3173
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
3181 depth.
3182 (diagnose_valid_expression): When diagnosing a satisfaction failure,
3183 maybe replay the substitution error, subject to the current diagnosis
3184 recursion.
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
3192 function.
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.
3197
3198 2020-03-27 Nathan Sidwell <nathan@acm.org>
3199
3200 PR c++/84733
3201 * name-lookup.c (do_pushdecl): Look through cleanp levels.
3202
3203 2020-03-27 Martin Sebor <msebor@redhat.com>
3204
3205 PR c++/94078
3206 PR c++/93824
3207 PR c++/93810
3208 * cp-tree.h (most_specialized_partial_spec): Declare.
3209 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
3210 from declarations.
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.
3220
3221 2020-03-27 Nathan Sidwell <nathan@acm.org>
3222
3223 PR c++/94257
3224 * name-lookup.c (push_namespace): Triage ambiguous lookups that
3225 contain namespaces.
3226
3227 2020-03-27 Jakub Jelinek <jakub@redhat.com>
3228
3229 PR c++/94326
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.
3233
3234 PR c++/94339
3235 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
3236 operand and creating a new COMPOUND_EXPR if anything changed.
3237
3238 2020-03-26 Marek Polacek <polacek@redhat.com>
3239
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.
3243
3244 2020-03-27 Patrick Palka <ppalka@redhat.com>
3245
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.
3252
3253 2020-03-26 Marek Polacek <polacek@redhat.com>
3254
3255 DR 1710
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.
3263
3264 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
3265
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.
3285
3286 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
3287
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-
3298 throw them.
3299
3300 2020-03-26 Jakub Jelinek <jakub@redhat.com>
3301
3302 PR c++/81349
3303 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
3304 true for all TEMPLATE_DECLs.
3305
3306 PR c++/94272
3307 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
3308
3309 2020-03-25 Patrick Palka <ppalka@redhat.com>
3310
3311 PR c++/94265
3312 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
3313 current condition chain when the if-statement has a non-empty
3314 init-statement.
3315
3316 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
3317
3318 PR c++/94319
3319 * coroutines.cc (captures_temporary): Fix a missing dereference.
3320
3321 2020-03-24 Marek Polacek <polacek@redhat.com>
3322
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.
3325
3326 2020-03-24 Jason Merrill <jason@redhat.com>
3327
3328 PR c++/94186
3329 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
3330 error.
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.
3335
3336 2020-03-24 Jason Merrill <jason@redhat.com>
3337
3338 * pt.c (any_template_parm_r): Look into the type of a non-type
3339 template parm.
3340
3341 2020-03-24 Jason Merrill <jason@redhat.com>
3342
3343 * cp-tree.h (cp_expr): When constructing from an expr and a
3344 location, call protected_set_expr_location.
3345
3346 2020-03-23 Patrick Palka <ppalka@redhat.com>
3347
3348 PR c++/93805
3349 * except.c (maybe_noexcept_warning): Add TODO.
3350 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
3351
3352 2020-03-23 nathans <nathan@acm.org>
3353
3354 PR c++/94044
3355 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
3356 operand.
3357
3358 2020-03-21 Patrick Palka <ppalka@redhat.com>
3359
3360 PR c++/94066
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
3372 CONSTRUCTOR.
3373 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
3374 CONSTRUCTOR returned by lookup_placeholder.
3375
3376 2020-03-20 Patrick Palka <ppalka@redhat.com>
3377
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.
3385
3386 2020-03-19 Jason Merrill <jason@redhat.com>
3387
3388 PR c++/94175
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
3395 is non-null.
3396
3397 2020-03-19 Jakub Jelinek <jakub@redhat.com>
3398
3399 PR c++/93931
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.
3404
3405 2020-03-18 Nathan Sidwell <nathan@acm.org>
3406
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.
3412
3413 2020-03-18 Jakub Jelinek <jakub@redhat.com>
3414
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):
3418 Likewise.
3419 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
3420 * pt.c (append_type_to_template_for_access_check): Likewise.
3421
3422 PR c++/91759
3423 * decl.c (grokfndecl): Restore old diagnostics about deduction
3424 guide declared in different scope if in_namespace is NULL_TREE.
3425
3426 2020-03-17 Jakub Jelinek <jakub@redhat.com>
3427
3428 PR c++/90995
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.
3435
3436 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
3437
3438 PR c++/94197
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.
3442
3443 2020-03-17 Jakub Jelinek <jakub@redhat.com>
3444
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
3447 in a comment.
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.
3452
3453 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
3454
3455 * coroutines.cc (co_await_expander): Fix indentation.
3456
3457 2020-03-14 Jason Merrill <jason@redhat.com>
3458
3459 PR c++/92068
3460 * pt.c (process_partial_specialization): Error rather than crash on
3461 extra pack expansion.
3462
3463 2020-03-14 Jason Merrill <jason@redhat.com>
3464
3465 PR c++/92909
3466 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
3467 DECL_ORIGINAL_TYPE of a typedef.
3468
3469 2020-03-14 Jason Merrill <jason@redhat.com>
3470
3471 PR c++/93248
3472 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
3473 substituting DECL_ARGUMENTS.
3474
3475 2020-03-14 Jakub Jelinek <jakub@redhat.com>
3476
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
3479 literal.
3480
3481 2020-03-13 Patrick Palka <ppalka@redhat.com>
3482
3483 PR c++/67960
3484 * call.c (build_over_call): Use a warning_sentinel to disable
3485 warn_deprecated_decl before calling build_addr_func.
3486
3487 2020-03-12 Jakub Jelinek <jakub@redhat.com>
3488
3489 PR c++/94124
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
3492 nelts.
3493
3494 2020-03-11 Jason Merrill <jason@redhat.com>
3495
3496 PR c++/93907
3497 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
3498 argument.
3499
3500 2020-03-11 Marek Polacek <polacek@redhat.com>
3501 Jason Merrill <jason@redhat.com>
3502
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.
3509
3510 2020-03-10 Marek Polacek <polacek@redhat.com>
3511
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.
3515
3516 2020-03-10 Jason Merrill <jason@redhat.com>
3517
3518 PR c++/93901
3519 * pt.c (maybe_instantiate_noexcept): Always update clones.
3520
3521 2020-03-10 Jason Merrill <jason@redhat.com>
3522
3523 PR c++/93596
3524 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
3525
3526 2020-03-10 Jason Merrill <jason@redhat.com>
3527
3528 PR c++/93922
3529 PR c++/94041
3530 PR c++/52320
3531 PR c++/66139
3532 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
3533 66139: Don't split_nonconstant_init. Remove pre_p parameter.
3534
3535 2020-03-09 Marek Polacek <polacek@redhat.com>
3536
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.
3556
3557 2020-03-09 Jakub Jelinek <jakub@redhat.com>
3558
3559 PR c++/94067
3560 Revert
3561 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
3562
3563 * constexpr.c (cxx_eval_constant_expression): Do not handle
3564 RROTATE_EXPR and LROTATE_EXPR.
3565
3566 2020-03-09 Marek Polacek <polacek@redhat.com>
3567
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.
3571
3572 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
3573
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.
3577
3578 2020-03-08 Patrick Palka <ppalka@redhat.com>
3579
3580 PR c++/93729
3581 * call.c (convert_like_real): Check complain before emitting an error
3582 about binding a bit-field to a reference.
3583
3584 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
3585 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
3586 TYPE_NAME.
3587
3588 2020-03-06 Nathan Sidwell <nathan@acm.org>
3589
3590 PR c++/94027
3591 * mangle.c (find_substitution): Don't call same_type_p on template
3592 args that cannot match.
3593
3594 2020-03-04 Martin Sebor <msebor@redhat.com>
3595
3596 PR c++/90938
3597 * tree.c (type_initializer_zero_p): Fail for structs initialized
3598 with non-structs.
3599
3600 2020-03-04 Jason Merrill <jason@redhat.com>
3601
3602 PR c++/90432
3603 * init.c (perform_member_init): Don't do aggregate initialization of
3604 empty field.
3605 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
3606 initialization of empty field.
3607
3608 2020-03-04 Martin Liska <mliska@suse.cz>
3609
3610 * method.c: Wrap array in ctor with braces in order
3611 to silent clang warnings.
3612
3613 2020-03-03 Jason Merrill <jason@redhat.com>
3614 Marek Polacek <polacek@redhat.com>
3615
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.
3619
3620 2020-03-03 Jakub Jelinek <jakub@redhat.com>
3621
3622 PR c++/93998
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.
3626
3627 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
3628
3629 * coroutines.cc (captures_temporary): Strip component_ref
3630 to its base object.
3631
3632 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
3633
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.
3639
3640 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
3641
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
3648 capture proxies.
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.
3654
3655 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
3656
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
3661 itself.
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.
3666
3667 2020-02-28 Jason Merrill <jason@redhat.com>
3668
3669 Implement P2092R0, Disambiguating Nested-Requirements
3670 * parser.c (cp_parser_requirement_parameter_list): Pass
3671 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
3672
3673 * call.c (build_user_type_conversion_1): Don't look at the second
3674 conversion of a non-viable candidate.
3675
3676 2020-02-28 Jakub Jelinek <jakub@redhat.com>
3677
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.
3681
3682 2020-02-27 Nathan Sidwell <nathan@acm.org>
3683
3684 PR c++/93933
3685 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
3686 cp_tree_equal.
3687 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
3688 * typeck.c (comptypes): Assert we don't get any argument packs.
3689
3690 * class.c (adjust_clone_args): Correct arg-checking assert.
3691 * typeck.c (comptypes): Assert not nulls.
3692
3693 2020-02-26 Marek Polacek <polacek@redhat.com>
3694
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.
3698
3699 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
3700
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.
3713
3714 2020-02-26 Patrick Palka <ppalka@redhat.com>
3715
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
3721 accordingly.
3722 (diagnose_requires_expr): Likewise.
3723 (diagnose_atomic_constraint): Likewise. When printing an atomic
3724 constraint expression, print the instantiated parameter mapping
3725 alongside it.
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.
3729
3730 2020-02-26 Marek Polacek <polacek@redhat.com>
3731
3732 PR c++/93676 - value-init crash in template.
3733 * init.c (build_new_1): Don't call build_vec_init in a template.
3734
3735 2020-02-26 Marek Polacek <polacek@redhat.com>
3736
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.
3742
3743 2020-02-26 Marek Polacek <polacek@redhat.com>
3744
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
3747 field.
3748
3749 2020-02-24 Martin Sebor <msebor@redhat.com>
3750
3751 PR c++/93804
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.
3755
3756 2020-02-24 Marek Polacek <polacek@redhat.com>
3757
3758 PR c++/93869 - ICE with -Wmismatched-tags.
3759 * parser.c (cp_parser_check_class_key): Check class_key earlier.
3760
3761 2020-02-24 Marek Polacek <polacek@redhat.com>
3762
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.
3769
3770 2020-02-24 Jakub Jelinek <jakub@redhat.com>
3771
3772 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
3773 * call.c (build_over_call): Don't evaluate immediate functions in
3774 unevaluated operands.
3775
3776 2020-02-24 Jason Merrill <jason@redhat.com>
3777
3778 P0780R2: Resolve lambda init-capture pack grammar.
3779 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
3780 ...&x=y.
3781
3782 2020-02-22 Marek Polacek <polacek@redhat.com>
3783
3784 PR c++/93882
3785 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
3786
3787 2020-02-21 Martin Sebor <msebor@redhat.com>
3788
3789 PR gcov-profile/93753
3790 * class.c (check_flexarrays): Tighten up a test for potential members
3791 of anonymous structs or unions.
3792
3793 2020-02-20 Martin Sebor <msebor@redhat.com>
3794
3795 PR c++/93801
3796 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
3797
3798 2020-02-20 Martin Liska <mliska@suse.cz>
3799
3800 PR translation/93841
3801 * config/or1k/or1k.opt: Remove superfluous word.
3802 * doc/invoke.texi: Likewise.
3803
3804 2020-02-20 Martin Liska <mliska@suse.cz>
3805
3806 PR translation/93838
3807 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
3808
3809 2020-02-19 Marek Polacek <polacek@redhat.com>
3810
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.
3814
3815 2020-02-15 Marek Polacek <polacek@redhat.com>
3816
3817 PR c++/93710 - poor diagnostic for array initializer.
3818 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
3819 for an error call.
3820
3821 2020-02-15 Jason Merrill <jason@redhat.com>
3822
3823 PR c++/92556
3824 * pt.c (any_template_parm_r): Look into lambda body.
3825
3826 PR c++/92583
3827 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
3828
3829 2020-02-14 Jakub Jelinek <jakub@redhat.com>
3830
3831 PR c++/61414
3832 * class.c (enum_min_precision): Change prec type from int to int &.
3833
3834 PR libstdc++/92906
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
3840 dfloat*_type_node.
3841 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
3842 is disabled for compatibility.
3843
3844 2020-02-13 Jason Merrill <jason@redhat.com>
3845
3846 PR c++/93713
3847 * name-lookup.c (matching_fn_p): A function does not match a
3848 template.
3849
3850 PR c++/93643
3851 PR c++/91476
3852 * tree.c (decl_linkage): Always lk_none for locals.
3853
3854 2020-02-12 Jason Merrill <jason@redhat.com>
3855
3856 PR c++/92583
3857 PR c++/92654
3858 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
3859 * pt.c (find_parameter_packs_r): Not here.
3860
3861 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
3862
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.
3867
3868 2020-02-12 Marek Polacek <polacek@redhat.com>
3869
3870 PR c++/93684 - ICE-on-invalid with broken attribute.
3871 * parser.c (cp_parser_std_attribute): Peek a token first before
3872 consuming it.
3873
3874 2020-02-11 Jason Merrill <jason@redhat.com>
3875
3876 PR c++/93675
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.
3882
3883 2020-02-11 Jason Merrill <jason@redhat.com>
3884
3885 PR c++/93650
3886 PR c++/90691
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.
3890
3891 2020-02-12 Patrick Palka <ppalka@redhat.com>
3892
3893 PR c++/69448
3894 PR c++/80471
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.
3908
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.
3912
3913 2020-02-10 Jakub Jelinek <jakub@redhat.com>
3914
3915 PR other/93641
3916 * error.c (dump_decl_name): Fix up last argument to strncmp.
3917
3918 2020-02-10 Jason Merrill <jason@redhat.com>
3919
3920 PR c++/93618
3921 * tree.c (array_of_unknown_bound_p): New.
3922 * init.c (perform_member_init): Do nothing for flexible arrays.
3923
3924 2020-02-09 Jakub Jelinek <jakub@redhat.com>
3925
3926 PR c++/93633
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
3929 a class type.
3930
3931 2020-02-08 Jason Merrill <jason@redhat.com>
3932
3933 PR c++/90691
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.
3940
3941 PR c++/92852
3942 * constexpr.c (maybe_constant_value): Don't unshare if the cached
3943 value is the same as the argument.
3944
3945 * typeck.c (maybe_warn_about_returning_address_of_local): Add
3946 location parameter.
3947
3948 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
3949 if appropriate.
3950
3951 2020-02-08 Jakub Jelinek <jakub@redhat.com>
3952
3953 PR c++/93549
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.
3959
3960 2020-02-07 Marek Polacek <polacek@redhat.com>
3961
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.
3965
3966 2020-02-06 Jason Merrill <jason@redhat.com>
3967
3968 PR c++/92654
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.
3975
3976 2020-02-06 Jason Merrill <jason@redhat.com>
3977
3978 PR c++/92517
3979 * parser.c (cp_parser_constraint_primary_expression): Do the main
3980 parse non-tentatively.
3981
3982 2020-02-06 Marek Polacek <polacek@redhat.com>
3983
3984 PR c++/93597 - ICE with lambda in operator function.
3985 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
3986
3987 2020-02-05 Jason Merrill <jason@redhat.com>
3988
3989 PR c++/93140
3990 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
3991 handling of TREE_CHAIN for empty pack.
3992
3993 2020-02-05 Jakub Jelinek <jakub@redhat.com>
3994
3995 PR c++/93557
3996 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
3997 prior to passing it to c_build_vec_convert.
3998
3999 2020-02-05 Marek Polacek <polacek@redhat.com>
4000
4001 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
4002 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
4003 TREE_SIDE_EFFECTS.
4004
4005 2020-02-05 Jason Merrill <jason@redhat.com>
4006
4007 PR c++/92593
4008 * decl.c (grokdeclarator): Reject field of current class type even
4009 in a template.
4010
4011 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
4012
4013 * coroutines.cc (maybe_promote_captured_temps): Increase the index
4014 number for temporary variables' name.
4015
4016 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
4017
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.
4021
4022 (co_await_expander): Sink to call_expr if await_resume
4023 is wrapped by indirect_ref.
4024
4025 2020-02-04 Jason Merrill <jason@redhat.com>
4026
4027 PR c++/93551
4028 * constraint.cc (satisfy_declaration_constraints): Check return
4029 value of push_tinst_level.
4030
4031 PR c++/90951
4032 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
4033 elements instead of value-initializing them.
4034
4035 PR c++/86917
4036 * init.c (perform_member_init): Simplify.
4037 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
4038 flexarray.
4039 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
4040
4041 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
4042
4043 * coroutines.cc (find_promise_type): Delete unused forward
4044 declaration.
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.
4048
4049 2020-02-03 Jason Merrill <jason@redhat.com>
4050
4051 PR c++/66477
4052 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
4053 defer loading the value of a reference.
4054
4055 2020-02-03 Jason Merrill <jason@redhat.com>
4056
4057 PR c++/91953
4058 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
4059 empty class type.
4060 [COMPONENT_REF]: A member function reference doesn't use the object
4061 as an rvalue.
4062
4063 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
4064
4065 PR c++/93458
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
4069 missing traits.
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
4072 duplicates.
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
4081 copies.
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.
4084
4085 2020-02-03 Jason Merrill <jason@redhat.com>
4086
4087 PR c++/88256
4088 * cp-gimplify.c (predeclare_vla): New.
4089 (cp_genericize_r) [NOP_EXPR]: Call it.
4090
4091 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
4092
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.
4096
4097 2020-02-02 Marek Polacek <polacek@redhat.com>
4098
4099 PR c++/93530 - ICE on invalid alignas in a template.
4100 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
4101 decl_attributes.
4102
4103 2020-01-31 Jason Merrill <jason@redhat.com>
4104
4105 PR c++/86216
4106 * semantics.c (process_outer_var_ref): Capture VLAs even in
4107 unevaluated context.
4108
4109 PR c++/14179
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.
4115
4116 PR c++/14179
4117 * parser.c (cp_parser_initializer_list): Suppress location wrappers
4118 after 256 elements.
4119
4120 2020-01-29 Jason Merrill <jason@redhat.com>
4121
4122 PR c++/82521
4123 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
4124 the expression was dependent before substitution.
4125
4126 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
4127
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.
4132
4133 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
4134
4135 * coroutines.cc (co_await_expander): Handle type conversion case.
4136
4137 2020-01-29 Jason Merrill <jason@redhat.com>
4138
4139 PR c++/90333
4140 PR c++/89640
4141 PR c++/60503
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
4145 parens.
4146
4147 2020-01-29 Marek Polacek <polacek@redhat.com>
4148
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
4152 arguments.
4153
4154 2020-01-29 Marek Polacek <polacek@redhat.com>
4155
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.
4161
4162 2020-01-29 Jakub Jelinek <jakub@redhat.com>
4163
4164 PR c++/91118
4165 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
4166 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
4167
4168 2020-01-28 Jason Merrill <jason@redhat.com>
4169
4170 PR c++/93442
4171 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
4172
4173 PR c++/93477
4174 PR c++/91476
4175 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
4176
4177 PR c++/90546
4178 * call.c (build_user_type_conversion_1): Allow a template conversion
4179 returning an rvalue reference to bind directly to an lvalue.
4180
4181 PR c++/90731
4182 * decl.c (grokdeclarator): Propagate eh spec from typedef.
4183
4184 2020-01-28 Martin Liska <mliska@suse.cz>
4185
4186 PR c++/92440
4187 * pt.c (redeclare_class_template): Group couple of
4188 errors and inform messages with auto_diagnostic_group.
4189
4190 2020-01-28 Martin Liska <mliska@suse.cz>
4191
4192 PR c++/92440
4193 * pt.c (redeclare_class_template): Use inform
4194 for the second location.
4195
4196 2020-01-27 Jason Merrill <jason@redhat.com>
4197
4198 PR c++/90966
4199 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
4200
4201 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
4202
4203 PR c++/93443
4204 * coroutines.cc (morph_fn_to_coro): Check the ramp return
4205 value when it is constructed from the 'get return object'.
4206
4207 2020-01-27 Nathan Sidwell <nathan@acm.org>
4208
4209 PR c++/91826
4210 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
4211
4212 2020-01-26 Jason Merrill <jason@redhat.com>
4213
4214 PR c++/90992
4215 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
4216 temporarily enable -Wsystem-headers. Change second warning to
4217 conditional inform.
4218
4219 PR c++/90997
4220 * semantics.c (finish_call_expr): Don't call
4221 instantiate_non_dependent_expr before warn_for_memset.
4222
4223 2020-01-25 Marek Polacek <polacek@redhat.com>
4224
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.
4228
4229 2020-01-24 Jason Merrill <jason@redhat.com>
4230
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.
4237
4238 2020-01-24 Jason Merrill <jason@redhat.com>
4239
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.
4243
4244 2020-01-24 Jason Merrill <jason@redhat.com>
4245
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.
4249
4250 2020-01-24 Marek Polacek <polacek@redhat.com>
4251
4252 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
4253 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
4254
4255 2020-01-24 Jason Merrill <jason@redhat.com>
4256
4257 PR c++/92852 - ICE with generic lambda and reference var.
4258 * constexpr.c (maybe_constant_value): Likewise.
4259
4260 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
4261
4262 PR c++/92804
4263 * parser.c (cp_parser_nested_name_specifier_opt): Properly
4264 diagnose concept-ids.
4265
4266 2020-01-23 Jason Merrill <jason@redhat.com>
4267
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.
4271
4272 PR c++/93345 - ICE with defaulted dtor and template.
4273 PR c++/33799
4274 * decl.c (cxx_maybe_build_cleanup): Don't try to set
4275 throwing_cleanup in a template.
4276
4277 2020-01-22 Marek Polacek <polacek@redhat.com>
4278
4279 PR c++/92907 - noexcept does not consider "const" in member functions.
4280 * g++.dg/cpp0x/noexcept56.C: New test.
4281
4282 2020-01-22 Marek Polacek <polacek@redhat.com>
4283
4284 PR c++/93324 - ICE with -Wall on constexpr if.
4285 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
4286
4287 2020-01-22 Patrick Palka <ppalka@redhat.com>
4288
4289 * constraint.cc (get_mapped_args): Avoid using auto_vec
4290 as a vector element. Release the vectors inside the lists
4291 vector.
4292 * parser.c (cp_literal_operator_id): Free the buffer.
4293
4294 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
4295
4296 * coroutines.cc (finish_co_await_expr): Add error check on return
4297 value of build_co_await.
4298 (finish_co_yield_expr,): Ditto.
4299
4300 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
4301
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.
4305
4306 2020-01-21 Jason Merrill <jason@redhat.com>
4307
4308 PR c++/60855 - ICE with sizeof VLA capture.
4309 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
4310
4311 PR c++/90732 - ICE with VLA capture and generic lambda.
4312 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
4313
4314 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
4315 Bin Cheng <bin.cheng@linux.alibaba.com>
4316
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.
4323
4324 2020-01-21 Jason Merrill <jason@redhat.com>
4325
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.
4331
4332 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
4333
4334 * coroutines.cc (finish_co_await_expr): Set return value flag.
4335 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
4336
4337 2020-01-19 Jason Merrill <jason@redhat.com>
4338
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.
4348
4349 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
4350
4351 2020-01-18 Jakub Jelinek <jakub@redhat.com>
4352
4353 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
4354 but non-NO_DOLLAR_IN_LABEL case build.
4355
4356 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
4357
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
4362 is set,
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
4389 CO_RETURN_EXPRs.
4390 * tree.c (cp_walk_subtrees): Likewise.
4391
4392 2020-01-17 Jason Merrill <jason@redhat.com>
4393
4394 PR c++/92531 - ICE with noexcept(lambda).
4395 * pt.c (uses_template_parms): Don't try to enumerate all the
4396 expression cases.
4397
4398 2020-01-17 Jakub Jelinek <jakub@redhat.com>
4399
4400 PR c++/93228
4401 * parser.c (cp_parser_template_name): Look up deprecated attribute
4402 in DECL_TEMPLATE_RESULT or its type's attributes.
4403
4404 2020-01-16 Jason Merrill <jason@redhat.com>
4405
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.
4409
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.
4413
4414 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4415
4416 PR c++/91073
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*
4420 instead of a bool.
4421 (cp_parser_condition): Update call.
4422 (cp_parser_simple_declaration): Likewise.
4423 (cp_parser_placeholder_type_specifier): Correctly handle
4424 concept-check expressions.
4425
4426 2020-01-15 Jason Merrill <jason@redhat.com>
4427
4428 Revert
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.
4433
4434 PR c++/93257 - consteval void function.
4435 * constexpr.c (verify_constant): Allow void_node.
4436
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.
4440
4441 2020-01-14 Nathan Sidwell <nathan@acm.org>
4442
4443 PR c++/90916
4444 * pt.c (retrieve_specialization): Use get_template_info, not open
4445 coding access.
4446
4447 PR c++/90916
4448 * pt.c (retrieve_specialization): Get the TI from the decl or the
4449 classtype as appropriate.
4450
4451 2020-01-14 David Malcolm <dmalcolm@redhat.com>
4452
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.
4458
4459 2020-01-14 Jason Merrill <jason@redhat.com>
4460
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.
4464 Revert:
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.
4474
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.
4478
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
4482 REINTERPRET_CAST_P.
4483
4484 2020-01-13 Jason Merrill <jason@redhat.com>
4485
4486 PR c++/92746 - ICE with noexcept of function concept check.
4487 * except.c (check_noexcept_r): Handle concept-check.
4488
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.
4494
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.
4499
4500 PR c++/93238 - short right-shift with enum.
4501 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
4502
4503 2020-01-10 Jason Merrill <jason@redhat.com>
4504
4505 * typeck.c (cp_build_binary_op): Restore short_shift code.
4506
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.
4510
4511 PR c++/93173 - incorrect tree sharing.
4512 PR c++/93033
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.
4516
4517 2020-01-08 Jason Merrill <jason@redhat.com>
4518
4519 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
4520 TARGET_EXPR_DIRECT_INIT_P.
4521 * constexpr.c (cxx_eval_constant_expression): Likewise.
4522
4523 2020-01-08 Jason Merrill <jason@redhat.com>
4524
4525 PR c++/91369 - constexpr destructor and member initializer.
4526 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
4527 when not preevaluating.
4528
4529 2020-01-08 Jason Merrill <jason@redhat.com>
4530
4531 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
4532 support.
4533
4534 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
4535
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.
4541
4542 2020-01-07 Jason Merrill <jason@redhat.com>
4543
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.
4547
4548 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
4549
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.
4553
4554 2020-01-07 Jakub Jelinek <jakub@redhat.com>
4555
4556 PR c++/91369
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.
4563
4564 2020-01-06 Jason Merrill <jason@redhat.com>
4565
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.
4570
4571 2020-01-06 Andrew Sutton <asutton@lock3software.com>
4572
4573 PR c++/92739 - parsing requires clause with attributes.
4574 * parser.c (cp_parser_constraint_requires_parens): Exclude
4575 attributes as postfix expressions.
4576
4577 2020-01-05 Jakub Jelinek <jakub@redhat.com>
4578
4579 PR c++/93138
4580 * parser.c (cp_parser_check_class_key): Disable access checks for the
4581 simple name lookup.
4582 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
4583 !warn_redundant_tags.
4584
4585 2010-01-05 Jakub Jelinek <jakub@redhat.com>
4586
4587 PR c++/93046
4588 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
4589 TARGET_EXPR if it has been gimplified already.
4590
4591 2020-01-03 Jason Merrill <jason@redhat.com>
4592
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.
4596
4597 2020-01-02 Jason Merrill <jason@redhat.com>
4598
4599 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
4600 C++17.
4601
4602 2020-01-02 Jakub Jelinek <jakub@redhat.com>
4603
4604 PR c/90677
4605 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
4606 has not been found, rather than error_mark_node.
4607
4608 2020-01-01 Jakub Jelinek <jakub@redhat.com>
4609
4610 Update copyright years.
4611 \f
4612 Copyright (C) 2020 Free Software Foundation, Inc.
4613
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.