Daily bump.
[gcc.git] / gcc / cp / ChangeLog
1 2020-10-23 Marek Polacek <polacek@redhat.com>
2
3 PR c++/91741
4 * typeck.c (cp_build_binary_op): Implement -Wsizeof-array-div.
5
6 2020-10-22 Patrick Palka <ppalka@redhat.com>
7
8 PR c++/97328
9 * constexpr.c (init_subob_ctx): Don't punt on RANGE_EXPR
10 indexes, instead build a sub-aggregate initialization context
11 with no subobject.
12
13 2020-10-22 Patrick Palka <ppalka@redhat.com>
14
15 PR c++/96575
16 * constexpr.c (cxx_eval_constant_expression)
17 <case EMPTY_CLASS_EXPR>: Lower it to a CONSTRUCTOR.
18 (potential_constant_expression_1) <case COMPOUND_EXPR>: Remove
19 now-redundant handling of COMPOUND_EXPR with EMPTY_CLASS_EXPR
20 second operand.
21 <case EMPTY_CLASS_EXPR>: Return true instead of false.
22
23 2020-10-22 Patrick Palka <ppalka@redhat.com>
24
25 PR c++/97511
26 * decl.c (duplicate_decls): Return NULL_TREE if
27 DECL_TEMPLATE_PARM_P differ.
28
29 2020-10-20 Nathan Sidwell <nathan@acm.org>
30
31 * name-lookup.c (push_local_extern_decl_alias): Reconstextualize
32 alias' parm decls. Drop any default args.
33
34 2020-10-19 Iain Sandoe <iain@sandoe.co.uk>
35
36 PR c++/97438
37 * coroutines.cc (struct coroutine_info): Add a field to
38 record that we emitted a promise type error.
39 (coro_promise_type_found_p): Check for the case that the
40 promise type contains both return_void and return_value.
41 Emit an error if so, with information about the wrong
42 type methods.
43
44 2020-10-16 Nathan Sidwell <nathan@acm.org>
45
46 PR c++/97460
47 * pt.c (push_template_decl): Check DECL_LANG_SPECIFIC in friend
48 case.
49
50 2020-10-16 Nathan Sidwell <nathan@acm.org>
51
52 PR c++/96258
53 * parser.c (cp_parser_declaration): Make token2 point to EOF if
54 token1 was EOF.
55
56 2020-10-15 Jason Merrill <jason@redhat.com>
57
58 PR c++/95844
59 * decl.c (copy_fn_p): Return false for a function that is neither a
60 constructor nor an assignment operator.
61 (move_signature_fn_p): Likewise.
62
63 2020-10-15 Marek Polacek <polacek@redhat.com>
64
65 PR c++/97406
66 PR c++/85901
67 * cxx-pretty-print.c (pp_cxx_type_specifier_seq): Handle OFFSET_TYPE.
68 (cxx_pretty_printer::abstract_declarator): Fix the printing of ')'.
69 (cxx_pretty_printer::direct_abstract_declarator): Handle OFFSET_TYPE.
70 (cxx_pretty_printer::type_id): Likewise. Print the abstract declarator
71 for pointers-to-members.
72
73 2020-10-14 Jason Merrill <jason@redhat.com>
74
75 PR c++/97358
76 * pt.c (check_for_bare_parameter_packs): Diagnose use of
77 capture pack.
78
79 2020-10-14 Nathan Sidwell <nathan@acm.org>
80
81 * cp-tree.h (struct lang_decl_fn): Adjust context comment.
82 (DECL_FRIEND_P): Replace with ...
83 (DECL_UNIQUE_FRIEND_P): ... this. Only for FUNCTION_DECLs.
84 (DECL_FRIEND_CONTEXT): Adjust.
85 * class.c (add_implicitly_declared_members): Detect friendly
86 spaceship from context.
87 * constraint.cc (remove_constraints): Use a checking assert.
88 (maybe_substitute_reqs_for): Use DECL_UNIQUE_FRIEND_P.
89 * decl.c (check_no_redeclaration_friend_default_args):
90 DECL_UNIQUE_FRIEND_P is signficant, not hiddenness.
91 (duplicate_decls): Adjust DECL_UNIQUE_FRIEND_P clearing.
92 (redeclaration_error_message): Use DECL_UNIQUE_FRIEND_P.
93 (start_preparsed_function): Correct in-class friend processing.
94 Refactor some initializers.
95 (grokmethod): Directly check friend decl-spec.
96 * decl2.c (grokfield): Check DECL_UNIQUE_FRIEND_P.
97 * friend.c (do_friend): Set DECL_UNIQUE_FRIEND_P first, remove
98 extraneous conditions. Don't re set it afterwards.
99 * name-lookup.c (lookup_elaborated_type_1): Simplify revealing
100 code.
101 (do_pushtag): Likewise.
102 * pt.c (optimize_specialization_lookup_p): Check
103 DECL_UNIQUE_FRIEND_P.
104 (push_template_decl): Likewise. Drop unneeded friend setting.
105 (type_dependent_expression_p): Check DECL_UNIQUE_FRIEND_P.
106
107 2020-10-14 Nathan Sidwell <nathan@acm.org>
108
109 * name-lookup.c (push_local_extern_decl_alias): Push into alias's
110 namespace and use pushdecl.
111 (do_pushdecl_with_scope): Clarify behaviour.
112
113 2020-10-12 Martin Sebor <msebor@redhat.com>
114
115 PR c++/97201
116 * error.c (dump_type_suffix): Handle both the C and C++ forms of
117 zero-length arrays.
118
119 2020-10-12 Martin Sebor <msebor@redhat.com>
120
121 PR c++/96511
122 PR middle-end/96384
123 * init.c (warn_placement_new_too_small): Call builtin_objsize instead
124 of duplicating what it does.
125
126 2020-10-08 Jason Merrill <jason@redhat.com>
127
128 PR c++/96805
129 PR c++/96199
130 * pt.c (tsubst_aggr_type): Don't build a TYPENAME_TYPE when
131 entering_scope.
132 (tsubst_template_decl): Use tsubst_aggr_type.
133
134 2020-10-08 Patrick Palka <ppalka@redhat.com>
135
136 PR c++/97052
137 * constraint.cc (build_type_constraint): Temporarily increment
138 processing_template_decl before calling build_concept_check.
139 * pt.c (make_constrained_placeholder_type): Likewise.
140
141 2020-10-08 Patrick Palka <ppalka@redhat.com>
142
143 PR c++/96229
144 * parser.c (cp_parser_class_specifier_1): Move call to
145 associate_classtype_constraints from here to ...
146 (cp_parser_class_head): ... here.
147 * pt.c (is_compatible_template_arg): Correct documentation to
148 say "argument is _no_ more constrained than the parameter".
149
150 2020-10-07 Marek Polacek <polacek@redhat.com>
151
152 PR c++/97010
153 * pt.c (tsubst_copy_and_build) <case TEMPLATE_ID_EXPR>: Call
154 tsubst_copy_and_build explicitly instead of using the RECUR macro.
155 Handle a TEMPLATE_ID_EXPR with an IDENTIFIER_NODE as its operand.
156 <case CALL_EXPR>: Perform ADL for a TEMPLATE_ID_EXPR with an
157 IDENTIFIER_NODE as its operand.
158
159 2020-10-07 Patrick Palka <ppalka@redhat.com>
160
161 PR c++/88115
162 PR libstdc++/97273
163 * tree.c (cp_tree_equal) <case ALIGNOF_EXPR>: Return false if
164 ALIGNOF_EXPR_STD_P differ.
165
166 2020-10-07 Nathan Sidwell <nathan@acm.org>
167
168 * cp-tree.h (struct language_function): Delete extern_decl_map.
169 (DECL_LOCAL_DECL_ALIAS): New.
170 * name-lookup.h (is_local_extern): Delete.
171 * name-lookup.c (set_local_extern_decl_linkage): Replace with ...
172 (push_local_extern_decl): ... this new function.
173 (do_pushdecl): Call new function after pushing new decl. Unhide
174 hidden non-functions.
175 (is_local_extern): Delete.
176 * decl.c (layout_var_decl): Do not allow VLA local externs.
177 * decl2.c (mark_used): Also mark DECL_LOCAL_DECL_ALIAS. Drop old
178 local-extern treatment.
179 * parser.c (cp_parser_oacc_declare): Deal with local extern aliases.
180 * pt.c (tsubst_expr): Adjust local extern instantiation.
181 * cp-gimplify.c (cp_genericize_r): Remap DECL_LOCAL_DECLs.
182
183 2020-10-07 Nathan Sidwell <nathan@acm.org>
184
185 * cp-tree.h (DECL_BUILTIN_P): Rename to ...
186 (DECL_UNDECLARED_BUILTIN_P): ... here.
187 * decl.c (duplicate_decls): Adjust.
188 * name-lookup.c (anticipated_builtin_p): Adjust.
189 (do_nonmember_using_decl): Likewise.
190
191 2020-10-07 Nathan Sidwell <nathan@acm.org>
192
193 * tree.c (build_cp_fntype_variant): Clear
194 TYPE_DEPENDENT_P_VALID if necessary.
195
196 2020-10-06 Marek Polacek <polacek@redhat.com>
197
198 PR c++/97297
199 * parser.c (cp_parser_direct_declarator): When checking if a
200 name is a function template declaration for the P0634R3 case,
201 look in uninstantiated templates too.
202
203 2020-10-05 Marek Polacek <polacek@redhat.com>
204
205 * cp-tree.h (NON_UNION_CLASS_TYPE_P): Fix typo in a comment.
206
207 2020-10-05 Richard Biener <rguenther@suse.de>
208 Jakub Jelinek <jakub@redhat.com>
209
210 PR c++/97197
211 * error.c (dump_expr): Handle TARGET_MEM_REF.
212
213 2020-10-05 Nathan Sidwell <nathan@acm.org>
214
215 * name-lookup.c (maybe_add_fuzzy_decl): New.
216 (maybe_add_fuzzy_binding): New.
217 (consider_binding_level): Use intermediate sortable vector for
218 namespace bindings.
219
220 2020-10-02 Marek Polacek <polacek@redhat.com>
221
222 PR c++/97014
223 * cxx-pretty-print.c (pp_cxx_template_argument_list): If the
224 argument is template_parm_object_p, print its DECL_INITIAL.
225
226 2020-10-02 Nathan Sidwell <nathan@acm.org>
227
228 * cp-tree.h (lang_decl_base): anticipated_p is not used for
229 anticipatedness.
230 (DECL_ANTICIPATED): Delete.
231 * decl.c (duplicate_decls): Delete DECL_ANTICIPATED_management,
232 use was_hidden.
233 (cxx_builtin_function): Drop DECL_ANTICIPATED setting.
234 (xref_tag_1): Drop DECL_ANTICIPATED assert.
235 * name-lookup.c (name_lookup::adl_class_only): Drop
236 DECL_ANTICIPATED check.
237 (name_lookup::search_adl): Always dedup.
238 (anticipated_builtin_p): Reimplement.
239 (do_pushdecl): Drop DECL_ANTICIPATED asserts & update.
240 (lookup_elaborated_type_1): Drop DECL_ANTICIPATED update.
241 (do_pushtag): Drop DECL_ANTICIPATED setting.
242 * pt.c (push_template_decl): Likewise.
243 (tsubst_friend_class): Likewise.
244
245 2020-10-02 Nathan Sidwell <nathan@acm.org>
246
247 * name-lookup.c (consider_decl): New, broken out of ...
248 (consider_binding_level): ... here. Iterate the hash table for
249 namespace bindings.
250
251 2020-10-02 Nathan Sidwell <nathan@acm.org>
252
253 * cp-tree.h (base_ctor_omit_inherited_parms): Declare.
254 * class.c (add_method): Refactor main loop, only pass fns to
255 ctor_omit_inherited_parms.
256 (build_cdtor_clones): Rename bool parms.
257 (clone_cdtor): Call base_ctor_omit_inherited_parms.
258 * method.c (base_ctor_omit_inherited_parms): New, broken out of
259 ...
260 (ctor_omit_inherited_parms): ... here, call it with
261 DECL_CLONED_FUNCTION.
262
263 2020-10-02 Nathan Sidwell <nathan@acm.org>
264
265 * cp-tree.h (cp_fname_init): Delete declaration.
266 * decl.c (cp_fname_init): Merge into only caller ...
267 (cp_make_fname): ... here & refactor.
268
269 2020-10-02 Jason Merril <jason@redhat.com>
270
271 * call.c (build_operator_new_call): Set CALL_FROM_NEW_OR_DELETE_P.
272 (build_op_delete_call): Likewise.
273 * init.c (build_new_1, build_vec_delete_1, build_delete): Not here.
274 (build_delete):
275
276 2020-10-02 Jason Merril <jason@redhat.com>
277
278 * lambda.c (call_from_lambda_thunk_p): New.
279 * cp-gimplify.c (cp_genericize_r): Use it.
280 * pt.c (tsubst_copy_and_build): Use it.
281 * typeck.c (check_return_expr): Use it.
282 * cp-tree.h: Declare it.
283 (CALL_FROM_NEW_OR_DELETE_P): Move to gcc/tree.h.
284
285 2020-10-01 Nathan Sidwell <nathan@acm.org>
286
287 * cp-tree.h (DECL_ANTICIPATED): Adjust comment.
288 (DECL_HIDDEN_P, TYPE_HIDDEN_P): Delete.
289 * tree.c (ovl_insert): Delete DECL_HIDDEN_P assert.
290 (ovl_skip_hidden): Likewise.
291
292 2020-10-01 Nathan Sidwell <nathan@acm.org>
293
294 * name-lookup.c (pushdecl_top_level): Assert incoming context is
295 null, add global_namespace context.
296 (pushdecl_top_level_and_finish): Likewise.
297 * pt.c (get_template_parm_object): Clear decl context before
298 pushing.
299 * semantics.c (finish_compound_literal): Likewise.
300
301 2020-10-01 Nathan Sidwell <nathan@acm.org>
302
303 * decl.c (lookup_and_check_tag): Refactor.
304
305 2020-10-01 Jakub Jelinek <jakub@redhat.com>
306
307 PR c++/96994
308 * call.c (build_over_call): If obj_arg is non-NULL, return INIT_EXPR
309 setting obj_arg to call.
310
311 2020-10-01 Jakub Jelinek <jakub@redhat.com>
312
313 PR c++/97195
314 * constexpr.c (cxx_eval_call_expression): Don't VERIFY_CONSTANT the
315 second argument.
316
317 2020-10-01 Marek Polacek <polacek@redhat.com>
318
319 PR c++/90210
320 * pt.c (do_class_deduction): Don't prune explicit deduction guides
321 in copy-list-initialization. In copy-list-initialization, if an
322 explicit deduction guide was selected, give an error.
323
324 2020-09-30 Nathan Sidwell <nathan@acm.org>
325
326 * cp-tree.h (struct lang_decl_fn): Remove hidden_friend_p.
327 (DECL_HIDDEN_FRIEND_P): Delete.
328 * call.c (add_function_candidate): Drop assert about anticipated
329 decl.
330 (build_new_op_1): Drop koenig lookup flagging for hidden friend.
331 * decl.c (duplicate_decls): Drop HIDDEN_FRIEND_P updating.
332 * name-lookup.c (do_pushdecl): Likewise.
333 (set_decl_namespace): Discover hiddenness from OVL_HIDDEN_P.
334 * pt.c (check_explicit_specialization): Record found_hidden
335 explicitly.
336
337 2020-09-29 Marek Polacek <polacek@redhat.com>
338
339 PR c++/94695
340 * call.c (ref_conv_binds_directly_p): New function.
341 * cp-tree.h (ref_conv_binds_directly_p): Declare.
342 * parser.c (warn_for_range_copy): New function.
343 (cp_convert_range_for): Call it.
344
345 2020-09-29 Nathan Sidwell <nathan@acm.org>
346
347 * cp-tree.h (ovl_insert): Change final parm to hidden-or-using
348 indicator.
349 * name-lookup.h (HIDDEN_TYPE_BINDING_P): New.
350 (struct cxx_binding): Add type_is_hidden flag.
351 * tree.c (ovl_insert): Change using_p parm to using_or_hidden,
352 adjust.
353 (ovl_skip_hidden): Assert we never see a naked hidden decl.
354 * decl.c (xref_tag_1): Delete unhiding friend from here (moved to
355 lookup_elaborated_type_1).
356 * name-lookup.c (STAT_TYPE_HIDDEN_P, STAT_DECL_HIDDEN_P): New.
357 (name_lookup::search_namespace_only): Check new hidden markers.
358 (cxx_binding_make): Clear HIDDEN_TYPE_BINDING_P.
359 (update_binding): Update new hidden markers.
360 (lookup_name_1): Check HIDDEN_TYPE_BINDING_P and simplify friend
361 ignoring.
362 (lookup_elaborated_type_1): Use new hidden markers. Reveal the
363 decl here.
364
365 2020-09-29 Nathan Sidwell <nathan@acm.org>
366
367 * name-lookup.c (create_local_binding): Do not clear
368 INHERITED_VALUE_BINDING_P here.
369 (name_lookup::process_binding): Move done hidden-decl triage to ...
370 (name_lookup::search_namespace_only): ... here, its only caller.
371 (cxx_binding_make): Clear flags here.
372 (push_binding): Not here.
373 (pop_local_binding): RAII.
374 (update_binding): Refactor.
375 (do_pushdecl): Assert we're never revealing a local binding.
376 (do_pushdecl_with_scope): Directly call do_pushdecl.
377 (get_class_binding): Do not clear LOCAL_BINDING_P here.
378 * pt.c (push_template_decl): Set friend & anticipated before
379 pushing.
380
381 2020-09-29 Nathan Sidwell <nathan@acm.org>
382
383 * name-lookup.c (update_binding): We never meet two implicit
384 typedefs.
385 (do_pushdecl): Adjust set_identifier_type_value_with_scope calls.
386 (set_identifier_type_value_with_scope): Do not update binding in
387 the namespace-case. Assert it is already there.
388
389 2020-09-25 Nathan Sidwell <nathan@acm.org>
390
391 * cp-tree.h (duplicate_decls): Replace 'is_friend' with 'hiding'
392 and add 'was_hidden'.
393 * name-lookup.h (pushdecl_namespace_level): Replace 'is_friend'
394 with 'hiding'.
395 (pushdecl): Likewise.
396 (pushdecl_top_level): Drop is_friend parm.
397 * decl.c (check_no_redeclaration_friend_default_args): Rename parm
398 olddelc_hidden_p.
399 (duplicate_decls): Replace 'is_friend' with 'hiding'
400 and 'was_hidden'. Do minimal adjustments in body.
401 (cxx_builtin_function): Pass 'hiding' to pushdecl.
402 * friend.c (do_friend): Pass 'hiding' to pushdecl.
403 * name-lookup.c (supplement_binding_1): Drop defaulted arg to
404 duplicate_decls.
405 (update_binding): Replace 'is_friend' with 'hiding'. Drop
406 defaulted arg to duplicate_decls.
407 (do_pushdecl): Replace 'is_friend' with 'hiding'. Assert no
408 surprise hidhing. Adjust duplicate_decls calls to inform of old
409 decl's hiddennes.
410 (pushdecl): Replace 'is_friend' with 'hiding'.
411 (set_identifier_type_value_with_scope): Adjust update_binding
412 call.
413 (do_pushdecl_with_scope): Replace 'is_friend' with 'hiding'.
414 (pushdecl_outermost_localscope): Drop default arg to
415 do_pushdecl_with_scope.
416 (pushdecl_namespace_level): Replace 'is_friend' with 'hiding'.
417 (pushdecl_top_level): Drop is_friend parm.
418 * pt.c (register_specialization): Comment duplicate_decls call
419 args.
420 (push_template_decl): Commont pushdecl_namespace_level.
421 (tsubst_friend_function, tsubst_friend_class): Likewise.
422
423 2020-09-25 Nathan Sidwell <nathan@acm.org>
424
425 * name-lookup.h (enum tag_scope): Replace with ...
426 (enum class TAG_how): ... this. Add HIDDEN_FRIEND value.
427 (lookup_type_scope): Replace with ...
428 (lookup_elaborated_type): ... this.
429 (pushtag): Use TAG_how, not tag_scope.
430 * cp-tree.h (xref_tag): Parameter is TAG_how, not tag_scope.
431 * decl.c (lookup_and_check_tag): Likewise. Adjust.
432 (xref_tag_1, xref_tag): Likewise. adjust.
433 (start_enum): Adjust lookup_and_check_tag call.
434 * name-lookup.c (lookup_type_scope_1): Rename to ...
435 (lookup_elaborated_type_1) ... here. Use TAG_how, not tag_scope.
436 (lookup_type_scope): Rename to ...
437 (lookup_elaborated_type): ... here. Use TAG_how, not tag_scope.
438 (do_pushtag): Use TAG_how, not tag_scope. Adjust.
439 (pushtag): Likewise.
440 * parser.c (cp_parser_elaborated_type_specifier): Adjust.
441 (cp_parser_class_head): Likewise.
442
443 2020-09-25 Nathan Sidwell <nathan@acm.org>
444
445 * cp-tree.h (DECL_BUILTIN_P): New.
446 * decl.c (duplicate_decls): Use it. Do not treat omp-udr as a
447 builtin.
448 * name-lookup.c (anticipated_builtin): Use it.
449 (set_decl_context_in_fn): Function-scope OMP UDRs have function context.
450 (do_nonmember_using_decl): Use DECL_BUILTIN_P.
451 * parser.c (cp_parser_omp_declare_reduction): Function-scope OMP
452 UDRs have function context. Assert we never find a valid duplicate.
453 * pt.c (tsubst_expr): Function-scope OMP UDRs have function context.
454
455 2020-09-24 Nathan Sidwell <nathan@acm.org>
456
457 * cp-tree.h (duplicate_decls): Default is_friend to false.
458 (xref_tag): Default tag_scope & tpl_header_p to ts_current & false.
459 (push_template_decl_real): Default is_friend to false. Rename to
460 ...
461 (push_template_decl): ... here. Delete original decl.
462 * name-lookup.h (pushdecl_namespace_level): Default is_friend to
463 false.
464 (pushtag): Default tag_scope to ts_current.
465 * coroutines.cc (morph_fn_to_coro): Drop default args to xref_tag.
466 * decl.c (start_decl): Drop default args to duplicate_decls.
467 (start_enum): Drop default arg to pushtag & xref_tag.
468 (start_preparsed_function): Pass DECL_FRIEND_P to
469 push_template_decl.
470 (grokmethod): Likewise.
471 * friend.c (do_friend): Rename push_template_decl_real calls.
472 * lambda.c (begin_lamnbda_type): Drop default args to xref_tag.
473 (vla_capture_type): Likewise.
474 * name-lookup.c (maybe_process_template_type_declaration): Rename
475 push_template_decl_real call.
476 (pushdecl_top_level_and_finish): Drop default arg to
477 pushdecl_namespace_level.
478 * pt.c (push_template_decl_real): Assert no surprising friend
479 functions. Rename to ...
480 (push_template_decl): ... here. Delete original function.
481 (lookup_template_class_1): Drop default args from pushtag.
482 (instantiate_class_template_1): Likewise.
483 * ptree.c (debug_overload): Print hidden and using markers.
484 * rtti.c (init_rtti_processing): Drop refault args from xref_tag.
485 (build_dynamic_cast_1, tinfo_base_init): Likewise.
486 * semantics.c (begin_class_definition): Drop default args to
487 pushtag.
488
489 2020-09-24 Nathan Sidwell <nathan@acm.org>
490
491 PR c++/97186
492 * pt.c (maybe_instantiate_noexcept): Local externs are never
493 member fns.
494
495 2020-09-23 Nathan Sidwell <nathan@acm.org>
496
497 * name-lookup.h (typedef cxx_binding): Delete tdef.
498 (typedef cp_binding_level): Likewise.
499 (struct cxx_binding): Flags are bools.
500
501 2020-09-23 Nathan Sidwell <nathan@acm.org>
502
503 PR c++/97171
504 * pt.c (tsubst_copy) [FUNCTION_DECL,VAR_DECL]: Retrieve local
505 specialization for DECL_LOCAL_P decls.
506
507 2020-09-22 Patrick Palka <ppalka@redhat.com>
508
509 PR c++/95310
510 * pt.c (corresponding_template_parameter): Define.
511 (keep_template_parm): Use it to adjust the given template
512 parameter to the corresponding in-scope one from ctx_parms.
513
514 2020-09-22 Nathan Sidwell <nathan@acm.org>
515
516 * cp-tree.h (xref_tag_from_type): Don't declare.
517 * decl.c (xref_tag_from_type): Delete.
518 * pt.c (lookup_template_class_1): Erroneously located class
519 definitions just give error_mark, don't try and inject it into the
520 namespace.
521
522 2020-09-22 Jakub Jelinek <jakub@redhat.com>
523
524 PR c++/97145
525 * constexpr.c (cxx_eval_builtin_function_call): Return void_node for
526 calls to __sanitize_ptr_{sub,cmp} builtins.
527
528 2020-09-22 Nathan Sidwell <nathan@acm.org>
529
530 * pt.c (instantiate_class_template_1): Do not repush and unhide
531 injected friend.
532
533 2020-09-21 Marek Polacek <polacek@redhat.com>
534
535 PR c++/90583
536 DR 1722
537 * lambda.c (maybe_add_lambda_conv_op): Mark the conversion function
538 as noexcept.
539
540 2020-09-21 Marek Polacek <polacek@redhat.com>
541
542 * pt.c (deduction_guides_for): Add a bool parameter. Set it.
543 (do_class_deduction): Warn when CTAD succeeds but the type doesn't
544 have any explicit deduction guides.
545
546 2020-09-21 Nathan Sidwell <nathan@acm.org>
547
548 * decl.c (xref_tag_1): Use IDENTIFIER_LAMBDA_P to detect lambdas.
549 * lambda.c (begin_lambda_type): Use ts_current to push the tag.
550 * name-lookup.h (enum tag_scope): Drop ts_lambda.
551
552 2020-09-21 Marek Polacek <polacek@redhat.com>
553
554 PR c++/97099
555 * decl.c (redeclaration_error_message): Detect a redeclaration of
556 deduction guides.
557
558 2020-09-19 Sandra Loosemore <sandra@codesourcery.com>
559
560 * cp-gimplify.c (enum bc_t, bc_label): Move to c-family.
561 (begin_bc_block, finish_bc_block, get_bc_label): Likewise.
562 (genericize_cp_loop): Likewise.
563 (genericize_for_stmt, genericize_while_stmt): Likewise.
564 (genericize_do_stmt, genericize_switch_stmt): Likewise.
565 (genericize_continue_stmt, genericize_break_stmt): Likewise.
566 (genericize_omp_for_stmt): Likewise.
567 (cp_genericize_r): Call c_genericize_control_stmt instead of
568 above functions directly.
569 (cp_genericize): Call save_bc_state and restore_bc_state instead
570 of manipulating bc_label directly.
571 * cp-objcp-common.c (cxx_block_may_fallthru): Defer to
572 c_block_may_fallthru instead of handling SWITCH_STMT here.
573 (cp_common_init_ts): Move handling of loop and switch-related
574 statements to c-family.
575 * cp-tree.def (FOR_STMT, WHILE_STMT, DO_STMT): Move to c-family.
576 (BREAK_STMT, CONTINUE_STMT, SWITCH_STMT): Likewise.
577 * cp-tree.h (LABEL_DECL_BREAK, LABEL_DECL_CONTINUE): Likewise.
578 (WHILE_COND, WHILE_BODY): Likewise.
579 (DO_COND, DO_BODY): Likewise.
580 (FOR_INIT_STMT, FOR_COND, FOR_EXPR, FOR_BODY, FOR_SCOPE): Likewise.
581 (SWITCH_STMT_COND, SWITCH_STMT_BODY): Likewise.
582 (SWITCH_STMT_TYPE, SWITCH_STMT_SCOPE): Likewise.
583 (SWITCH_STMT_ALL_CASES_P, SWITCH_STMT_NO_BREAK_P): Likewise.
584 * cxx-pretty-print.c (cxx_pretty_printer::statement): Move code
585 to handle structured loop and switch tree nodes to c-family.
586 * dump.c (cp_dump_tree): Likewise.
587
588 2020-09-19 Patrick Palka <ppalka@redhat.com>
589
590 PR c++/96531
591 PR c++/97103
592 * constraint.cc (map_arguments): Call template_parm_to_arg
593 in the self-mapping case.
594 (finish_shorthand_constraint): No need to build a TREE_LIST
595 before calling template_parm_to_arg.
596 * pt.c (template_parm_to_arg): Rewrite to handle TEMPLATE_PARM_P
597 nodes as well as DECL_TEMPLATE_PARM_P nodes, and to make the
598 overlying TREE_LIST node optional.
599 (keep_template_parm): Don't record a BOUND_TEMPLATE_TEMPLATE_PARM,
600 instead record its corresponding TEMPLATE_TEMPLATE_PARM.
601 (convert_generic_types_to_packs): Don't call
602 template_parm_to_arg.
603
604 2020-09-19 Patrick Palka <ppalka@redhat.com>
605
606 PR c++/97051
607 * constraint.cc (satisfy_atom): Pass true as the
608 manifestly_const_eval argument to maybe_constant_value.
609
610 2020-09-18 Jason Merrill <jason@redhat.com>
611
612 PR bootstrap/97118
613 * decl.c (complete_vars): Only call layout_var_decl if completing
614 the type succeeded.
615
616 2020-09-18 Jason Merrill <jason@redhat.com>
617
618 * decl.c (complete_vars): Call layout_var_decl.
619
620 2020-09-17 Patrick Palka <ppalka@redhat.com>
621
622 PR c++/96409
623 PR c++/96410
624 * constraint.cc (tsubst_requires_expr): Use REQUIRES_EXPR_PARMS
625 and REQUIRES_EXPR_REQS. Use REQUIRES_EXPR_EXTRA_ARGS,
626 add_extra_args and build_extra_args to defer substitution until
627 we have all the template arguments.
628 (finish_requires_expr): Adjust the call to build_min so that
629 REQUIRES_EXPR_EXTRA_ARGS gets set to NULL_TREE.
630 * cp-tree.def (REQUIRES_EXPR): Give it a third operand.
631 * cp-tree.h (REQUIRES_EXPR_PARMS, REQUIRES_EXPR_REQS,
632 REQUIRES_EXPR_EXTRA_ARGS): Define.
633 (add_extra_args, build_extra_args): Declare.
634
635 2020-09-16 Nathan Sidwell <nathan@acm.org>
636
637 * cp-tree.h (cp_check_omp_declare_reduction): Return bool.
638 * semantics.c (cp_check_omp_declare_reduction): Return true on for
639 success.
640 * pt.c (push_template_decl_real): OMP reductions do not get a
641 template header.
642 (tsubst_function_decl): Remove special casing for local decl omp
643 reductions.
644 (tsubst_expr): Call instantiate_body for a local omp reduction.
645 (instantiate_body): Add nested_p parm, and deal with such
646 instantiations.
647 (instantiate_decl): Reject FUNCTION_SCOPE entities, adjust
648 instantiate_body call.
649
650 2020-09-16 Nathan Sidwell <nathan@acm.org>
651
652 * pt.c (instantiate_body): Remove 'nested' var, simplify
653 push_to_top logic.
654
655 2020-09-16 Nathan Sidwell <nathan@acm.org>
656
657 * pt.c (instantiate_body): New, broken out of ..
658 (instantiate_decl): ... here. Call it.
659
660 2020-09-15 Nathan Sidwell <nathan@acm.org>
661
662 * pt.c (push_template_decl_real): OMP reductions retain a template
663 header.
664 (tsubst_function_decl): Likewise.
665
666 2020-09-15 Tobias Burnus <tobias@codesourcery.com>
667
668 PR fortran/96668
669 * cp-gimplify.c (cxx_omp_finish_clause): Add bool openacc arg.
670 * cp-tree.h (cxx_omp_finish_clause): Likewise
671 * semantics.c (handle_omp_for_class_iterator): Update call.
672
673 2020-09-14 Marek Polacek <polacek@redhat.com>
674
675 * pt.c (push_template_decl_real): Use VAR_OR_FUNCTION_DECL_P.
676
677 2020-09-14 Nathan Sidwell <nathan@acm.org>
678
679 * pt.c (push_template_decl_real): Don't attach a template head to
680 local externs.
681 (tsubst_function_decl): Add support for headless local extern
682 decls.
683 (tsubst_decl): Add support for headless local extern decls.
684
685 2020-09-11 Nathan Sidwell <nathan@acm.org>
686
687 * decl.c (grokfndecl): Don't attach to local extern.
688
689 2020-09-11 Nathan Sidwell <nathan@acm.org>
690
691 * parser.c (cp_parser_objc_method_definition_list): Reimplement
692 loop, make sure we pop scope.
693
694 2020-09-11 Marek Polacek <polacek@redhat.com>
695
696 * cp-tree.h (LOOKUP_CONSTINIT): Remove.
697 (LOOKUP_REWRITTEN): Adjust.
698 * decl.c (duplicate_decls): Set DECL_DECLARED_CONSTINIT_P.
699 (check_initializer): Use DECL_DECLARED_CONSTINIT_P instead of
700 LOOKUP_CONSTINIT.
701 (cp_finish_decl): Don't set DECL_DECLARED_CONSTINIT_P. Use
702 DECL_DECLARED_CONSTINIT_P instead of LOOKUP_CONSTINIT.
703 (grokdeclarator): Set DECL_DECLARED_CONSTINIT_P.
704 * decl2.c (grokfield): Don't handle LOOKUP_CONSTINIT.
705 * parser.c (cp_parser_decomposition_declaration): Remove
706 LOOKUP_CONSTINIT handling.
707 (cp_parser_init_declarator): Likewise.
708 * pt.c (tsubst_expr): Likewise.
709 (instantiate_decl): Likewise.
710 * typeck2.c (store_init_value): Use DECL_DECLARED_CONSTINIT_P instead
711 of LOOKUP_CONSTINIT.
712
713 2020-09-10 Nathan Sidwell <nathan@acm.org>
714
715 * cp-tree.h (TINFO_VAR_DECLARED_CONSTINIT): Replace with ...
716 (DECL_DECLARED_CONSTINIT_P): ... this.
717 * decl.c (start_decl): No need to retrofit_lang_decl for constinit
718 flag.
719 (cp_finish_decl): Use DECL_DECLARED_CONSTINIT_P.
720 * pt.c (tsubst_decl): No need to handle constinit flag
721 propagation.
722 (tsubst_expr): Or here.
723
724 2020-09-10 Nathan Sidwell <nathan@acm.org>
725
726 * cp-tree.h (DECL_LOCAL_FUNCTION_P): Rename to ...
727 (DECL_LOCAL_DECL_P): ... here. Accept both fns and vars.
728 * decl.c (start_decl): Set DECL_LOCAL_DECL_P for local externs.
729 (omp_declare_variant_finalize_one): Use DECL_LOCAL_DECL_P.
730 (local_variable_p): Simplify.
731 * name-lookup.c (set_decl_context_in_fn): Assert DECL_LOCAL_DECL_P
732 is as expected. Simplify.
733 (do_pushdecl): Don't set decl_context_in_fn for friends.
734 (is_local_extern): Simplify.
735 * call.c (equal_functions): Use DECL_LOCAL_DECL_P.
736 * parser.c (cp_parser_postfix_expression): Likewise.
737 (cp_parser_omp_declare_reduction): Likewise.
738 * pt.c (check_default_tmpl_args): Likewise.
739 (tsubst_expr): Assert nested reduction function is local.
740 (type_dependent_expression_p): Use DECL_LOCAL_DECL_P.
741 * semantics.c (finish_call_expr): Likewise.
742
743 2020-09-09 Marek Polacek <polacek@redhat.com>
744
745 PR c++/77841
746 * decl.c (reshape_init): If we're initializing a char array from
747 a string-literal that is enclosed in braces, unwrap it.
748 * init.c (build_new_1): Don't handle string-initializers here.
749 (build_new): Handle new-expression with paren-init when the
750 array bound is known. Always pass string constants to build_new_1
751 enclosed in braces. Don't handle string-initializers in any
752 special way.
753
754 2020-09-09 Marek Polacek <polacek@redhat.com>
755
756 PR c++/95164
757 * decl.c (reshape_init_r): When initializing an aggregate member
758 with an initializer from an initializer-list, also consider
759 COMPOUND_LITERAL_P.
760
761 2020-09-09 Nathan Sidwell <nathan@acm.org>
762
763 * parser.c (cp_parser_omp_declare_reduction): Refactor to avoid
764 code duplication. Update DECL_TI_TEMPLATE's context.
765 * pt.c (tsubst_expr): For OMP reduction function, set context to
766 global_namespace before pushing.
767 (tsubst_omp_udr): Assert current_function_decl, add comment about
768 decl context.
769
770 2020-09-09 Patrick Palka <ppalka@redhat.com>
771
772 PR c++/96647
773 * class.c (resolve_address_of_overloaded_function): Check
774 constraints_satisfied_p and perform return-type deduction via
775 maybe_instantiate_decl when considering non-template functions
776 in the overload set.
777 * cp-tree.h (maybe_instantiate_decl): Declare.
778 * decl2.c (maybe_instantiate_decl): Remove static.
779
780 2020-09-04 Jason Merrill <jason@redhat.com>
781
782 * expr.c (mark_use): Use iloc_sentinel.
783
784 2020-09-03 Jakub Jelinek <jakub@redhat.com>
785
786 PR c++/96901
787 * constexpr.c (fundef_copies_table): Change type from
788 hash_map<tree, tree> * to decl_tree_map *.
789
790 2020-09-03 Marek Polacek <polacek@redhat.com>
791
792 PR c++/92812
793 * cp-tree.h (do_aggregate_paren_init): Declare.
794 * decl.c (do_aggregate_paren_init): New.
795 (grok_reference_init): Use it.
796 (check_initializer): Likewise.
797 * init.c (perform_member_init): Handle initializing an array from
798 a ()-list. Use do_aggregate_paren_init.
799
800 2020-09-03 Jakub Jelinek <jakub@redhat.com>
801
802 PR c++/96862
803 * constexpr.c (cxx_eval_outermost_constant_expr): Temporarily disable
804 flag_rounding_math during manifestly constant evaluation.
805
806 2020-09-01 Marek Polacek <polacek@redhat.com>
807
808 PR c++/77841
809 * init.c (build_new_1): Call reshape_init.
810
811 2020-09-01 Jakub Jelinek <jakub@redhat.com>
812
813 PR c++/96867
814 * semantics.c (handle_omp_array_sections_1): Test
815 DECL_ARRAY_PARAMETER_P only on PARM_DECLs.
816
817 2020-08-31 Marek Polacek <polacek@redhat.com>
818 Jason Merrill <jason@redhat.com>
819
820 PR c++/93529
821 * call.c (build_new_method_call_1): Use build_constructor_from_vec
822 instead of build_tree_list_vec + build_constructor_from_list.
823 * init.c (build_new_1): Handle new char[]{"foo"}. Use
824 build_constructor_from_vec instead of build_tree_list_vec +
825 build_constructor_from_list.
826 (build_new): Deduce the array size in new-expression if not
827 present. Handle ()-init. Handle initializing an array from
828 a string literal.
829 * parser.c (cp_parser_new_type_id): Leave [] alone.
830 (cp_parser_direct_new_declarator): Allow [].
831 * pt.c (type_dependent_expression_p): In a NEW_EXPR, consider
832 array types whose dimension has to be deduced type-dependent.
833
834 2020-08-27 Martin Liska <mliska@suse.cz>
835
836 * class.c (build_vtbl_initializer): Set exact argument of a vector
837 growth function to true.
838 * constraint.cc (get_mapped_args): Likewise.
839 * decl.c (cp_maybe_mangle_decomp): Likewise.
840 (cp_finish_decomp): Likewise.
841 * parser.c (cp_parser_omp_for_loop): Likewise.
842 * pt.c (canonical_type_parameter): Likewise.
843 * rtti.c (get_pseudo_ti_init): Likewise.
844
845 2020-08-26 Nathan Sidwell <nathan@acm.org>
846
847 * decl.c (poplevel): A local-binding tree list holds the name in
848 TREE_PURPOSE.
849 * name-lookup.c (update_local_overload): Add id to TREE_PURPOSE.
850 (lookup_name_1): Deal with local-binding error_mark_node marker.
851 (op_unqualified_lookup): Return error_mark_node for 'nothing
852 found'. Retain global binding, check class binding here.
853 (maybe_save_operator_binding): Reimplement to always cache a
854 result.
855 (push_operator_bindings): Deal with 'ignore' marker.
856
857 2020-08-25 Tobias Burnus <tobias@codesourcery.com>
858
859 PR c/96678
860 * semantics.c (handle_omp_array_sections_1): Talk about
861 array function parameter in the error message.
862
863 2020-08-25 Jakub Jelinek <jakub@redhat.com>
864
865 PR c++/96721
866 * cp-tree.h (build_trivial_dtor_call): Add bool argument defaulted
867 to false.
868 * call.c (build_trivial_dtor_call): Add NO_PTR_DEREF argument. If
869 instance is a pointer and NO_PTR_DEREF is true, clobber the pointer
870 rather than what it points to.
871 * semantics.c (finish_call_expr): Call build_trivial_dtor_call with
872 true as NO_PTR_DEREF.
873
874 2020-08-25 Jason Merrill <jason@redhat.com>
875
876 PR c++/95428
877 * optimize.c (populate_clone_array): Revert PR70462 change.
878 (maybe_clone_body): Likewise.
879
880 2020-08-24 Nathan Sidwell <nathan@acm.org>
881
882 * ptree.c (debug_overload): New.
883
884 2020-08-19 Jason Merrill <jason@redhat.com>
885
886 DR 2369
887 * cp-tree.h (push_tinst_level, push_tinst_level_loc): Declare.
888 * constraint.cc (satisfy_declaration_constraints):
889 Use add_outermost_template_args and push_tinst_level.
890 * pt.c (add_outermost_template_args): Handle getting
891 a TEMPLATE_DECL as the first argument.
892 (push_tinst_level, push_tinst_level_loc): No longer static.
893 (fn_type_unification): Check satisfaction before non-dependent
894 conversions.
895
896 2020-08-18 Nathan Sidwell <nathan@acm.org>
897
898 * cp-tree.h (SET_TYPE_TEMPLTE_INFO): Do not deal with ALIAS templates.
899 * pt.c (lookup_template_class_1): Special-case alias template
900 template_info setting.
901
902 2020-08-18 Jason Merrill <jason@redhat.com>
903
904 PR c++/96199
905 * pt.c (tsubst_aggr_type): Rewrite in C++17, too.
906 (maybe_dependent_member_ref): Likewise.
907 (build_deduction_guide): Re-substitute template parms.
908 * cp-tree.h (struct push_nested_class_guard): New.
909 * constraint.cc (get_normalized_constraints_from_decl): Use it.
910
911 2020-08-18 Jason Merrill <jason@redhat.com>
912
913 PR c++/96199
914 * pt.c (maybe_dependent_member_ref): New.
915 (tsubst_copy) [CONST_DECL]: Use it.
916 [VAR_DECL]: Likewise.
917 (tsubst_aggr_type): Handle nested type.
918
919 2020-08-18 Nathan Sidwell <nathan@acm.org>
920
921 * name-lookup.c (qualify_lookup): Drop lambda checking here.
922 Reorder namespace & type checking.
923 (lookup_name_1): Do hidden lambda checking here.
924
925 2020-08-14 Nathan Sidwell <nathan@acm.org>
926
927 * name-lookup.h (lookup_name_real, lookup_name_nonclass): Rename
928 to ...
929 (lookup_name): ... these new overloads.
930 * name-lookup.c (identifier_type_value_1): Rename lookup_name_real
931 call.
932 (lookup_name_real_1): Rename to ...
933 (lookup_name_1): ... here.
934 (lookup_name_real): Rename to ...
935 (lookup_name): ... here. Rename lookup_name_real_1 call.
936 (lookup_name_nonclass): Delete.
937 * call.c (build_operator_new_call): Rename lookup_name_real call.
938 (add_operator_candidates): Likewise.
939 (build_op_delete_call): Rename lookup_name_nonclass call.
940 * parser.c (cp_parser_lookup_name): Likewise.
941 * pt.c (tsubst_friend_class, lookup_init_capture_pack): Likewise.
942 (tsubst_expr): Likewise.
943 * semantics.c (capture_decltype): Likewise.
944
945 2020-08-14 Nathan Sidwell <nathan@acm.org>
946
947 * cp-tree.h (LOOKUP_HIDDEN): Delete.
948 (LOOKUP_PREFER_RVALUE): Adjust initializer.
949 * name-lookup.h (enum class LOOK_want): Add HIDDEN_FRIEND and
950 HIDDEN_LAMBDA flags.
951 (lookup_name_real): Drop flags parm.
952 (lookup_qualified_name): Drop find_hidden parm.
953 * name-lookup.c (class name_lookup): Drop hidden field, adjust
954 ctors.
955 (name_lookup::add_overload): Check want for hiddenness.
956 (name_lookup::process_binding): Likewise.
957 (name_lookup::search_unqualified): Likewise.
958 (identifier_type_value_1): Adjust lookup_name_real call.
959 (set_decl_namespace): Adjust name_lookup ctor.
960 (qualify_lookup): Drop flags parm, use want for hiddenness.
961 (lookup_qualified_name): Drop find_hidden parm.
962 (lookup_name_real_1): Drop flags parm, adjust qualify_lookup
963 calls.
964 (lookup_name_real): Drop flags parm.
965 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real
966 calls.
967 (lookup_type_scope_1): Adjust qualify_lookup calls.
968 * call.c (build_operator_new_call): Adjust lookup_name_real call.
969 (add_operator_candidates): Likewise.
970 * coroutines.cc (morph_fn_to_coro): Adjust lookup_qualified_name
971 call.
972 * parser.c (cp_parser_lookup_name): Adjust lookup_name_real calls.
973 * pt.c (check_explicit_specialization): Adjust
974 lookup_qualified_name call.
975 (deduction_guides_for): Likewise.
976 (tsubst_friend_class): Adjust lookup_name_real call.
977 (lookup_init_capture_pack): Likewise.
978 (tsubst_expr): Likewise, don't look in namespaces.
979 * semantics.c (capture_decltype): Adjust lookup_name_real. Don't
980 look in namespaces.
981
982 2020-08-14 Jason Merrill <jason@redhat.com>
983
984 PR c++/90254
985 PR c++/93711
986 * cp-tree.h (unsafe_return_slot_p): Declare.
987 * call.c (is_base_field_ref): Rename to unsafe_return_slot_p.
988 (build_over_call): Check unsafe_return_slot_p.
989 (build_special_member_call): Likewise.
990 * init.c (expand_default_init): Likewise.
991 * typeck2.c (split_nonconstant_init_1): Likewise.
992
993 2020-08-14 Nathan Sidwell <nathan@acm.org>
994
995 * cp-tree.h (LOOKUP_PREFER_TYPES, LOOKUP_PREFER_NAMESPACES)
996 (LOOKUP_NAMESPACES_ONLY, LOOKUP_TYPES_ONLY)
997 (LOOKUP_QUALIFIERS_ONL): Delete.
998 (LOOKUP_HIDDEN): Adjust.
999 * name-lookup.h (enum class LOOK_want): New.
1000 (operator|, operator&): Overloads for it.
1001 (lookup_name_real): Replace prefer_type & namespaces_only with
1002 LOOK_want parm.
1003 (lookup_qualified_name): Replace prefer_type with LOOK_want.
1004 (lookup_name_prefer_type): Replace with ...
1005 (lookup_name): ... this. New overload with LOOK_want parm.
1006 * name-lookup.c (struct name_lookup): Replace flags with want and
1007 hidden fields. Adjust constructors.
1008 (name_lookyp::add_overload): Correct hidden stripping test. Update
1009 for new LOOK_want type.
1010 (name_lookup::process_binding): Likewise.
1011 (name_lookup::search_unqualified): Use hidden flag.
1012 (identifier_type_value_1): Adjust lookup_name_real call.
1013 (set_decl_namespace): Adjust name_lookup ctor.
1014 (lookup_flags): Delete.
1015 (qualify_lookup): Add LOOK_want parm, adjust.
1016 (lookup_qualified_name): Replace prefer_type parm with LOOK_want.
1017 (lookup_name_real_1): Replace prefer_type and namespaces_only with
1018 LOOK_want parm.
1019 (lookup_name_real): Likewise.
1020 (lookup_name_nonclass, lookup_name): Adjust lookup_name_real call.
1021 (lookup_name_prefer_type): Rename to ...
1022 (lookup_name): ... here. New overload with LOOK_want parm.
1023 (lookup_type_scope_1): Adjust qualify_lookup calls.
1024 * call.c (build_operator_new_call)
1025 (add_operator_candidates): Adjust lookup_name_real calls.
1026 * coroutines.cc (find_coro_traits_template_decl)
1027 (find_coro_handle_template_decl, morph_fn_to_coro): Adjust
1028 lookup_qualified_name calls.
1029 * cp-objcp-common.c (identifier_global_tag): Likewise.
1030 * decl.c (get_tuple_size, get_tuple_decomp_init): Likewise.
1031 (lookup_and_check_tag): Use lookup_name overload.
1032 * parser.c (cp_parser_userdef_numeric_literal): Adjust
1033 lookup_qualified_name call.
1034 (prefer_arg_type): Drop template_mem_access parm, return LOOK_want
1035 value.
1036 (cp_parser_lookup_name): Adjust lookup_member, lookup_name_real
1037 calls.
1038 * pt.c (check_explicit_specialization): Adjust lookup_qualified_name
1039 call.
1040 (tsubst_copy_and_build, tsubst_qualified_name): Likewise
1041 (deduction_guides_for): Likewise.
1042 (tsubst_friend_class): Adjust lookup_name_real call.
1043 (lookup_init_capture, tsubst_expr): Likewise.
1044 * rtti.c (emit_support_tinfos): Adjust lookup_qualified_name call.
1045 * semantics.c (omp_reduction_lookup): Likewise.
1046 (capture_decltype): Adjust lookup_name_real call.
1047
1048 2020-08-13 Nathan Sidwell <nathan@acm.org>
1049
1050 * name-lookup.h (enum class LOOK_where): New.
1051 (operator|, operator&): Overloads for it.
1052 (lookup_name_real): Replace NONCLASS & BLOCK_P parms with WHERE.
1053 * name-lookup.c (identifier_type_value_w): Adjust
1054 lookup_name_real call.
1055 (lookup_name_real_1): Replace NONCLASS and BLOCK_P parameters
1056 with WHERE bitmask. Don't search namespaces if not asked to.
1057 (lookup_name_real): Adjust lookup_name_real_1 call.
1058 (lookup_name_nonclass, lookup_name)
1059 (lookup_name_prefer_type): Likewise.
1060 * call.c (build_operator_new_call)
1061 (add_operator_candidates): Adjust lookup_name_real calls.
1062 * parser.c (cp_parser_lookup_name): Likewise.
1063 * pt.c (tsubst_friend_class, lookup_init_capture_pack)
1064 (tsubst_expr): Likewise.
1065 * semantics.c (capture_decltype): Likewise.
1066
1067 2020-08-13 Marek Polacek <polacek@redhat.com>
1068
1069 PR c++/92812
1070 * typeck.c (build_static_cast_1): Implement P1975R0 by allowing
1071 static_cast to aggregate type.
1072
1073 2020-08-10 Jakub Jelinek <jakub@redhat.com>
1074
1075 PR c++/96497
1076 * constexpr.c (cxx_eval_binary_expression): For SPACESHIP_EXPR, tail
1077 call cxx_eval_constant_expression after genericize_spaceship to avoid
1078 undesirable further VERIFY_CONSTANT.
1079
1080 2020-08-10 Patrick Palka <ppalka@redhat.com>
1081
1082 * pt.c (resolve_overloaded_unification): Drop functions with
1083 unsatisfied constraints.
1084 (resolve_nondeduced_context): Likewise.
1085
1086 2020-08-05 Patrick Palka <ppalka@redhat.com>
1087 Jason Merrill <jason@redhat.com>
1088
1089 PR c++/96282
1090 * constexpr.c (cxx_eval_vec_init_1): Truncate ctx->ctor and
1091 then clear CONSTRUCTOR_NO_CLEARING on each appended element
1092 initializer if we're initializing a previously zero-initialized
1093 array object.
1094
1095 2020-08-04 Marek Polacek <polacek@redhat.com>
1096
1097 PR c++/96082
1098 * parser.c (cp_parser_elaborated_type_specifier): Allow
1099 'template' following ::.
1100
1101 2020-08-04 Nathan Sidwell <nathan@acm.org>
1102
1103 * parser.c (cp_parser_explicit_specialization): Refactor
1104 to avoid leak of num_template_parameter_lists value.
1105
1106 2020-08-04 Patrick Palka <ppalka@redhat.com>
1107
1108 PR c++/94024
1109 * init.c (sort_mem_initializers): Preserve TREE_TYPE of the
1110 member initializer list node.
1111 (emit_mem_initializers): Set input_location when performing each
1112 member initialization.
1113 * parser.c (cp_parser_mem_initializer): Attach the source
1114 location of this initializer to a dummy EMPTY_CLASS_EXPR
1115 within the TREE_TYPE of the list node.
1116 * pt.c (tsubst_initializer_list): Preserve TREE_TYPE of the
1117 member initializer list node.
1118
1119 2020-08-03 Marek Polacek <polacek@redhat.com>
1120
1121 * cp-tree.h (after_nsdmi_defaulted_late_checks): Remove.
1122
1123 2020-08-03 Marek Polacek <polacek@redhat.com>
1124
1125 DR 2032
1126 PR c++/96218
1127 * pt.c (check_default_tmpl_args): Also consider variable
1128 templates.
1129
1130 2020-07-31 Jakub Jelinek <jakub@redhat.com>
1131
1132 PR c++/96182
1133 * decl.c (finish_function): In constexpr functions use for C++14 and
1134 later error instead of warning if no return statement is present and
1135 diagnose it regardless of warn_return_type. Move the warn_return_type
1136 diagnostics earlier in the function.
1137
1138 2020-07-31 Martin Sebor <msebor@redhat.com>
1139
1140 PR c++/96003
1141 * class.c (build_base_path): Set no-warning bit on the synthesized
1142 conditional expression in static_cast.
1143
1144 2020-07-31 Richard Biener <rguenther@suse.de>
1145
1146 PR debug/96383
1147 * cp-objcp-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
1148 Define to c_common_finalize_early_debug.
1149
1150 2020-07-31 Patrick Palka <ppalka@redhat.com>
1151
1152 PR c++/96197
1153 * constexpr.c (cxx_eval_constant_expression) <case CONST_DECL>:
1154 Pass false to decl_constant_value and decl_really_constant_value
1155 so that they don't unshare their result.
1156 * cp-tree.h (decl_constant_value): New declaration with an added
1157 bool parameter.
1158 (decl_really_constant_value): Add bool parameter defaulting to
1159 true to existing declaration.
1160 * init.c (constant_value_1): Add bool parameter which controls
1161 whether to unshare the initializer before returning. Call
1162 unshare_expr at most once.
1163 (scalar_constant_value): Pass true to constant_value_1's new
1164 bool parameter.
1165 (decl_really_constant_value): Add bool parameter and forward it
1166 to constant_value_1.
1167 (decl_constant_value): Likewise, but instead define a new
1168 overload with an added bool parameter.
1169
1170 2020-07-30 Patrick Palka <ppalka@redhat.com>
1171
1172 PR c++/64194
1173 * pt.c (resolve_overloaded_unification): If the function
1174 template specialization has a placeholder return type,
1175 then instantiate it before attempting unification.
1176
1177 2020-07-30 Patrick Palka <ppalka@redhat.com>
1178
1179 PR c++/95486
1180 * pt.c (alias_ctad_tweaks): Call remove_constraints before
1181 calling set_constraints.
1182
1183 2020-07-30 Patrick Palka <ppalka@redhat.com>
1184
1185 PR c++/96106
1186 * pt.c (reduce_template_parm_level): Propagate DECL_VIRTUAL_P
1187 from the original TEMPLATE_PARM_DECL to the new lowered one.
1188
1189 2020-07-30 Patrick Palka <ppalka@redhat.com>
1190
1191 PR c++/96164
1192 * constraint.cc (constraints_satisfied_p): Return true if
1193 !flags_concepts.
1194 * pt.c (do_type_instantiation): Update a paragraph taken from
1195 [temp.explicit] to reflect the latest specification. Don't
1196 instantiate a member with unsatisfied constraints.
1197
1198 2020-07-29 Jason Merrill <jason@redhat.com>
1199
1200 PR c++/91427
1201 * cp-tree.h (IMPLICIT_RVALUE_P): New.
1202 (enum cp_lvalue_kind_flags): Add clk_implicit_rval.
1203 (implicit_rvalue_p, set_implicit_rvalue_p): New.
1204 * call.c (reference_binding): Check clk_implicit_rval.
1205 (build_over_call): Adjust C++20 implicit move.
1206 * coroutines.cc (finish_co_return_stmt): Simplify implicit move.
1207 * except.c (build_throw): Adjust C++20 implicit move.
1208 * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Propagate
1209 IMPLICIT_RVALUE_P.
1210 * tree.c (lvalue_kind): Set clk_implicit_rval.
1211 * typeck.c (treat_lvalue_as_rvalue_p): Overhaul.
1212 (maybe_warn_pessimizing_move): Adjust.
1213 (check_return_expr): Adjust C++20 implicit move.
1214
1215 2020-07-29 Jason Merrill <jason@redhat.com>
1216
1217 PR c++/91212
1218 * call.c (build_over_call): Don't call a const ref
1219 overload for implicit move.
1220
1221 2020-07-28 Nathan Sidwell <nathan@acm.org>
1222
1223 * cp-gimplify.c (cp_genericize_r): Set IMPORTED_DECL's context.
1224 * cp-objcp-common.c (cp_pushdecl): Set decl's context.
1225 * decl.c (grokfndecl): Make DECL_CONTEXT setting clearer.
1226
1227 2020-07-28 Nathan Sidwell <nathan@acm.org>
1228
1229 * class.c (fixup_type_variants): Copy TYPE_SIZE and
1230 TYPE_SIZE_UINIT.
1231 (finish_struct): Call it.
1232
1233 2020-07-28 Nathan Sidwell <nathan@acm.org>
1234
1235 * ptree.c (cxx_print_decl): Better indentation.
1236
1237 2020-07-28 Jakub Jelinek <jakub@redhat.com>
1238 Mark Wielaard <mark@klomp.org>
1239
1240 PR c++/96328
1241 * parser.c (cp_lexer_safe_previous_token): Don't call
1242 cp_lexer_previous_token, instead inline it by hand and return NULL
1243 instead of failing assertion if all previous tokens until the first
1244 one are purged.
1245 (cp_parser_error_1): Optimize - only call cp_lexer_safe_previous_token
1246 if token->type is CPP_NAME. Use cp_lexer_safe_previous_token instead
1247 of cp_lexer_previous_token for the missing_token_desc != RT_NONE
1248 case too.
1249
1250 2020-07-27 Nathan Sidwell <nathan@acm.org>
1251
1252 * cp-tree.h (enum cp_tree_index): Add CPTI_AS_BASE_IDENTIFIER.
1253 (as_base_identifier): Define.
1254 * decl.c (initialize_predifined_identifiers): Initialize as_base
1255 identifier.
1256 * class.c (layout_class_type): Name the as-base type. Zap
1257 NSDMI its fields may have.
1258
1259 2020-07-22 Nathan Sidwell <nathan@acm.org>
1260
1261 * class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.
1262
1263 2020-07-22 Nathan Sidwell <nathan@acm.org>
1264
1265 * typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
1266 apart complex if.
1267 [UNDERLYING_TYPE]: Use an if.
1268 [TYPEOF_TYPE]: New.
1269
1270 2020-07-22 Nathan Sidwell <nathan@acm.org>
1271
1272 * decl.c (decls_match): Move variables into scopes
1273 they're needed in.
1274 (duplicate_decls): Use STRIP_TEMPLATE.
1275 (build_typename_type): Move var decls to their assignments.
1276 (begin_function_body): Likewise.
1277 * decl2.c (get_guard): Likewise.
1278 (mark_used): Use true for truthiness.
1279 * error.c (dump_aggr_type): Hold the decl in a var called
1280 'decl', not 'name'.
1281
1282 2020-07-22 Nathan Sidwell <nathan@acm.org>
1283
1284 * cp-tree.h (struct tree_lambda_expr): Shrink
1285 default_capture_mode & discriminator.
1286
1287 2020-07-22 Nathan Sidwell <nathan@acm.org>
1288
1289 * mangle.c (decl_is_template_id): Rename to ...
1290 (maybe_template_info): ... here. Return the template info,
1291 rather than use a pointer. Adjust all callers.
1292 (find_substitution): Use template_args_equal, rather than
1293 local check.
1294
1295 2020-07-22 Tobias Burnus <tobias@codesourcery.com>
1296
1297 * parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
1298 (cp_parser_omp_critical): Permit hint(0) clause without named critical.
1299 * pt.c (tsubst_expr): Re-check the latter for templates.
1300
1301 2020-07-21 Sunil K Pandey <skpgkp2@gmail.com>
1302
1303 PR target/95237
1304 * decl.c (cp_finish_decl): Call target hook
1305 lower_local_decl_alignment to lower local decl alignment.
1306
1307 2020-07-21 Nathan Sidwell <nathan@acm.org>
1308
1309 * parser.c (cp_lexer_consume_token): Drop PRAGMA_EOL assert.
1310 (cp_parser_skip_to_closing_parenthesis_1): Only pass start token
1311 to pragma skipper if recovering.
1312 (cp_parser_skip_to_pragma_eol): Only purge and change pragma
1313 state when recovering.
1314
1315 2020-07-20 Jason Merrill <jason@redhat.com>
1316
1317 * pt.c (type_dependent_expression_p): A pseudo-dtor can be
1318 dependent.
1319 * semantics.c (finish_call_expr): Use build_trivial_dtor_call for
1320 pseudo-destructor.
1321 (finish_pseudo_destructor_expr): Leave type NULL for dependent arg.
1322
1323 2020-07-20 Jason Merrill <jason@redhat.com>
1324
1325 * mangle.c (write_base_ref): New.
1326 (write_expression): Use it for base field COMPONENT_REFs.
1327 * pt.c (invalid_tparm_referent_p): Canonicalize the type
1328 of array offsets. Allow subobjects.
1329
1330 2020-07-20 Jason Merrill <jason@redhat.com>
1331
1332 * pt.c (collect_ctor_idx_types): Add 'const' when deducing from
1333 a string constant.
1334
1335 2020-07-17 Marek Polacek <polacek@redhat.com>
1336
1337 PR c++/79815
1338 * decl.c (grokdeclarator): Detect cv-qual decltype(auto).
1339 * pt.c (do_auto_deduction): Likewise.
1340
1341 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
1342
1343 PR c++/95591
1344 PR c++/95599
1345 PR c++/95823
1346 PR c++/95824
1347 PR c++/95895
1348 * coroutines.cc (struct coro_ret_data): Delete.
1349 (coro_maybe_expand_co_return): Delete.
1350 (co_return_expander): Delete.
1351 (expand_co_returns): Delete.
1352 (co_await_find_in_subtree): Remove unused name.
1353 (build_actor_fn): Remove unused parm, remove handling
1354 for co_return expansion.
1355 (register_await_info): Demote duplicate info message to a
1356 warning.
1357 (coro_make_frame_entry): Move closer to use site.
1358 (struct susp_frame_data): Add fields for final suspend label
1359 and a flag to indicate await expressions with initializers.
1360 (captures_temporary): Delete.
1361 (register_awaits): Remove unused code, update comments.
1362 (find_any_await): New.
1363 (tmp_target_expr_p): New.
1364 (struct interesting): New.
1365 (find_interesting_subtree): New.
1366 (struct var_nest_node): New.
1367 (flatten_await_stmt): New.
1368 (handle_nested_conditionals): New.
1369 (process_conditional): New.
1370 (replace_statement_captures): Rename to...
1371 (maybe_promote_temps): ... this.
1372 (maybe_promote_captured_temps): Delete.
1373 (analyze_expression_awaits): Check for await expressions with
1374 initializers. Simplify handling for truth-and/or-if.
1375 (expand_one_truth_if): Simplify (map cases that need expansion
1376 to COND_EXPR).
1377 (await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
1378 handling for truth-and/or-if expressions.
1379 (register_local_var_uses): Ensure that we create names in the
1380 implementation namespace.
1381 (morph_fn_to_coro): Add final suspend label to suspend frame
1382 callback data and remove it from the build_actor_fn call.
1383
1384 2020-07-16 Marek Polacek <polacek@redhat.com>
1385
1386 * call.c (convert_like): Remove macro and introduce a new
1387 wrapper instead.
1388 (convert_like_with_context): Likewise.
1389 (convert_like_real): Rename to convert_like.
1390 (convert_like_real_1): Rename to convert_like_internal. Call
1391 convert_like instead of convert_like_real therein.
1392 (perform_direct_initialization_if_possible): Call convert_like
1393 instead of convert_like_real.
1394
1395 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
1396
1397 * coroutines.cc: Correct some spelling errors
1398 in comments.
1399
1400 2020-07-15 Nathan Sidwell <nathan@acm.org>
1401
1402 * parser.c (cp_parser_declaration): Avoid copying tokens.
1403 (cp_parser_block_declaration): RAII token pointer.
1404
1405 2020-07-15 Nathan Sidwell <nathan@acm.org>
1406
1407 * parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
1408 meeting a deferred pragma.
1409 (cp_parser_skip_to_end_of_statement): Likewise.
1410 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
1411 (cp_parser_skip_to_pragma_eol): We should never meet EOF.
1412 (cp_parser_omp_declare_simd): Likewise.
1413 (cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
1414 (pragma_lex): Likewise.
1415
1416 2020-07-14 Marek Polacek <polacek@redhat.com>
1417
1418 PR c++/95789
1419 PR c++/96104
1420 PR c++/96179
1421 * call.c (convert_like_real_1): Renamed from convert_like_real.
1422 (convert_like_real): New wrapper for convert_like_real_1.
1423
1424 2020-07-14 Nathan Sidwell <nathan@acm.org>
1425
1426 * parser.c (cp_lexer_alloc): Do not deal with PCH here.
1427 (cp_lexer_new_main): Deal with PCH here. Store the tokens directly
1428 into the buffer.
1429 (cp_lexer_new_from_tokens): Assert last token isn't purged either.
1430 (cp_lexer_get_preprocessor_token): Change first arg to flags, adjust.
1431 (cp_parser_new): Pass the lexer in, don't create it here.
1432 (cp_parser_translation_unit): Initialize access checks here.
1433 (cp_parser_initial_pragma): First token is provided by caller,
1434 don't deal with PCH stopping here. Adjust error message.
1435 (c_parse_file): Adjust, change error message to avoid C++20 module
1436 confusion.
1437
1438 2020-07-14 Nathan Sidwell <nathan@acm.org>
1439
1440 * ptree.c (cxx_print_type): Add TYPEOF_TYPE and BASES.
1441
1442 2020-07-14 Nathan Sidwell <nathan@acm.org>
1443
1444 * class.c (build_base_field_1): Cache CLASSTYPE_AS_BASE.
1445 (build_self_reference): Rename value -> decl.
1446 (dump_class_hierarchy_1): Cache CLASSTYPE_AS_BASE.
1447
1448 2020-07-14 Marek Polacek <polacek@redhat.com>
1449
1450 PR c++/95820
1451 * decl.c (grokdeclarator) <case cdk_function>: Check also
1452 pointers/references/... to functions.
1453
1454 2020-07-14 Nathan Sidwell <nathan@acm.org>
1455
1456 * cp-tree.h: Correct some tree lang flag comments,
1457 reformat some structure definitions. Note some structure
1458 sizes. Clarify some comments.
1459 (yyungetc): Delete. Not been a thing for some time.
1460 * class.c (copy_fndecl_with_name): Comment.
1461 (check_bases_and_members): Unnecessary {}.
1462 (layout_class_type): Comment.
1463 * cp-tree.def (UNBOUND_CLASS_TEMPLATE): Adjust comment.
1464 * decl.c: Fix some formatting & whitespace issues.
1465 (function_requirements_equivalent_p): Note why
1466 substitutions are needed.
1467 * decl2.c (no_linkage_error): Note that heroics about
1468 'typedef struct { ... };' are no longer needed.
1469 * method.c: Whitespace.
1470 * name-lookup.c: Whitespace.
1471 (add_decl_to_level): Reformat a line.
1472 (print_binding_stack): Mark as DEBUG_FUNCTION.
1473 (has_using_namespace_std_directive_p): Delete comment.
1474 * pt.c: Whitespace
1475 * ptree.c: Whitespace.
1476 * rtti.c: Whitespace & comment.
1477 * tree.c: Comment.
1478 * typeck.c (structural_comptypes): Add comment.
1479
1480 2020-07-13 Nathan Sidwell <nathan@acm.org>
1481
1482 * Make-lang.in (c++.disclean): Likewise.
1483
1484 2020-07-13 Marek Polacek <polacek@redhat.com>
1485
1486 PR c++/96077
1487 * parser.c (cp_parser_enum_specifier): Commit to tentative parse
1488 after we've seen an opening brace.
1489
1490 2020-07-10 Jason Merrill <jason@redhat.com>
1491
1492 * tree.c (structural_type_p): Allow unions.
1493 * mangle.c (write_expression): Express unions with a designator.
1494
1495 2020-07-10 Jason Merrill <jason@redhat.com>
1496
1497 * pt.c (convert_nontype_argument): Handle REAL_TYPE.
1498 (invalid_nontype_parm_type_p): Allow all structural types.
1499 * tree.c (structural_type_p): Use SCALAR_TYPE_P.
1500
1501 2020-07-10 Jason Merrill <jason@redhat.com>
1502
1503 PR c++/96105
1504 PR c++/96052
1505 PR c++/95976
1506 * class.c (check_field_decls): An array of empty classes is not an
1507 empty data member.
1508 (layout_empty_base_or_field): Handle explicit alignment.
1509 Fix union handling.
1510
1511 2020-07-09 Julian Brown <julian@codesourcery.com>
1512 Thomas Schwinge <thomas@codesourcery.com>
1513
1514 PR middle-end/95270
1515 * semantics.c (finish_omp_clauses): Likewise.
1516
1517 2020-07-09 Patrick Palka <ppalka@redhat.com>
1518
1519 PR c++/96132
1520 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
1521 Restore dependent_type_p check that guarded the call to
1522 is_really_empty_class.
1523
1524 2020-07-08 Patrick Palka <ppalka@redhat.com>
1525
1526 PR c++/95497
1527 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
1528 When processing_template_decl, check COMPLETE_TYPE_P before
1529 calling is_really_empty_class. Don't check dependent_type_p.
1530
1531 2020-07-08 Marek Polacek <polacek@redhat.com>
1532
1533 PR c++/96103
1534 * parser.c (cp_parser_decltype): Print error about using decltype(auto)
1535 in C++11. Check that the token following "auto" is ")".
1536
1537 2020-07-07 Patrick Palka <ppalka@redhat.com>
1538
1539 PR c++/95303
1540 * cxx-pretty-print.c (pp_cxx_unqualified_id): Check
1541 PRIMARY_TEMPLATE_P before printing the innermost template
1542 arguments.
1543
1544 2020-07-07 Martin Sebor <msebor@redhat.com>
1545
1546 PR c++/96063
1547 * parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
1548 if warning_at returns nonzero.
1549
1550 2020-07-06 Martin Sebor <msebor@redhat.com>
1551
1552 PR c++/95984
1553 * call.c (build_over_call): Check calls only when tf_warning is set.
1554
1555 2020-07-06 Nathan Sidwell <nathan@acm.org>
1556
1557 * decl.c (push_library_fn): Return the decl pushdecl_toplevel returns.
1558 * except.c (verify_library_fn): Replace with ...
1559 (declare_library_fn_1): ... this fn. Always push the fn.
1560 (declare_library_fn): Call it.
1561 (build_throw): Call declare_library_fn_1.
1562
1563 2020-07-06 Jonathan Wakely <jwakely@redhat.com>
1564
1565 PR c++/96068
1566 * parser.c (cp_parser_toplevel_declaration): Only do pedwarn for
1567 empty-declaration in C++98.
1568
1569 2020-07-02 Jason Merrill <jason@redhat.com>
1570 Jakub Jelinek <jakub@redhat.com>
1571
1572 * decl.c (grokfndecl): Allow consteval virtual.
1573 * search.c (check_final_overrider): Check consteval mismatch.
1574 * constexpr.c (cxx_eval_thunk_call): New.
1575 (cxx_eval_call_expression): Call it.
1576 * cvt.c (cp_get_fndecl_from_callee): Handle FDESC_EXPR.
1577 * decl2.c (mark_vtable_entries): Track vtables with consteval.
1578 (maybe_emit_vtables): Pass consteval_vtables through.
1579 (clear_consteval_vfns): Replace consteval with nullptr.
1580 (c_parse_final_cleanups): Call it.
1581
1582 2020-07-01 Nathan Sidwell <nathan@acm.org>
1583
1584 * class.c (copy_fndecl_with_name): Add additional predicate args, do
1585 not deduce them locally.
1586 (copy_operator_fn): Adjust copy_fndecl_with_name call.
1587 (build_clone): Add vtt and inherited predicate args. Pass through
1588 to copy_fndecl_with_name call.
1589 (build_cdtor_clones): Likewise, pass through to build_clone as
1590 needed.
1591 (build_cdtor): Determine vtt and inherited here.
1592 * cp-tree.h (DECL_NEEDS_CTT_PARM_P): Delete.
1593
1594 2020-06-30 Nathan Sidwell <nathan@acm.org>
1595
1596 * cp-tree.h (copy_fndecl_with_name): Rename to ...
1597 (copy_operatorn_fn): ... this. Change arg type.
1598 (clone_function_decl): Rename to ...
1599 (clone_cdtor): ... this.
1600 * class.c (copy_fndecl_with_name): Make static.
1601 (copy_operator_fn): New wrapper.
1602 (build_clones): Rename to ...
1603 (build_cdtor_clones): ... this.
1604 (clone_function_decl): Rename to ...
1605 (clone_cdtor): ... this. Adjust build_clones calls.
1606 (clone_constructors_and_destructors): Adjust clone_function_decl
1607 calls.
1608 * method.c (implicitly_declare_fn): Adjust copy_fndecl_with_name
1609 call.
1610 (lazily_declare_fn): Adjust clone_function_decl call.
1611 * pt.c (tsubst_function_decl): Likewise.
1612 (instantiate_template_1): Likewise.
1613
1614 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
1615
1616 * coroutines.cc (morph_fn_to_coro): Remove trailing
1617 space in a diagnostic.
1618
1619 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
1620
1621 * coroutines.cc (expand_one_await_expression): Remove
1622 code dealing with initial suspend.
1623 (build_actor_fn): Remove code special-casing initial
1624 and final suspend. Handle the final suspend and marking
1625 of the coroutine as done.
1626 (coro_rewrite_function_body): New.
1627 (bind_expr_find_in_subtree): Remove.
1628 (coro_body_contains_bind_expr_p): Remove.
1629 (morph_fn_to_coro): Split the rewrite of the original
1630 function into coro_rewrite_function_body and call it.
1631
1632 2020-06-29 Marek Polacek <polacek@redhat.com>
1633
1634 PR c++/94553
1635 * decl.c (duplicate_decls): Make sure a concept or a variable
1636 template is unique in its declarative region.
1637
1638 2020-06-29 Marek Polacek <polacek@redhat.com>
1639
1640 PR c++/95568
1641 * pt.c (collect_ctor_idx_types): Use TREE_TYPE.
1642
1643 2020-06-28 Iain Sandoe <iain@sandoe.co.uk>
1644
1645 PR c++/95711
1646 * coroutines.cc (register_local_var_uses): Skip past
1647 namespace decls.
1648
1649 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
1650
1651 PR c++/95736
1652 * coroutines.cc (get_awaitable_var): New helper.
1653 (build_co_await): Check more carefully before
1654 copying an awaitable.
1655 (expand_one_await_expression): No initializer
1656 is required when the awaitable is not a temp.
1657 (register_awaits): Remove handling that is now
1658 completed when the await expression is built.
1659
1660 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
1661
1662 * coroutines.cc (morph_fn_to_coro): Diagnose unavailable
1663 get_return_object_on_allocation_failure.
1664
1665 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
1666
1667 PR c++/95519
1668 * coroutines.cc (struct coroutine_info):Add a field
1669 to hold computed p.return_void expressions.
1670 (coro_build_promise_expression): New.
1671 (get_coroutine_return_void_expr): New.
1672 (finish_co_yield_expr): Build the promise expression
1673 using coro_build_promise_expression.
1674 (finish_co_return_stmt): Likewise.
1675 (build_init_or_final_await): Likewise.
1676 (morph_fn_to_coro): Likewise, for several cases.
1677
1678 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
1679
1680 * coroutines.cc (morph_fn_to_coro): Handle error
1681 returns in building g-r-o-o-a-f expressions.
1682
1683 2020-06-24 Nicholas Krause <xerofoify@gmail.com>
1684
1685 PR c++/95672
1686 * typeck2.c (cxx_incomplete_type_diagnostic): Add missing
1687 TYPE_EXPANSION_PACK check for diagnosing incomplete types in
1688 cxx_incomplete_type_diagnostic.
1689
1690 2020-06-24 Iain Sandoe <iain@sandoe.co.uk>
1691
1692 PR c++/95518
1693 PR c++/95813
1694 * coroutines.cc (act_des_fn): Copy function
1695 attributes onto the outlined coroutine helpers.
1696
1697 2020-06-24 Jason Merrill <jason@redhat.com>
1698
1699 * call.c (build_over_call): Only call build_base_path once.
1700
1701 2020-06-24 Jason Merrill <jason@redhat.com>
1702
1703 PR c++/95719
1704 * call.c (build_over_call): Look up the overrider in base_binfo.
1705 * class.c (lookup_vfn_in_binfo): Look through BINFO_PRIMARY_P.
1706
1707 2020-06-23 Jason Merrill <jason@redhat.com>
1708
1709 PR c++/93976
1710 Implement C++20 P2082R1, Fixing CTAD for aggregates.
1711 * cp-tree.h (TPARMS_PRIMARY_TEMPLATE): Split out from...
1712 (DECL_PRIMARY_TEMPLATE): ...here.
1713 (builtin_guide_p): Declare.
1714 * decl.c (reshape_init_class): Handle bases of a template.
1715 (reshape_init_r): An array with dependent bound takes a single
1716 initializer.
1717 * pt.c (tsubst_default_argument): Shortcut {}.
1718 (unify_pack_expansion): Allow omitted arguments to trailing pack.
1719 (builtin_guide_p): New.
1720 (collect_ctor_idx_types): Give a trailing pack a {} default
1721 argument. Handle arrays better.
1722
1723 2020-06-23 Iain Sandoe <iain@sandoe.co.uk>
1724
1725 PR c++/95477
1726 * coroutines.cc (morph_fn_to_coro): Apply a cleanup to
1727 the get return object when the DTOR is non-trivial.
1728
1729 2020-06-20 Iain Sandoe <iain@sandoe.co.uk>
1730
1731 PR c++/95505
1732 * coroutines.cc (morph_fn_to_coro): Update handling of
1733 get-return-object-on-allocation-fail and diagnose missing
1734 std::nothrow.
1735
1736 2020-06-20 Jason Merrill <jason@redhat.com>
1737
1738 * call.c (joust): Only compare constraints for non-template
1739 candidates with matching parameters.
1740 * pt.c (tsubst_pack_expansion): Fix getting a type parameter
1741 pack.
1742 (more_specialized_fn): Only compare constraints for candidates with
1743 matching parameters.
1744
1745 2020-06-19 Jason Merrill <jason@redhat.com>
1746
1747 * method.c (early_check_defaulted_comparison): Allow defaulting
1748 comparison outside class. Complain if non-member operator isn't a
1749 friend.
1750
1751 2020-06-18 Jason Merrill <jason@redhat.com>
1752
1753 * method.c (early_check_defaulted_comparison): Check for &&.
1754 (build_comparison_op): Allow empty union. Diagnose non-category
1755 type.
1756 (common_comparison_type): Remove handling for non-category type.
1757
1758 2020-06-18 Marek Polacek <polacek@redhat.com>
1759
1760 PR c++/95735
1761 * pt.c (finish_template_variable): Return if
1762 coerce_innermost_template_parms return error_mark_node.
1763
1764 2020-06-18 Marek Polacek <polacek@redhat.com>
1765
1766 PR c++/95728
1767 * pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
1768 if placement is erroneous.
1769
1770 2020-06-17 Jonathan Wakely <jwakely@redhat.com>
1771
1772 PR c++/66159
1773 * parser.c (cp_parser_elaborated_type_specifier): Do not warn
1774 unless in a declaration.
1775
1776 2020-06-17 Jason Merrill <jason@redhat.com>
1777
1778 * cp-tree.h (copy_fndecl_with_name): Declare.
1779 * class.c (copy_fndecl_with_name): Split out from...
1780 (build_clone): ...here.
1781 (add_implicitly_declared_members): Add op== to TYPE_FIELDS.
1782 * method.c (implicitly_declare_fn): Use copy_fndecl_with_name.
1783
1784 2020-06-17 Jason Merrill <jason@redhat.com>
1785
1786 * call.c (build_new_op_1): Don't look for a CALL_EXPR when
1787 calling a consteval function.
1788
1789 2020-06-17 Jason Merrill <jason@redhat.com>
1790
1791 * decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED.
1792 * decl.c (duplicate_decls): Reduce error for delete
1793 after earlier declaration to pedwarn.
1794
1795 2020-06-17 Marek Polacek <polacek@redhat.com>
1796
1797 PR c++/95508
1798 * constexpr.c (maybe_fold_non_dependent_expr): New.
1799 * cp-tree.h (maybe_fold_non_dependent_expr): Declare.
1800 * typeck.c (cp_build_array_ref): Call maybe_fold_non_dependent_expr
1801 instead of maybe_constant_value.
1802
1803 2020-06-16 Marek Polacek <polacek@redhat.com>
1804
1805 PR c++/95369
1806 * call.c (add_list_candidates): Return if a designated initializer
1807 is used with a non-aggregate.
1808 (implicit_conversion_error): Give an error for the case above.
1809
1810 2020-06-16 Marek Polacek <polacek@redhat.com>
1811
1812 PR c++/95560
1813 * name-lookup.c (check_local_shadow): Check if types are
1814 non-null before calling same_type_p.
1815
1816 2020-06-16 Jakub Jelinek <jakub@redhat.com>
1817
1818 * semantics.c (handle_omp_for_class_iterator): Adjust
1819 c_omp_check_loop_iv_exprs caller.
1820 (finish_omp_for): Likewise. Don't call fold_build_cleanup_point_expr
1821 before calling c_finish_omp_for and c_omp_check_loop_iv, move it
1822 after those calls.
1823 * pt.c (tsubst_omp_for_iterator): Handle non-rectangular loops.
1824
1825 2020-06-16 Jakub Jelinek <jakub@redhat.com>
1826
1827 * parser.c (cp_parser_omp_clause_schedule): Reject modifier separated
1828 from kind by comma rather than colon.
1829
1830 2020-06-16 Patrick Palka <ppalka@redhat.com>
1831
1832 * pt.c (perform_instantiation_time_access_checks): No need to
1833 tsubst into decl.
1834 * semantics.c (enforce_access): Verify that decl is not
1835 dependent.
1836
1837 2020-06-16 Patrick Palka <ppalka@redhat.com>
1838
1839 PR c++/41437
1840 PR c++/47346
1841 * cp-tree.h (qualified_typedef_usage_s): Delete.
1842 (qualified_typedef_usage_t): Delete.
1843 (deferred_access_check): Move up in file.
1844 (tree_template_info::typedefs_needing_access_checking): Delete.
1845 (tree_template_info::deferred_access_checks): New field.
1846 (TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Rename to ...
1847 (TI_DEFERRED_ACCESS_CHECKS): ... this, and adjust accordingly.
1848 * pt.c (perform_typedefs_access_check): Rename to ...
1849 (perform_instantiation_time_access_checks): ... this, and adjust
1850 accordingly. Remove unnecessary tree tests.
1851 (instantiate_class_template_1): Adjust accordingly.
1852 (instantiate_decl): Likewise.
1853 * semantics.c (enforce_access): Likewise.
1854
1855 2020-06-16 Patrick Palka <ppalka@redhat.com>
1856
1857 PR c++/41437
1858 PR c++/47346
1859 * call.c (enforce_access): Move to semantics.c.
1860 * cp-tree.h (enforce_access): Delete.
1861 (get_types_needing_access_check): Delete.
1862 (add_typedef_to_current_template_for_access_check): Delete.
1863 * decl.c (make_typename_type): Adjust accordingly. Use
1864 check_accessibility_of_qualified_id instead of directly using
1865 perform_or_defer_access_check.
1866 * parser.c (cp_parser_template_declaration_after_parameters):
1867 Don't push a dk_no_check access state when parsing a template.
1868 * pt.c (get_types_needing_access_check): Delete.
1869 (append_type_to_template_for_access_check_1): Delete.
1870 (perform_typedefs_access_check): Adjust. If type_decl is a
1871 FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
1872 tsubst_copy instead of tsubst to substitute into type_decl so
1873 that we substitute into the DECL_CONTEXT of a FIELD_DECL.
1874 (append_type_to_template_for_access_check): Delete.
1875 * search.c (accessible_p): Remove the processing_template_decl
1876 early exit.
1877 * semantics.c (enforce_access): Moved from call.c. If we're
1878 parsing a template and the access check failed, add the check to
1879 TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
1880 (perform_or_defer_access_check): Adjust comment.
1881 (add_typedef_to_current_template_for_access_check): Delete.
1882 (check_accessibility_of_qualified_id): Adjust accordingly.
1883 Exit early if the scope is dependent.
1884
1885 2020-06-11 Patrick Palka <ppalka@redhat.com>
1886
1887 PR c++/93467
1888 * constraint.cc (associate_classtype_constraints): If there is a
1889 discrepancy between the current template depth and the template
1890 depth of the original declaration, then adjust the template
1891 parameter depth within the current constraints appropriately.
1892 * pt.c (tsubst_friend_class): Substitute into and set the
1893 constraints on the injected declaration.
1894
1895 2020-06-11 Iain Sandoe <iain@sandoe.co.uk>
1896
1897 * coroutines.cc (instantiate_coro_traits): Pass a reference
1898 to lambda closure objects to traits instantiation.
1899 (morph_fn_to_coro): Likewise for promise parameter
1900 preview and allocator lookup.
1901
1902 2020-06-10 Iain Sandoe <iain@sandoe.co.uk>
1903
1904 PR c++/95440
1905 * call.c (add_candidates): Use vec_safe_length() for
1906 testing the arguments list.
1907 (build_new_method_call_1): Use vec_safe_is_empty() when
1908 checking for an empty args list.
1909
1910 2020-06-10 Marek Polacek <polacek@redhat.com>
1911
1912 PR c++/95562
1913 * parser.c (cp_parser_direct_declarator): Clear
1914 CP_PARSER_FLAGS_DELAY_NOEXCEPT if the declarator kind is not
1915 cdk_id.
1916
1917 2020-06-09 Iain Sandoe <iain@sandoe.co.uk>
1918
1919 PR c++/95137
1920 * coroutines.cc (expand_one_await_expression): Build separate
1921 DTOR trees for the awaitable object on the destroy and resume
1922 paths.
1923
1924 2020-06-09 Jason Merrill <jason@redhat.com>
1925
1926 PR c++/95552
1927 * cp-gimplify.c (predeclare_vla): Only predeclare a VLA if it's
1928 wrapped in a pointer type.
1929
1930 2020-06-05 Marek Polacek <polacek@redhat.com>
1931
1932 PR c++/95369
1933 * call.c (build_converted_constant_expr_internal): Allow
1934 list-initialization.
1935
1936 2020-06-05 Iain Sandoe <iain@sandoe.co.uk>
1937
1938 * cp-tree.def (CO_RETURN_EXPR): Correct the class
1939 to use tcc_statement.
1940
1941 2020-06-05 Jason Merrill <jason@redhat.com>
1942
1943 * error.c (dump_binary_op): Handle negative operand to
1944 POINTER_PLUS_EXPR.
1945
1946 2020-06-04 Jason Merrill <jason@redhat.com>
1947
1948 PR c++/93310
1949 * constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
1950 Evaluate OBJ_TYPE_REF_EXPR.
1951
1952 2020-06-04 Jason Merrill <jason@redhat.com>
1953
1954 PR c++/95158
1955 * class.c (lookup_vfn_in_binfo): New.
1956 * call.c (build_over_call): Use it.
1957 * cp-tree.h (resolves_to_fixed_type_p): Add default argument.
1958 (lookup_vfn_in_binfo): Declare.
1959
1960 2020-06-04 Iain Sandoe <iain@sandoe.co.uk>
1961
1962 PR c++/95346
1963 * coroutines.cc (morph_fn_to_coro): Ensure that the get-
1964 return-object is constructed correctly; When it is not the
1965 final return value, pass it to the CTOR of the return type
1966 as an rvalue, per the standard comment.
1967
1968 2020-06-04 Jakub Jelinek <jakub@redhat.com>
1969
1970 PR c++/82304
1971 PR c++/95307
1972 * constexpr.c (cxx_eval_constant_expression): Diagnose CONVERT_EXPR
1973 conversions from pointer types to arithmetic types here...
1974 (cxx_eval_outermost_constant_expr): ... instead of here.
1975
1976 2020-06-03 Mark Wielaard <mark@klomp.org>
1977
1978 * parser.c (cp_lexer_safe_previous_token): New function.
1979 (cp_parser_error_1): Add name_hint if the previous token is
1980 a string literal and next token is a CPP_NAME and we have a
1981 missing header suggestion for the name.
1982
1983 2020-06-03 Patrick Palka <ppalka@redhat.com>
1984
1985 * pt.c (process_partial_specialization): Pass the full set of
1986 generic template arguments to strictly_subsumes.
1987
1988 2020-06-03 Patrick Palka <ppalka@redhat.com>
1989
1990 PR c++/92103
1991 * pt.c (most_specialized_partial_spec): Reorganize the loop over
1992 DECL_TEMPLATE_SPECIALIZATIONS. Check constraints_satisfied_p on
1993 the original template declaration, not on the tsubsted one.
1994
1995 2020-06-03 Iain Sandoe <iain@sandoe.co.uk>
1996
1997 PR c++/95345
1998 * coroutines.cc (finish_co_await_expr): Revise to allow for
1999 parameter packs.
2000 (finish_co_yield_expr): Likewise.
2001
2002 2020-06-03 Jason Merrill <jason@redhat.com>
2003
2004 PR c++/95232
2005 * cp-tree.h (predeclare_vla): Declare.
2006 * cp-gimplify.c (predeclare_vla): Handle getting a decl.
2007 * pt.c (tsubst_expr) [DECL_EXPR]: Use it.
2008
2009 2020-06-03 Tobias Burnus <tobias@codesourcery.com>
2010
2011 * cp-gimplify.c (cxx_omp_predetermined_mapping): New.
2012 * cp-objcp-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redfine.
2013 * cp-tree.h (cxx_omp_predetermined_mapping): Declare.
2014
2015 2020-06-02 Jason Merrill <jason@redhat.com>
2016
2017 PR c++/95193
2018 * pt.c (tsubst_decl): Relax assert.
2019
2020 2020-06-02 Iain Sandoe <iain@sandoe.co.uk>
2021
2022 PR c++/95050
2023 * coroutines.cc (build_co_await): Wrap the co_await expression
2024 in a TARGET_EXPR, where needed.
2025 (finish_co_yield_expr): Likewise.
2026
2027 2020-06-02 Patrick Palka <ppalka@redhat.com>
2028
2029 PR c++/92633
2030 PR c++/92838
2031 * pt.c (tsubst_function_decl): Don't do set_constraints when
2032 regenerating a lambda.
2033 (tsubst_lambda_expr): Substitute into the lambda's constraints
2034 and do set_constraints here.
2035
2036 2020-06-01 Jason Merrill <jason@redhat.com>
2037
2038 PR c++/95466
2039 PR c++/95311
2040 PR c++/95221
2041 * class.c (build_vfn_ref): Revert 95311 change.
2042 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): Build a
2043 COMPOUND_EXPR.
2044
2045 2020-06-01 Iain Sandoe <iain@sandoe.co.uk>
2046
2047 PR c++/95350
2048 * coroutines.cc (struct param_info): Remove rv_ref field.
2049 (build_actor_fn): Remove specifial rvalue ref handling.
2050 (morph_fn_to_coro): Likewise.
2051
2052 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
2053
2054 PR c++/95087
2055 * coroutines.cc (morph_fn_to_coro): If we see an
2056 early fatal error, drop the erroneous function body.
2057
2058 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
2059
2060 * coroutines.cc (build_co_await): Remove unused
2061 variable.
2062 (finish_co_await_expr): Likewise.
2063 (finish_co_yield_expr): Likewise; revise comment.
2064
2065 2020-05-30 Iain Sandoe <iain@sandoe.co.uk>
2066
2067 * coroutines.cc (morph_fn_to_coro): Revise initialization
2068 of the frame pointer to avoid an unused value.
2069
2070 2020-05-30 Patrick Palka <ppalka@redhat.com>
2071
2072 PR c++/95386
2073 * constraint.cc (satisfaction_value): Accept INTEGER_CST of any
2074 boolean type.
2075
2076 2020-05-29 Patrick Palka <ppalka@redhat.com>
2077 Jason Merrill <jason@redhat.com>
2078
2079 PR c++/95181
2080 * class.c (add_method): Let special member function templates
2081 coexist if they are not equivalently constrained, or in a class
2082 template.
2083
2084 2020-05-29 Jason Merrill <jason@redhat.com>
2085
2086 PR c++/95371
2087 * pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
2088 on the DECL_TEMPLATE_RESULT.
2089
2090 2020-05-29 Marek Polacek <polacek@redhat.com>
2091
2092 PR c++/95344
2093 * cp-gimplify.c (cp_fold) <case MODIFY_EXPR>: Don't set
2094 TREE_THIS_VOLATILE here.
2095 (cp_fold): Set it here along with TREE_NO_WARNING.
2096
2097 2020-05-29 Jason Merrill <jason@redhat.com>
2098
2099 PR c++/95311
2100 PR c++/95221
2101 * class.c (build_vfn_ref): Don't fold the INDIRECT_REF.
2102
2103 2020-05-29 Patrick Palka <ppalka@redhat.com>
2104
2105 PR c++/92652
2106 PR c++/93698
2107 PR c++/94128
2108 * parser.c (cp_parser_requires_clause_expression): Temporarily
2109 increment processing_template_decl only if it is 0.
2110 (cp_parser_constraint_expression): Likewise.
2111 (cp_parser_requires_expression): Likewise.
2112
2113 2020-05-29 Patrick Palka <ppalka@redhat.com>
2114
2115 PR c++/95241
2116 * constexpr.c (get_or_insert_ctor_field): Add limited support
2117 for RANGE_EXPR index lookups.
2118
2119 2020-05-28 Jakub Jelinek <jakub@redhat.com>
2120
2121 PR c++/95328
2122 * decl.c (cp_finish_decomp): Call complete_type before checking
2123 COMPLETE_TYPE_P.
2124
2125 2020-05-28 Jason Merrill <jason@redhat.com>
2126
2127 PR c++/94926
2128 * decl.c (cp_finish_decl): Revert r9-297 change.
2129 (check_static_variable_definition): Likewise.
2130 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
2131 * pt.c (instantiate_decl): Return early on type error.
2132
2133 2020-05-27 Jason Merrill <jason@redhat.com>
2134
2135 PR c++/95319
2136 * decl.c (reshape_init_array_1): Don't reuse in overload context.
2137
2138 2020-05-27 Jason Merrill <jason@redhat.com>
2139
2140 PR c++/95242
2141 * call.c (build_new_op_1): Suppress
2142 warn_zero_as_null_pointer_constant across comparison of <=> result
2143 to 0.
2144
2145 2020-05-27 Jason Merrill <jason@redhat.com>
2146
2147 PR c++/95222
2148 * decl.c (grokdeclarator): Don't shift attributes in TYPENAME
2149 context.
2150
2151 2020-05-27 Nathan Sidwell <nathan@acm.org>
2152
2153 PR c++/95263
2154 * pt.c (lookup_template_class_1): Restore alias template mutation.
2155
2156 2020-05-26 Jakub Jelinek <jakub@redhat.com>
2157
2158 PR c++/95197
2159 * cp-gimplify.c: Include omp-general.h.
2160 (cp_genericize_r) <case OMP_DISTRIBUTE>: For class iteration
2161 variables in composite distribute parallel for, instantiate copy
2162 ctor of their types.
2163
2164 2020-05-23 Patrick Palka <ppalka@redhat.com>
2165
2166 PR c++/94038
2167 * constexpr.c (cxx_eval_constant_expression)
2168 <case TEMPLATE_ID_EXPR>: Don't evaluate the concept when
2169 constexpr evaluation is uid-sensitive.
2170
2171 2020-05-22 Jason Merrill <jason@redhat.com>
2172
2173 * cp-gimplify.c (cp_gimplify_expr) [CALL_EXPR]: Don't preevaluate
2174 the function address if the call used operator syntax.
2175
2176 2020-05-21 Jason Merrill <jason@redhat.com>
2177
2178 PR c++/95221
2179 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): For a virtual
2180 call, instrument the OBJ_TYPE_REF.
2181
2182 * decl.c (compute_array_index_type_loc): Diagnose expressions
2183 in a template that can't be constant.
2184 * parser.c (cp_parser_direct_declarator): Don't check
2185 non-constant array bounds here.
2186
2187 * cp-tree.h (is_rvalue_constant_expression): Declare.
2188 * constexpr.c (is_rvalue_constant_expression): New.
2189 * parser.c (cp_parser_constant_expression): Use it.
2190 * decl.c (cp_finish_decl): Try to treat a constexpr initializer in a
2191 template as constant.
2192
2193 * typeck.c (build_x_modify_expr): Handle error_mark_node arguments.
2194
2195 * decl.c (grokparms): Return NULL_TREE if any parms were erroneous.
2196
2197 2020-05-21 Iain Sandoe <iain@sandoe.co.uk>
2198
2199 * coroutines.cc (finish_co_return_stmt): Revert change to use
2200 finish_expr_stmt.
2201
2202 2020-05-21 Patrick Palka <ppalka@redhat.com>
2203
2204 PR c++/94038
2205 * constexpr.c (constexpr_ctx::uid_sensitive): Remove field.
2206 (uid_sensitive_constexpr_evaluation_value): Define.
2207 (uid_sensitive_constexpr_evaluation_true_counter): Define.
2208 (uid_sensitive_constexpr_evaluation_p): Define.
2209 (uid_sensitive_constexpr_evaluation_sentinel): Define its
2210 constructor.
2211 (uid_sensitive_constexpr_evaluation_checker): Define its
2212 constructor and its evaluation_restricted_p method.
2213 (get_fundef_copy): Remove 'ctx' parameter. Use u_s_c_e_p
2214 instead of constexpr_ctx::uid_sensitive.
2215 (cxx_eval_call_expression): Use u_s_c_e_p instead, and test it
2216 last. Adjust call to get_fundef_copy.
2217 (instantiate_cx_fn_r): Test u_s_c_e_p so that we increment the
2218 counter if necessary.
2219 (cxx_eval_outermost_constant_expr): Remove 'uid_sensitive'
2220 parameter. Adjust function body accordingly.
2221 (maybe_constant_value): Remove 'uid_sensitive' parameter and
2222 adjust function body accordingly. Set up a
2223 uid_sensitive_constexpr_evaluation_checker, and use it to
2224 conditionally update the cv_cache.
2225 * cp-gimplify.c (cp_fold): Set up a
2226 uid_sensitive_constexpr_evaluation_checker, and use it to
2227 conditionally update the fold_cache.
2228 * cp-tree.h (maybe_constant_value): Update declaration.
2229 (struct uid_sensitive_constexpr_evaluation_sentinel): Define.
2230 (struct sensitive_constexpr_evaluation_checker): Define.
2231 * expr.c (fold_for_warn): Set up a
2232 uid_sensitive_constexpr_evaluation_sentinel before calling
2233 the folding subroutines. Drop all but the first argument to
2234 maybe_constant_value.
2235
2236 2020-05-20 Marek Polacek <polacek@redhat.com>
2237
2238 DR 2237
2239 * parser.c (cp_parser_unqualified_id): Reject simple-template-id as
2240 the declarator-id of a destructor.
2241 (cp_parser_constructor_declarator_p): Reject simple-template-id as
2242 the declarator-id of a constructor.
2243
2244 2020-05-20 Marek Polacek <polacek@redhat.com>
2245
2246 DR 2289
2247 PR c++/94553
2248 * cp-tree.h (SD_DECOMPOSITION): New flag.
2249 * decl.c (duplicate_decls): Make sure a structured binding is unique
2250 in its declarative region.
2251 (start_decl): If INITIALIZED is SD_DECOMPOSITION, call
2252 fit_decomposition_lang_decl.
2253 (grokdeclarator): Compare INITIALIZED directly to SD_* flags.
2254 * parser.c (cp_parser_decomposition_declaration): Pass SD_DECOMPOSITION
2255 to start_decl.
2256
2257 2020-05-20 Patrick Palka <ppalka@redhat.com>
2258
2259 PR c++/95223
2260 * typeck.c (structural_comptypes): Don't perform
2261 context-dependent resolution of TYPENAME_TYPEs when
2262 comparing_specializations.
2263
2264 2020-05-19 Nathan Sidwell <nathan@acm.org>
2265
2266 * pt.c (lookup_template_class_1): Do not reinit template_info of an
2267 alias here.
2268
2269 2020-05-18 Martin Sebor <msebor@redhat.com>
2270
2271 PR c++/94923
2272 * call.c ((maybe_warn_class_memaccess): Use is_byte_access_type.
2273 * cp-tree.h (is_dummy_object): Return bool.
2274 (is_byte_access_type): Declare new function.
2275 * tree.c (is_dummy_object): Return bool.
2276 (is_byte_access_type): Define new function.
2277
2278 2020-05-19 Patrick Palka <ppalka@redhat.com>
2279
2280 PR c++/87847
2281 * pt.c (init_template_processing): Enable sanitization for
2282 decl_specializations and type_specializations.
2283
2284 PR c++/66439
2285 * pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
2286 the 'in_decl' parameter to coerce_template_parms.
2287
2288 2020-05-18 Marek Polacek <polacek@redhat.com>
2289
2290 PR c++/94955
2291 * typeck.c (cp_build_binary_op): Use fold_for_warn instead of
2292 cp_fold_rvalue.
2293
2294 2020-05-18 Marek Polacek <polacek@redhat.com>
2295
2296 PR c++/94937
2297 * cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
2298 type is not INDIRECT_TYPE_P.
2299 * decl.c (omp_declare_variant_finalize_one): Call
2300 cp_get_callee_fndecl_nofold instead of looking for the function decl
2301 manually.
2302
2303 2020-05-18 Marek Polacek <polacek@redhat.com>
2304
2305 PR c++/90915
2306 * parser.c (cp_parser_has_attribute_expression): Sorry on a
2307 type-dependent argument.
2308
2309 2020-05-18 Marek Polacek <polacek@redhat.com>
2310
2311 DR 1512
2312 PR c++/87699
2313 * call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
2314 operator functions when type is std::nullptr_t for ==/!=.
2315 * typeck.c (composite_pointer_type_r): Add a bool * parameter. Use it
2316 to maybe add "const" to the pointer type.
2317 (composite_pointer_type): Update the call to composite_pointer_type_r.
2318 (cp_build_binary_op): Turn two warning_at into error_at. Print the
2319 types.
2320
2321 2020-05-18 Jason Merrill <jason@redhat.com>
2322
2323 * call.c (build_over_call): Remove unnecessary
2324 cp_stabilize_reference.
2325
2326 2020-05-18 Marek Polacek <polacek@redhat.com>
2327
2328 * call.c (add_builtin_candidate): Don't create a builtin overload
2329 candidate for ++ when type is bool in C++17.
2330
2331 2020-05-18 Marek Polacek <polacek@redhat.com>
2332
2333 * cfns.h: Regenerated.
2334
2335 2020-05-17 Iain Sandoe <iain@sandoe.co.uk>
2336
2337 * coroutines.cc (morph_fn_to_coro): Initialize the gro variable.
2338
2339 2020-05-16 Iain Sandoe <iain@sandoe.co.uk>
2340
2341 * coroutines.cc (finish_co_return_stmt): Implement rules
2342 from [class.copy.elision] /3.
2343
2344 2020-05-16 Patrick Palka <ppalka@redhat.com>
2345
2346 PR c++/57943
2347 * semantics.c (finish_decltype_type): Call
2348 instantiate_non_dependent_expr_sfinae on the expression.
2349
2350 2020-05-15 Patrick Palka <ppalka@redhat.com>
2351
2352 Revert:
2353
2354 2020-04-07 Patrick Palka <ppalka@redhat.com>
2355
2356 PR c++/90996
2357 * typeck2.c (process_init_constructor_array): Propagate
2358 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
2359 the array initializer.
2360
2361 2020-05-15 Jason Merrill <jason@redhat.com>
2362
2363 PR c++/93286 - ICE with __is_constructible and variadic template.
2364 * pt.c (tsubst_tree_list): New.
2365 (tsubst, tsubst_copy_and_build): Use it.
2366 * decl2.c (is_late_template_attribute): Handle error_mark_node args.
2367
2368 2020-05-15 Nathan Sidwell <nathan@acm.org>
2369
2370 * pt.c (template_args_equal): Fix thinkos in previous 'cleanup'.
2371
2372 2020-05-14 Jason Merrill <jason@redhat.com>
2373
2374 PR c++/93901
2375 * pt.c (maybe_instantiate_noexcept): Change clone handling.
2376
2377 2020-05-14 Patrick Palka <ppalka@redhat.com>
2378
2379 PR c++/78446
2380 * call.c (build_op_call): Pass complain to lookup_fnfields.
2381 (build_special_member_call): Likewise.
2382 * class.c (type_requires_array_cookie): Pass tf_warning_or_error
2383 to lookup_fnfields.
2384 * cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter.
2385 * except.c (build_throw): Pass tf_warning_or_error to
2386 lookup_fnfields.
2387 * init.c (build_new_1): Pass complain to lookup_fnfields.
2388 * method.c (locate_fn_flags): Likewise.
2389 * name-lookup.c (lookup_name_real_1): Pass tf_warning_or_error
2390 to lookup_fnfields.
2391 * pt.c (tsubst_baselink): Pass complain to lookup_fnfields.
2392 * search.c (lookup_fnfields): New 'complain' parameter. Pass it
2393 to lookup_member.
2394
2395 2020-05-14 Nathan Sidwell <nathan@acm.org>
2396
2397 * parser.c (cp_parser_diagnose_invalid_typename): Mention
2398 std=c++20 not 2a, reformat dependent binfo inform loops.
2399
2400 * pt.c (tsubst_template_decl): Reorder and commonize some control
2401 paths.
2402
2403 * pt.c (tsubst_friend_function): Simplify control flow.
2404
2405 * pt.c (lookup_template_class_1): Remove unnecessary else by
2406 simply grabbing TYPE_NAME earlier.
2407
2408 * pt.c (push_template_decl_real): Adjust friend pushing logic.
2409 Reinit template type.
2410
2411 * pt.c (build_template_decl): Init DECL_TEMPLATE_RESULT &
2412 TREE_TYPE here ...
2413 (process_partial_specialization): ... not here ...
2414 (push_template_decl_real, add_inherited_template_parms)
2415 (build_deduction_guide): ... or here.
2416
2417 2020-05-14 Jakub Jelinek <jakub@redhat.com>
2418
2419 * cp-gimplify.c (cp_genericize_r): Set cfun->has_omp_target.
2420
2421 2020-05-13 Patrick Palka <ppalka@redhat.com>
2422
2423 PR c++/79706
2424 * init.c (build_vec_delete_1): Just return error_mark_node if
2425 deallocate_expr is error_mark_node.
2426 (build_delete): Just return error_mark_node if do_delete is
2427 error_mark_node.
2428
2429 2020-05-13 Patrick Palka <ppalka@redhat.com>
2430
2431 PR c++/95020
2432 * constraint.cc (tsubst_requires_expr): Produce a new
2433 requires-expression when processing_template_decl, even if
2434 template arguments are not dependent.
2435
2436 2020-05-13 Marek Polacek <polacek@redhat.com>
2437
2438 PR c++/95066
2439 * decl.c (duplicate_decls): Set DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.
2440
2441 2020-05-13 Nathan Sidwell <nathan@acm.org>
2442
2443 * pt.c (template_args_equal): Reorder category checking for
2444 clarity.
2445
2446 * pt.c (perform_typedefs_access_check): Cache expensively
2447 calculated object references.
2448 (check_auto_in_tmpl_args): Just assert we do not get unexpected
2449 nodes, rather than silently do nothing.
2450 (append_type_to_template_for_access): Likewise, cache expensie
2451 object reference.
2452
2453 * pt.c (canonical_type_parameter): Simplify.
2454
2455 Formatting fixups & some simplifications.
2456 * pt.c (spec_hash_table): New typedef.
2457 (decl_specializations, type_specializations): Use it.
2458 (retrieve_specialization): Likewise.
2459 (register_specialization): Remove unnecessary casts.
2460 (push_template_decl_real): Reformat.
2461 (instantiate_class_template_1): Use more RAII.
2462 (make_argument_pack): Simplify.
2463 (instantiate_template_1): Use gcc_checking_assert for expensive
2464 asserts.
2465 (instantiate_decl): Likewise.
2466 (resolve_typename_type): Reformat comment.
2467 * semantics.c (struct deferred_access): Remove unnecessary GTY on
2468 member.
2469 (begin_class_definition): Fix formatting.
2470
2471 2020-05-13 Jason Merrill <jason@redhat.com>
2472
2473 * call.c, class.c, constexpr.c, constraint.cc, decl.c, init.c,
2474 lambda.c, lex.c, method.c, name-lookup.c, parser.c, pt.c, tree.c,
2475 typeck2.c: Change cxx2a to cxx20.
2476
2477 2020-05-12 Marek Polacek <polacek@redhat.com>
2478
2479 PR c++/95074
2480 * parser.c (cp_parser_postfix_expression) <case CPP_OPEN_PAREN>: When
2481 looking for a block-scope function declaration, look through the whole
2482 set, not just the first function in the overload set.
2483
2484 2020-05-12 Jakub Jelinek <jakub@redhat.com>
2485
2486 PR c++/95063
2487 * pt.c (tsubst_decl): Deal with DECL_OMP_PRIVATIZED_MEMBER for
2488 a bit-field.
2489
2490 2020-05-11 Jason Merrill <jason@redhat.com>
2491
2492 Resolve C++20 NB comment CA104
2493 * pt.c (determine_specialization): Compare constraints for
2494 specialization of member template of class instantiation.
2495
2496 2020-05-11 Jason Merrill <jason@redhat.com>
2497
2498 PR c++/92583
2499 PR c++/92654
2500 * tree.c (cp_walk_subtrees): Stop at typedefs.
2501 Handle TYPENAME_TYPE here.
2502 * pt.c (find_parameter_packs_r): Not here.
2503 (for_each_template_parm_r): Clear *walk_subtrees.
2504 * decl2.c (min_vis_r): Look through typedefs.
2505
2506 2020-05-11 Jason Merrill <jason@redhat.com>
2507
2508 * call.c (implicit_conversion_error): Split out from...
2509 (perform_implicit_conversion_flags): ...here.
2510 (build_converted_constant_expr_internal): Use it.
2511
2512 2020-05-11 Jason Merrill <jason@redhat.com>
2513
2514 PR c++/90748
2515 * parser.c (inject_parm_decls): Set current_class_ptr here.
2516 (cp_parser_direct_declarator): And here.
2517 (cp_parser_late_return_type_opt): Not here.
2518 (cp_parser_noexcept_specification_opt): Nor here.
2519 (cp_parser_exception_specification_opt)
2520 (cp_parser_late_noexcept_specifier): Remove unneeded parameters.
2521
2522 2020-05-11 Jason Merrill <jason@redhat.com>
2523
2524 * decl.c (cxx_init_decl_processing): Call declare_weak for
2525 __cxa_pure_virtual.
2526
2527 2020-05-11 Jason Merrill <jason@redhat.com>
2528
2529 * pt.c (instantiate_class_template_1): Call tsubst_expr for
2530 STATIC_ASSERT member.
2531 * ptree.c (cxx_print_xnode): Handle STATIC_ASSERT.
2532
2533 2020-05-11 Jason Merrill <jason@redhat.com>
2534
2535 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Remove redundant
2536 walking of capture list.
2537
2538 2020-05-11 Jason Merrill <jason@redhat.com>
2539
2540 * cp-tree.h (LOOKUP_EXPLICIT_TMPL_ARGS): Remove.
2541 * call.c (build_new_function_call): Don't set it.
2542 (build_new_method_call_1): Likewise.
2543 (build_over_call): Check cand->explicit_targs instead.
2544
2545 2020-05-11 Jason Merrill <jason@redhat.com>
2546
2547 * decl.c (compute_array_index_type_loc): Stabilize before building
2548 the MINUS_EXPR.
2549
2550 2020-05-11 Jason Merrill <jason@redhat.com>
2551
2552 * decl.c (grokdeclarator): Adjust deprecated_state here.
2553 (start_decl): Not here.
2554
2555 2020-05-08 Iain Sandoe <iain@sandoe.co.uk>
2556
2557 PR c++/95003
2558 * coroutines.cc (build_actor_fn): Ensure that bind scopes
2559 are marked as having side-effects where necessary.
2560 (replace_statement_captures): Likewise.
2561 (morph_fn_to_coro): Likewise.
2562
2563 2020-05-08 Nathan Sidwell <nathan@acm.org>
2564
2565 * NEWS: Delete, it is so stale.
2566
2567 * parser.c (cp_lexer_set_source_position_from_token): EOF has a
2568 location too.
2569
2570 2020-05-07 Iain Sandoe <iain@sandoe.co.uk>
2571
2572 PR c++/94817
2573 PR c++/94829
2574 * coroutines.cc (morph_fn_to_coro): Set unformed outline
2575 functions to error_mark_node. For early error returns suppress
2576 warnings about missing ramp return values. Fix reinstatement
2577 of the function body on pre-existing initial error.
2578 * decl.c (finish_function): Use the normal error path for fails
2579 in the ramp function, do not try to compile the helpers if the
2580 transform fails.
2581
2582 2020-05-07 Marek Polacek <polacek@redhat.com>
2583
2584 PR c++/94590 - Detect long double -> double narrowing.
2585 * typeck2.c (check_narrowing): Detect long double -> double
2586 narrowing even when double and long double have the same
2587 precision. Make it handle conversions to float too.
2588
2589 2020-05-07 Marek Polacek <polacek@redhat.com>
2590
2591 PR c++/94255
2592 * parser.c (cp_parser_class_specifier_1): Check that the scope is
2593 nested inside current scope before pushing it.
2594
2595 2020-05-07 Marek Polacek <polacek@redhat.com>
2596
2597 P1957R2
2598 * typeck2.c (check_narrowing): Consider T* to bool narrowing
2599 in C++11 and up.
2600
2601 2020-05-07 Marek Polacek <polacek@redhat.com>
2602
2603 * decl.c (grok_op_properties): Fix spelling of non-static.
2604 * typeck.c (build_class_member_access_expr): Likewise.
2605
2606 2020-05-07 Richard Biener <rguenther@suse.de>
2607
2608 PR middle-end/94703
2609 * optimize.c (update_cloned_parm): Copy DECL_NOT_GIMPLE_REG_P.
2610
2611 2020-05-06 Marek Polacek <polacek@redhat.com>
2612
2613 PR c++/94938
2614 * pt.c (tsubst_copy_and_build): Call type_dependent_expression_p_push
2615 instead of uses_template_parms. Move the warning_sentinels after the
2616 RECURs.
2617
2618 2020-05-06 Jakub Jelinek <jakub@redhat.com>
2619
2620 PR c++/94951
2621 * typeck.c (cp_strict_aliasing_warning): New function.
2622 (cp_build_indirect_ref_1, build_reinterpret_cast_1): Use
2623 it instead of strict_aliasing_warning.
2624
2625 PR c++/94907
2626 * method.c (defaulted_late_check): Don't call synthesize_method
2627 on constexpr sfk_comparison if it has been called on it already.
2628
2629 2020-05-06 Nathan Sidwell <nathan@acm.org>
2630
2631 PR c++/94946
2632 * decl.c (grokdeclarator): Don't splice template attributes in
2633 parm context -- they can apply to the parm.
2634
2635 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
2636
2637 * coroutines.cc: Remove references to n4849 throughout.
2638
2639 2020-05-05 Jason Merrill <jason@redhat.com>
2640
2641 CWG 2235
2642 * pt.c (more_specialized_fn): Do consider parms with no deducible
2643 template parameters.
2644
2645 2020-05-05 Jason Merrill <jason@redhat.com>
2646
2647 PR c++/90212
2648 * constexpr.c (potential_constant_expression_1): In a lambda
2649 function, consider a captured variable directly.
2650
2651 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
2652
2653 * coroutines.cc (transform_await_wrapper): Check that we have
2654 no unlowered co_yields.
2655 (captures_temporary): Likewise.
2656 (register_awaits): Likewise.
2657
2658 2020-05-05 Nathan Sidwell <nathan@acm.org>
2659
2660 PR c++/94807
2661 * coroutines.cc (morph_fn_to_coro): Just check for
2662 closure_identifier.
2663 * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name.
2664
2665 2020-05-05 Marek Polacek <polacek@redhat.com>
2666 Jason Merrill <jason@redhat.com>
2667
2668 PR c++/94799
2669 * parser.c (cp_parser_postfix_dot_deref_expression): If we have
2670 a type-dependent object of class type, stash it to
2671 parser->context->object_type. If the postfix expression doesn't have
2672 a type, use typeof.
2673 (cp_parser_class_name): Consider object scope too.
2674 (cp_parser_lookup_name): Remove code dealing with the case when
2675 object_type is unknown_type_node.
2676
2677 2020-05-04 Patrick Palka <ppalka@redhat.com>
2678
2679 PR c++/94038
2680 * cp-gimplify.c (cp_fold) <case CALL_EXPR>: Move some variable
2681 declarations closer to their uses. Copy the CALL_EXPR only
2682 when one of its arguments has changed.
2683 <case TREE_VEC>: Instead of first collecting the folded
2684 arguments into a releasing_vec, just make a copy of the TREE_VEC
2685 as soon as folding changes one of its arguments.
2686
2687 2020-05-04 Iain Sandoe <iain@sandoe.co.uk>
2688
2689 * coroutines.cc (morph_fn_to_coro): Mark the coro.gro variable
2690 as artificial and ignored.
2691
2692 2020-05-04 Nathan Sidwell <nathan@acm.org>
2693
2694 pt.c (process_template_parm): Don't walk the template list twice,
2695 remember the final node instead.
2696 (end_template_parm_list): Refactor. Comment on why we do a pop
2697 and a push.
2698
2699 PR c++/94827 -- don't save parms in nested requirement
2700 * constraint.cc (tsubst_nested_requirement): TYPE directly holds
2701 notmalized requirement.
2702 (finish_nested_requirement): Don't stash current tpl parms into
2703 the requirement.
2704 (diagnose_nested_requirement): TYPE directly holds notmalized
2705 requirement.
2706
2707 2020-05-01 Patrick Palka <ppalka@redhat.com>
2708
2709 PR c++/90880
2710 * cp-tree.h (check_accessibility_of_qualified_id): Add
2711 tsubst_flags_t parameter and change return type to bool.
2712 * parser.c (cp_parser_lookup_name): Pass tf_warning_to_error to
2713 check_accessibility_of_qualified_id.
2714 * pt.c (tsubst_qualified_id): Return error_mark_node if
2715 check_accessibility_of_qualified_id returns false.
2716 * semantics.c (check_accessibility_of_qualified_id): Add
2717 complain parameter. Pass complain instead of
2718 tf_warning_or_error to perform_or_defer_access_check. Return
2719 true unless perform_or_defer_access_check returns false.
2720
2721 2020-05-01 Marek Polacek <polacek@redhat.com>
2722
2723 PR c++/94885
2724 * typeck2.c (process_init_constructor_record): Return PICFLAG_ERRONEOUS
2725 if an initializer element was erroneous.
2726
2727 2020-05-01 Jason Merrill <jason@redhat.com>
2728
2729 PR c++/90479
2730 * init.c (get_nsdmi): Don't push_to_top_level for a local class.
2731
2732 2020-05-01 Jason Merrill <jason@redhat.com>
2733
2734 PR c++/91529
2735 * decl.c (cp_finish_decl): Also clear TREE_READONLY if
2736 -fmerge-all-constants.
2737
2738 2020-05-01 Jason Merrill <jason@redhat.com>
2739
2740 PR c++/93822
2741 * pt.c (tsubst_decl): Make sure DECL_VALUE_EXPR continues to have
2742 the same type as the variable.
2743
2744 2020-04-30 Jason Merrill <jason@redhat.com>
2745 Nathan Sidwell <nathan@acm.org>
2746
2747 PR c++/94827
2748 * constraint.cc (map_arguments): If ARGS is null, it's a
2749 self-mapping of parms.
2750 (finish_nested_requirement): Do not pass argified
2751 current_template_parms to normalization.
2752 (tsubst_nested_requirement): Don't assert no template parms.
2753
2754 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2755
2756 PR c++/94886
2757 * coroutines.cc (transform_local_var_uses): Defer walking
2758 the DECL_INITIALs of BIND_EXPR vars until all the frame
2759 allocations have been made.
2760
2761 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2762
2763 PR c++/94883
2764 * coroutines.cc (register_awaits): Update target
2765 expressions for awaitable and suspend handle
2766 initializers.
2767
2768 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
2769
2770 PR c++/94879
2771 * coroutines.cc (build_co_await): Account for variables
2772 with DECL_VALUE_EXPRs.
2773 (captures_temporary): Likewise.
2774 (register_awaits): Likewise.
2775
2776 2020-04-29 Patrick Palka <ppalka@redhat.com>
2777
2778 PR c++/94830
2779 * pt.c (find_template_parameter_info::parm_list): New field.
2780 (keep_template_parm): Use the new field to build up the
2781 parameter list here instead of ...
2782 (find_template_parameters): ... here. Return ftpi.parm_list.
2783
2784 2020-04-29 Jakub Jelinek <jakub@redhat.com>
2785
2786 PR target/94707
2787 * class.c (build_base_field): Set DECL_FIELD_ABI_IGNORED on C++17 empty
2788 base artificial FIELD_DECLs.
2789 (layout_class_type): Set DECL_FIELD_ABI_IGNORED on empty class
2790 field_poverlapping_p FIELD_DECLs.
2791
2792 2020-04-29 Patrick Palka <ppalka@redhat.com>
2793
2794 PR c++/94819
2795 * constraint.cc (satisfy_declaration_constraints): Use saved_t
2796 instead of t as the key to decl_satisfied_cache.
2797
2798 PR c++/94808
2799 * error.c (print_requires_expression_info): Print the dependent
2800 form of the parameter list with its template parameter mapping,
2801 rather than printing the substituted form.
2802
2803 2020-04-28 Jason Merrill <jason@redhat.com>
2804
2805 PR c++/94583
2806 * decl.c (use_eh_spec_block): Check nothrow type after
2807 DECL_DEFAULTED_FN.
2808 * pt.c (maybe_instantiate_noexcept): Call synthesize_method for
2809 DECL_MAYBE_DELETED fns here.
2810 * decl2.c (mark_used): Not here.
2811 * method.c (get_defaulted_eh_spec): Reject DECL_MAYBE_DELETED here.
2812
2813 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
2814
2815 PR c++/94760
2816 * coroutines.cc (instantiate_coro_traits): Pass a reference to
2817 object type rather than a pointer type for 'this', for method
2818 coroutines.
2819 (struct param_info): Add a field to hold that the parm is a lambda
2820 closure pointer.
2821 (morph_fn_to_coro): Check for lambda closure pointers in the
2822 args. Use a reference to *this when building the args list for the
2823 promise allocator lookup.
2824
2825 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
2826
2827 PR c++/94759
2828 * coroutines.cc (coro_promise_type_found_p): Do not
2829 exclude non-classes here (this needs to be handled in the
2830 coroutine header).
2831 (morph_fn_to_coro): Allow for the case where the coroutine
2832 returns void.
2833
2834 2020-04-27 Iain Sandoe <iain@sandoe.co.uk>
2835
2836 PR c++/94701
2837 * coroutines.cc (struct local_var_info): Add fields for static
2838 variables and those with DECL_VALUE_EXPR redirection.
2839 (transform_local_var_uses): Skip past typedefs and static vars
2840 and then account for redirected variables.
2841 (register_local_var_uses): Likewise.
2842
2843 2020-04-27 Jason Merrill <jason@redhat.com>
2844
2845 PR c++/90750
2846 PR c++/79585
2847 * decl.c (grokdeclarator): Move dependent attribute to decl.
2848 * decl2.c (splice_template_attributes): No longer static.
2849
2850 2020-04-27 Patrick Palka <ppalka@redhat.com>
2851
2852 PR c++/94772
2853 * constexpr.c (cxx_eval_call_expression): Don't set new_obj if we're
2854 evaluating the target constructor of a delegating constructor.
2855 (cxx_eval_store_expression): Don't set TREE_READONLY if the LHS of the
2856 INIT_EXPR is '*this'.
2857
2858 2020-04-26 Marek Polacek <polacek@redhat.com>
2859
2860 PR c++/90320
2861 * call.c (struct conversion): Add copy_init_p.
2862 (standard_conversion): Set copy_init_p in ck_base and ck_rvalue
2863 if FLAGS demands LOOKUP_ONLYCONVERTING.
2864 (convert_like_real) <case ck_base>: If copy_init_p is set, or
2865 LOOKUP_ONLYCONVERTING into FLAGS.
2866
2867 2020-04-26 Iain Sandoe <iain@sandoe.co.uk>
2868
2869 PR c++/94752
2870 * coroutines.cc (morph_fn_to_coro): Ensure that
2871 unnamed function params have a usable and distinct
2872 frame field name.
2873
2874 2020-04-24 Jason Merrill <jason@redhat.com>
2875
2876 PR c++/94583
2877 * decl.c (redeclaration_error_message): Reject defaulted comparison
2878 operator that has been previously declared.
2879
2880 2020-04-25 Patrick Palka <ppalka@redhat.com>
2881
2882 * parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
2883 concepts if the invalid identifier is 'requires'.
2884
2885 2020-04-25 Jakub Jelinek <jakub@redhat.com>
2886
2887 PR c++/94742
2888 * semantics.c (finish_call_expr): When looking if all overloads
2889 are noreturn, use STRIP_TEMPLATE to look through TEMPLATE_DECLs.
2890
2891 2020-04-24 Martin Liska <mliska@suse.cz>
2892
2893 * coroutines.cc: Fix compilation error for release checking
2894 where we miss declaration of ‘coro_body_contains_bind_expr_p’.
2895
2896 2020-04-23 Patrick Palka <ppalka@redhat.com>
2897
2898 * tree.c (zero_init_expr_p): Use uses_template_parms instead of
2899 dependent_type_p.
2900
2901 PR c++/94645
2902 * pt.c (template_class_depth): Walk into the DECL_FRIEND_CONTEXT of a
2903 friend declaration rather than into its CP_DECL_CONTEXT.
2904
2905 2020-04-23 Iain Sandoe <iain@sandoe.co.uk>
2906
2907 PR c++/94288
2908 * coroutines.cc (await_statement_expander): Simplify cases.
2909 (struct susp_frame_data): Add fields for truth and/or if
2910 cases, rename one field.
2911 (analyze_expression_awaits): New.
2912 (expand_one_truth_if): New.
2913 (add_var_to_bind): New helper.
2914 (coro_build_add_if_not_cond_break): New helper.
2915 (await_statement_walker): Handle conditional expressions,
2916 handle expansion of truth-and/or-if cases.
2917 (bind_expr_find_in_subtree): New, checking-only.
2918 (coro_body_contains_bind_expr_p): New, checking-only.
2919 (morph_fn_to_coro): Ensure that we have a top level bind
2920 expression.
2921
2922 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
2923
2924 PR translation/94698
2925 * class.c (check_field_decls): Change "define" to "declare" in
2926 -Weffc++ diagnostics.
2927
2928 2020-04-22 Patrick Palka <ppalka@redhat.com>
2929
2930 PR c++/94719
2931 PR c++/94549
2932 * constraint.cc (satisfy_declaration_constraints): If the inherited
2933 constructor points to an instantiation of a constructor template,
2934 remember and use its attached template arguments.
2935
2936 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
2937
2938 PR translation/94698
2939 * class.c (check_field_decls): Change "override" to "define" in
2940 -Weffc++ diagnostics.
2941
2942 2020-04-22 Iain Sandoe <iain@sandoe.co.uk>
2943
2944 PR c++/94682
2945 * coroutines.cc (struct param_info): Add a field to note that
2946 the param is 'this'.
2947 (morph_fn_to_coro): Convert this to a reference before using it
2948 in the promise parameter preview.
2949
2950 2020-04-22 Jason Merrill <jason@redhat.com>
2951
2952 PR c++/94546
2953 * pt.c (register_parameter_specializations): If the instantiation is
2954 still a parameter pack, don't wrap it in a NONTYPE_ARGUMENT_PACK.
2955 (tsubst_pack_expansion, tsubst_expr): Adjust.
2956
2957 2020-04-22 Martin Sebor <msebor@redhat.com>
2958 Jason Merrill <jason@redhat.com>
2959
2960 PR c++/94510
2961 * decl.c (reshape_init_array_1): Avoid stripping redundant trailing
2962 zero initializers...
2963 * mangle.c (write_expression): ...and handle them here even for
2964 pointers to members by calling zero_init_expr_p.
2965 * cp-tree.h (zero_init_expr_p): Declare.
2966 * tree.c (zero_init_expr_p): Define.
2967 (type_initializer_zero_p): Remove.
2968 * pt.c (tparm_obj_values): New hash_map.
2969 (get_template_parm_object): Store to it.
2970 (tparm_object_argument): New.
2971
2972 2020-04-22 Patrick Palka <ppalka@redhat.com>
2973
2974 PR c++/67825
2975 * constraint.cc (diagnose_valid_expression): Check convert_to_void here
2976 as well as in tsubst_valid_expression_requirement.
2977
2978 2020-04-21 Patrick Palka <ppalka@redhat.com>
2979
2980 PR c++/94549
2981 * constraint.cc (satisfy_declaration_constraints): Don't strip the
2982 inherited constructor if it already has template information.
2983
2984 PR c++/94597
2985 * pt.c (any_template_parm_r) <case IDENTIFIER_NODE>: New case. If this
2986 is a conversion operator, visit its TREE_TYPE.
2987
2988 2020-04-21 Nathan Sidwell <nathan@acm.org>
2989
2990 * pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for
2991 error_mark_node.
2992
2993 2020-04-21 Iain Sandoe <iain@sandoe.co.uk>
2994
2995 PR c++/94661
2996 * coroutines.cc (morph_fn_to_coro): Simplify return
2997 value computation.
2998
2999 2020-04-17 Marek Polacek <polacek@redhat.com>
3000
3001 PR c++/94592
3002 * constexpr.c (cxx_eval_outermost_constant_expr): Return when T is
3003 a BRACE_ENCLOSED_INITIALIZER_P.
3004 (is_nondependent_constant_expression): Don't check
3005 BRACE_ENCLOSED_INITIALIZER_P.
3006 (is_nondependent_static_init_expression): Likewise.
3007
3008 2020-04-20 Patrick Palka <ppalka@redhat.com>
3009
3010 PR c++/94628
3011 * cp-tree.h (lss_policy::lss_nop): New enumerator.
3012 * pt.c (local_specialization_stack::local_specialization_stack): Handle
3013 an lss_nop policy.
3014 (local_specialization_stack::~local_specialization_stack): Likewise.
3015 (tsubst_pack_expansion): Use a local_specialization_stack instead of
3016 manually saving and restoring local_specializations. Conditionally
3017 replace local_specializations sooner, before the handling of the
3018 unsubstituted_packs case.
3019
3020 2020-04-20 Marek Polacek <polacek@redhat.com>
3021
3022 PR c++/94505 - bogus -Wparentheses warning with fold-expression.
3023 * pt.c (fold_expression): Add warning_sentinel for -Wparentheses
3024 before calling build_x_binary_op.
3025
3026 2020-04-20 Marek Polacek <polacek@redhat.com>
3027
3028 * coroutines.cc (captures_temporary): Don't assign the result of
3029 STRIP_NOPS to the same variable.
3030
3031 2020-04-20 Nathan Sidwell <nathan@acm.org>
3032
3033 PR c++/94454 - tpl-tpl-parms are not canonicalizable types
3034 * pt.c (canonical_type_parameter): Assert not a tpl-tpl-parm.
3035 (process_template_parm): tpl-tpl-parms are structural.
3036 (rewrite_template_parm): Propagate structuralness.
3037
3038 PR c++/94454 - Expr pack expansion equality
3039 * tree.c (cp_tree_equal) [TEMPLATE_ID_EXPR, default]: Refactor.
3040 [EXPR_PACK_EXPANSION]: Add.
3041
3042 PR c++/94454 Template Argument Hashing
3043 * pt.c (iterative_hash_template_arg): Strip nodes as
3044 template_args_equal does.
3045 [ARGUMENT_PACK_SELECT, TREE_VEC, CONSTRUCTOR]: Refactor.
3046 [node_class:TEMPLATE_TEMPLATE_PARM]: Hash by level & index.
3047 [node_class:default]: Refactor.
3048
3049 2020-04-18 Patrick Palka <ppalka@redhat.com>
3050
3051 PR c++/94632
3052 * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
3053 comparing_specializations if the parameters' contexts are identical.
3054
3055 PR c++/92187
3056 * pt.c (splice_late_return_type): Propagate cv-qualifiers and
3057 PLACEHOLDER_TYPE_CONSTRAINTS from the original auto node to the new one.
3058
3059 2020-04-17 Patrick Palka <ppalka@redhat.com>
3060
3061 PR c++/94483
3062 * lambda.c (lambda_capture_field_type): Avoid doing auto deduction if
3063 the explicit initializer has parameter packs.
3064
3065 PR c++/88754
3066 * parser.c (cp_parser_check_template_parameters): Before issuing a hard
3067 error, first try simulating an error instead.
3068
3069 2020-04-17 Jakub Jelinek <jakub@redhat.com>
3070
3071 PR other/94629
3072 * call.c (build_conditional_expr_1): Remove redundant assignment to
3073 arg2.
3074
3075 2020-04-16 Patrick Palka <ppalka@redhat.com>
3076
3077 PR c++/94475
3078 * cvt.c (ocp_convert): If the result of scalar_constant_value is
3079 erroneous, ignore it and use the original expression.
3080
3081 2020-04-16 Jakub Jelinek <jakub@redhat.com>
3082
3083 PR c++/94571
3084 * parser.c (cp_parser_simple_declaration): Fix up a pasto in
3085 diagnostics.
3086
3087 2020-04-15 Jakub Jelinek <jakub@redhat.com>
3088
3089 PR c/94593
3090 * parser.c (cp_parser_pragma) <case PRAGMA_OMP_REQUIRES>: Reject
3091 requires directive when not at file or namespace scope.
3092
3093 2020-04-14 Iain Sandoe <iain@sandoe.co.uk>
3094
3095 PR c++/94359
3096 * coroutines.cc (build_actor_fn): Check that the target can
3097 support the resume tailcall before mandating it.
3098
3099 2020-04-14 Patrick Palka <ppalka@redhat.com>
3100
3101 PR c++/85278
3102 * cxx-pretty-print.c (cxx_pretty_printer:simple_type_specifier)
3103 <case DECLTYPE_TYPE>: Handle DECLTYPE_TYPE here instead of ...
3104 (pp_cxx_type_specifier_seq) <case DECLTYPE_TYPE>: ... here.
3105 (cxx_pretty_printer::direct_abstract_declarator) <case DECLTYPE_TYPE>:
3106 New no-op case.
3107
3108 PR c++/94034
3109 * constexpr.c (replace_result_decl_data): New struct.
3110 (replace_result_decl_data_r): New function.
3111 (replace_result_decl): New function.
3112 (cxx_eval_call_expression): Use it.
3113 * tree.c (build_aggr_init_expr): Set the location of the AGGR_INIT_EXPR
3114 to that of its initializer.
3115
3116 2020-04-13 Marek Polacek <polacek@redhat.com>
3117
3118 PR c++/94588
3119 * name-lookup.c (check_local_shadow): Add an inform call.
3120
3121 2020-04-13 Patrick Palka <ppalka@redhat.com>
3122
3123 PR c++/94521
3124 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
3125 dump_function_decl when printing a function template instantiation as a
3126 scope.
3127
3128 PR c++/94470
3129 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
3130 'pos_hint' to -1.
3131 (cxx_eval_bare_aggregate): Use get_or_insert_ctor_field instead of
3132 assuming the the next index belongs at the end of the new CONSTRUCTOR.
3133 (cxx_eval_store_expression): Revert PR c++/78572 fix.
3134
3135 2020-04-13 Nathan Sidwell <nathan@acm.org>
3136
3137 PR c++/94426 lambdas with internal linkage are different to no-linkage
3138 * decl2.c (determine_visibility): A lambda's visibility is
3139 affected by its extra scope.
3140 * pt.c (instantiate_decl): Determine var's visibility before
3141 instantiating its initializer.
3142 * tree.c (no_linkage_check): Revert code looking at visibility of
3143 lambda's extra scope.
3144 `
3145 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
3146
3147 PR c++/94528
3148 * coroutines.cc (co_await_expander): Remove.
3149 (expand_one_await_expression): New.
3150 (process_one_statement): New.
3151 (await_statement_expander): New.
3152 (build_actor_fn): Revise to use per-statement expander.
3153 (struct susp_frame_data): Reorder and comment.
3154 (register_awaits): Factor code.
3155 (replace_statement_captures): New, factored from...
3156 (maybe_promote_captured_temps):.. here.
3157 (await_statement_walker): Revise to process per statement.
3158 (morph_fn_to_coro): Use revised susp_frame_data layout.
3159
3160 2020-04-10 Marek Polacek <polacek@redhat.com>
3161
3162 PR c++/94149
3163 * method.c (constructible_expr): In C++20, try using parenthesized
3164 initialization of aggregates to determine the result of
3165 __is_constructible.
3166
3167 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
3168
3169 * coroutines.cc (co_await_expander): Simplify.
3170
3171 2020-04-09 Jason Merrill <jason@redhat.com>
3172
3173 PR c++/94523
3174 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
3175 ctx->object and ctx->global->values first.
3176
3177 2020-04-09 Marek Polacek <polacek@redhat.com>
3178
3179 PR c++/93790
3180 * call.c (initialize_reference): If the reference binding failed, maybe
3181 try initializing from { }.
3182 * decl.c (grok_reference_init): For T& t(e), set
3183 LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet.
3184
3185 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
3186 Jun Ma <JunMa@linux.alibaba.com>
3187
3188 * coroutines.cc (maybe_promote_captured_temps): Add a cleanup
3189 expression, if needed, to any call from which we promoted
3190 temporaries captured by reference.
3191
3192 2020-04-08 Marek Polacek <polacek@redhat.com>
3193
3194 PR c++/94507 - ICE-on-invalid with lambda template.
3195 * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
3196 tsubst_function_decl returns error_mark_node.
3197
3198 2020-04-08 Martin Liska <mliska@suse.cz>
3199
3200 PR c++/94314
3201 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
3202 (cxx_init_decl_processing): Mark replaceable all implicitly defined
3203 operators.
3204
3205 2020-04-08 Patrick Palka <ppalka@redhat.com>
3206
3207 Core issues 1001 and 1322
3208 PR c++/92010
3209 * pt.c (rebuild_function_or_method_type): Split function out from ...
3210 (tsubst_function_type): ... here.
3211 (maybe_rebuild_function_decl_type): New function.
3212 (tsubst_function_decl): Use it.
3213
3214 2020-04-08 Jakub Jelinek <jakub@redhat.com>
3215
3216 PR c++/94325
3217 * decl.c (begin_destructor_body): For CLASSTYPE_VBASECLASSES class
3218 dtors, if CLASSTYPE_PRIMARY_BINFO is non-NULL, but not BINFO_VIRTUAL_P,
3219 look at CLASSTYPE_PRIMARY_BINFO of its BINFO_TYPE if it is not
3220 BINFO_VIRTUAL_P, and so on.
3221
3222 2020-04-08 Marek Polacek <polacek@redhat.com>
3223
3224 PR c++/94478 - ICE with defaulted comparison operator
3225 * method.c (early_check_defaulted_comparison): Give an error when the
3226 context is null.
3227
3228 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
3229
3230 PR middle-end/94120
3231 * paser.c (cp_parser_oacc_declare): Add check that variables
3232 are declared in the same scope as the directive.
3233
3234 2020-04-07 Jason Merrill <jason@redhat.com>
3235
3236 PR c++/94480
3237 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
3238
3239 PR c++/94481
3240 * parser.c (cp_parser_placeholder_type_specifier): Use
3241 matching_parens.
3242
3243 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
3244
3245 * coroutines.cc (maybe_promote_captured_temps): Ensure that
3246 reference capture placeholder vars are properly declared.
3247
3248 2020-04-07 Patrick Palka <ppalka@redhat.com>
3249
3250 PR c++/90996
3251 * tree.c (replace_placeholders): Look through all handled components,
3252 not just COMPONENT_REFs.
3253 * typeck2.c (process_init_constructor_array): Propagate
3254 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
3255 the array initializer.
3256
3257 2020-04-07 Jakub Jelinek <jakub@redhat.com>
3258
3259 PR c++/94512
3260 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
3261 if cp_parser_omp_master succeeded.
3262
3263 2020-04-06 Jason Merrill <jason@redhat.com>
3264
3265 PR c++/94462
3266 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
3267
3268 2020-04-04 Marek Polacek <polacek@redhat.com>
3269 Jason Merrill <jason@redhat.com>
3270
3271 PR c++/94155 - crash in gimplifier with paren init of aggregates.
3272 * init.c (build_vec_init): Fill in indexes.
3273
3274 2020-04-04 Jason Merrill <jason@redhat.com>
3275
3276 PR c++/91377
3277 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
3278
3279 2020-04-04 Patrick Palka <ppalka@redhat.com>
3280
3281 PR c++/94205
3282 PR c++/79937
3283 * constexpr.c (struct constexpr_ctx): New field 'parent'.
3284 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
3285 flag from the original constructor to the reduced constructor.
3286 (lookup_placeholder): Prefer to return the outermost matching object
3287 by recursively calling lookup_placeholder on the 'parent' context,
3288 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
3289 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
3290 context via 'new_ctx.parent' when being expanded without an explicit
3291 target. Don't call replace_placeholders.
3292 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
3293
3294 PR c++/94219
3295 PR c++/94205
3296 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
3297 support for VECTOR_TYPEs, and optimizations for the common case)
3298 from ...
3299 (cxx_eval_store_expression): ... here. Rename local variable
3300 'changed_active_union_member_p' to 'activated_union_member_p'. Record
3301 the sequence of indexes into 'indexes' that yields the subobject we're
3302 assigning to. Record the integer offsets of the constructor indexes
3303 we're assigning through into 'index_pos_hints'. After evaluating the
3304 initializer of the store expression, recompute 'valp' using 'indexes'
3305 and using 'index_pos_hints' as hints.
3306 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
3307 to recompute the constructor_elt pointer we're assigning through after
3308 evaluating each initializer.
3309
3310 2020-04-04 Jason Merrill <jason@redhat.com>
3311
3312 PR c++/67825
3313 * constraint.cc (tsubst_valid_expression_requirement): Call
3314 convert_to_void.
3315
3316 2020-04-04 Jason Merrill <jason@redhat.com>
3317
3318 PR c++/94453
3319 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
3320 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
3321 NON_LVALUE_EXPR.
3322
3323 2020-04-04 Jakub Jelinek <jakub@redhat.com>
3324
3325 PR debug/94441
3326 * parser.c (cp_parser_omp_for_loop): Use
3327 protected_set_expr_location_if_unset.
3328 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
3329
3330 PR c++/94477
3331 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
3332 omp_parallel_combined_clauses.
3333
3334 2020-04-03 Jason Merrill <jason@redhat.com>
3335
3336 PR c++/91966
3337 * pt.c (complex_pack_expansion_r): New.
3338 (complex_alias_template_p): Use it.
3339
3340 2020-03-31 Jason Merrill <jason@redhat.com>
3341
3342 PR c++/94205
3343 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
3344 replace_placeholders.
3345 * typeck2.c (store_init_value): Fix arguments to
3346 fold_non_dependent_expr.
3347
3348 2020-03-31 Jason Merrill <jason@redhat.com>
3349
3350 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
3351 local variables.
3352
3353 2020-03-30 Jason Merrill <jason@redhat.com>
3354
3355 PR c++/90711
3356 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
3357 (called_fns_equal): Check DECL_CONTEXT.
3358
3359 2020-03-30 Jakub Jelinek <jakub@redhat.com>
3360
3361 PR c++/94385
3362 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
3363 STATEMENT_CODE_P code.
3364
3365 2020-03-28 Patrick Palka <ppalka@redhat.com>
3366
3367 PR c++/94306
3368 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
3369 "requires {" when "requires requires {" was probably intended.
3370
3371 PR c++/94252
3372 * constraint.cc (tsubst_compound_requirement): Always suppress errors
3373 from type_deducible_p and expression_convertible_p, as they're not
3374 substitution errors.
3375 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
3376 that we diagnose INTEGER_CST expressions of non-bool type via the
3377 default case.
3378 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
3379 * parser.c (cp_parser_requires_expression): Always parse the requirement
3380 body as if we're processing a template, by temporarily incrementing
3381 processing_template_decl. Afterwards, if we're not actually in a
3382 template context, perform semantic processing to diagnose any invalid
3383 types and expressions.
3384 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
3385 * semantics.c (finish_static_assert): Explain an assertion failure
3386 when the condition is a REQUIRES_EXPR like we do when it is a concept
3387 check.
3388
3389 * constraint.cc (diagnose_compound_requirement): When diagnosing a
3390 compound requirement, maybe replay the satisfaction failure, subject to
3391 the current diagnosis depth.
3392
3393 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
3394 as well as its range, because build_x_binary_op doesn't always do so.
3395 (current_constraint_diagnosis_depth): New.
3396 (concepts_diagnostics_max_depth_exceeded_p): New.
3397 (collect_operands_of_disjunction): New.
3398 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
3399 replay each branch of the disjunction, subject to the current diagnosis
3400 depth.
3401 (diagnose_valid_expression): When diagnosing a satisfaction failure,
3402 maybe replay the substitution error, subject to the current diagnosis
3403 recursion.
3404 (diagnose_valid_type): Likewise.
3405 (diagnose_nested_requiremnet): Likewise.
3406 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
3407 current_constraint_diagnosis_depth when diagnosing.
3408 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
3409 current_constraint_diagnosis_depth when diagnosing.
3410 (diagnosing_failed_constraint::replay_errors_p): New static member
3411 function.
3412 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
3413 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
3414 the limit was exceeded.
3415 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
3416
3417 2020-03-27 Nathan Sidwell <nathan@acm.org>
3418
3419 PR c++/84733
3420 * name-lookup.c (do_pushdecl): Look through cleanp levels.
3421
3422 2020-03-27 Martin Sebor <msebor@redhat.com>
3423
3424 PR c++/94078
3425 PR c++/93824
3426 PR c++/93810
3427 * cp-tree.h (most_specialized_partial_spec): Declare.
3428 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
3429 from declarations.
3430 (specialization_of): New function.
3431 (cp_parser_check_class_key): Move code...
3432 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
3433 -Wredundant-tags on first-time declarations in other declarators.
3434 Correct handling of template specializations.
3435 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
3436 when -Wredundant-tags is enabled. Use primary template or partial
3437 specialization as the guide for uses of implicit instantiations.
3438 * pt.c (most_specialized_partial_spec): Declare extern.
3439
3440 2020-03-27 Nathan Sidwell <nathan@acm.org>
3441
3442 PR c++/94257
3443 * name-lookup.c (push_namespace): Triage ambiguous lookups that
3444 contain namespaces.
3445
3446 2020-03-27 Jakub Jelinek <jakub@redhat.com>
3447
3448 PR c++/94326
3449 * call.c (set_flags_from_callee): Don't update
3450 cp_function_chain->can_throw or current_function_returns_abnormally
3451 if cp_unevaluated_operand.
3452
3453 PR c++/94339
3454 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
3455 operand and creating a new COMPOUND_EXPR if anything changed.
3456
3457 2020-03-26 Marek Polacek <polacek@redhat.com>
3458
3459 PR c++/94336 - template keyword accepted before destructor names.
3460 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
3461 is followed by a destructor name.
3462
3463 2020-03-27 Patrick Palka <ppalka@redhat.com>
3464
3465 * decl.c (compute_array_index_type_loc): Remove redundant
3466 type_dependent_expression_p check that is subsumed by
3467 value_dependent_expression_p.
3468 * decl2.c (is_late_template_attribute): Likewise.
3469 * pt.c (uses_template_parms): Likewise.
3470 (dependent_template_arg_p): Likewise.
3471
3472 2020-03-26 Marek Polacek <polacek@redhat.com>
3473
3474 DR 1710
3475 PR c++/94057 - template keyword in a typename-specifier.
3476 * parser.c (check_template_keyword_in_nested_name_spec): New.
3477 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
3478 'template'. Call check_template_keyword_in_nested_name_spec.
3479 (cp_parser_simple_type_specifier): Assume that a <
3480 following a qualified-id in a typename-specifier begins
3481 a template argument list.
3482
3483 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
3484
3485 * coroutines.cc (coro_init_identifiers): Initialize an identifier
3486 for the cororoutine handle 'address' method name.
3487 (struct coro_aw_data): Add fields to cover the continuations.
3488 (co_await_expander): Determine the kind of await_suspend in use.
3489 If we have the case that returns a continuation handle, then save
3490 this and make the target for 'scope exit without cleanup' be the
3491 continuation resume label.
3492 (expand_co_awaits): Remove.
3493 (struct suspend_point_info): Remove fields that kept the returned
3494 await_suspend handle type.
3495 (transform_await_expr): Remove code tracking continuation handles.
3496 (build_actor_fn): Add the continuation handle as an actor-function
3497 scope var. Build the symmetric transfer continuation point. Call
3498 the tree walk for co_await expansion directly, rather than via a
3499 trivial shim function.
3500 (register_await_info): Remove fields tracking continuation handles.
3501 (get_await_suspend_return_type): Remove.
3502 (register_awaits): Remove code tracking continuation handles.
3503 (morph_fn_to_coro): Remove code tracking continuation handles.
3504
3505 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
3506
3507 * coroutines.cc (co_await_expander): If we are expanding the
3508 initial await expression, set a boolean flag to show that we
3509 have now reached the initial await_resume() method call.
3510 (expand_co_awaits): Handle the 'initial await resume called' flag.
3511 (build_actor_fn): Insert the initial await expression into the
3512 start of the user-authored function-body. Handle the 'initial await
3513 resume called' flag.
3514 (morph_fn_to_coro): Initialise the 'initial await resume called'
3515 flag. Modify the unhandled exception catch clause to recognise
3516 exceptions that occur before the initial await_resume() and re-
3517 throw them.
3518
3519 2020-03-26 Jakub Jelinek <jakub@redhat.com>
3520
3521 PR c++/81349
3522 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
3523 true for all TEMPLATE_DECLs.
3524
3525 PR c++/94272
3526 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
3527
3528 2020-03-25 Patrick Palka <ppalka@redhat.com>
3529
3530 PR c++/94265
3531 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
3532 current condition chain when the if-statement has a non-empty
3533 init-statement.
3534
3535 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
3536
3537 PR c++/94319
3538 * coroutines.cc (captures_temporary): Fix a missing dereference.
3539
3540 2020-03-24 Marek Polacek <polacek@redhat.com>
3541
3542 PR c++/94190 - wrong no post-decrement operator error in template.
3543 * call.c (convert_like_real): Use convert_from_reference on the result.
3544
3545 2020-03-24 Jason Merrill <jason@redhat.com>
3546
3547 PR c++/94186
3548 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
3549 error.
3550 (tsubst_nested_requirement): Likewise.
3551 (get_constraint_error_location): Allow missing context.
3552 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
3553 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
3554
3555 2020-03-24 Jason Merrill <jason@redhat.com>
3556
3557 * pt.c (any_template_parm_r): Look into the type of a non-type
3558 template parm.
3559
3560 2020-03-24 Jason Merrill <jason@redhat.com>
3561
3562 * cp-tree.h (cp_expr): When constructing from an expr and a
3563 location, call protected_set_expr_location.
3564
3565 2020-03-23 Patrick Palka <ppalka@redhat.com>
3566
3567 PR c++/93805
3568 * except.c (maybe_noexcept_warning): Add TODO.
3569 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
3570
3571 2020-03-23 nathans <nathan@acm.org>
3572
3573 PR c++/94044
3574 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
3575 operand.
3576
3577 2020-03-21 Patrick Palka <ppalka@redhat.com>
3578
3579 PR c++/94066
3580 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
3581 handle unions without an initializer.
3582 (cxx_eval_component_reference): Emit a different diagnostic when the
3583 constructor element corresponding to a union member is NULL.
3584 (cxx_eval_bare_aggregate): When constructing a union, always set the
3585 active union member before evaluating the initializer. Relax assertion
3586 that verifies the index of the constructor element we're initializing
3587 hasn't been changed.
3588 (cxx_eval_store_expression): Diagnose changing the active union member
3589 while the union is in the process of being initialized. After setting
3590 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
3591 CONSTRUCTOR.
3592 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
3593 CONSTRUCTOR returned by lookup_placeholder.
3594
3595 2020-03-20 Patrick Palka <ppalka@redhat.com>
3596
3597 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
3598 the "[with ]" bits to here from ...
3599 (pp_cxx_atomic_constraint): ... here.
3600 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
3601 * error.c (rebuild_concept_check): Delete.
3602 (print_concept_check_info): Print the dependent form of the constraint and the
3603 preferably substituted parameter mapping alongside it.
3604
3605 2020-03-19 Jason Merrill <jason@redhat.com>
3606
3607 PR c++/94175
3608 * cp-gimplify.c (simple_empty_class_p): Look through
3609 SIMPLE_TARGET_EXPR_P.
3610 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
3611 [RETURN_EXPR]: Avoid producing 'return *retval;'.
3612 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
3613 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
3614 is non-null.
3615
3616 2020-03-19 Jakub Jelinek <jakub@redhat.com>
3617
3618 PR c++/93931
3619 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
3620 on outer_automatic_var_p decls.
3621 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
3622 capture proxy decls.
3623
3624 2020-03-18 Nathan Sidwell <nathan@acm.org>
3625
3626 PR c++/94147 - mangling of lambdas assigned to globals
3627 * parser.c (cp_parser_init_declarator): Namespace-scope variables
3628 provide a lambda scope.
3629 * tree.c (no_linkage_check): Lambdas with a variable for extra
3630 scope have a linkage from the variable.
3631
3632 2020-03-18 Jakub Jelinek <jakub@redhat.com>
3633
3634 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
3635 strictly_subsumes): Fix up duplicated word issue in a comment.
3636 * coroutines.cc (build_init_or_final_await, captures_temporary):
3637 Likewise.
3638 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
3639 * pt.c (append_type_to_template_for_access_check): Likewise.
3640
3641 PR c++/91759
3642 * decl.c (grokfndecl): Restore old diagnostics about deduction
3643 guide declared in different scope if in_namespace is NULL_TREE.
3644
3645 2020-03-17 Jakub Jelinek <jakub@redhat.com>
3646
3647 PR c++/90995
3648 * parser.c (cp_parser_enum_specifier): Use temp_override for
3649 parser->colon_corrects_to_scope_p, replace goto out with return.
3650 If scoped enum or enum with underlying type is not followed by
3651 { or ;, call cp_parser_commit_to_tentative_parse before calling
3652 cp_parser_error and make sure to return error_mark_node instead of
3653 NULL_TREE. Formatting fixes.
3654
3655 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
3656
3657 PR c++/94197
3658 * method.c (assignable_expr): Use cp_unevaluated.
3659 (is_xible_helper): Push a non-deferred access check for
3660 the stub objects created by assignable_expr and constructible_expr.
3661
3662 2020-03-17 Jakub Jelinek <jakub@redhat.com>
3663
3664 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
3665 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
3666 in a comment.
3667 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
3668 cp_parser_placeholder_type_specifier,
3669 cp_parser_constraint_requires_parens): Likewise.
3670 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
3671
3672 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
3673
3674 * coroutines.cc (co_await_expander): Fix indentation.
3675
3676 2020-03-14 Jason Merrill <jason@redhat.com>
3677
3678 PR c++/92068
3679 * pt.c (process_partial_specialization): Error rather than crash on
3680 extra pack expansion.
3681
3682 2020-03-14 Jason Merrill <jason@redhat.com>
3683
3684 PR c++/92909
3685 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
3686 DECL_ORIGINAL_TYPE of a typedef.
3687
3688 2020-03-14 Jason Merrill <jason@redhat.com>
3689
3690 PR c++/93248
3691 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
3692 substituting DECL_ARGUMENTS.
3693
3694 2020-03-14 Jakub Jelinek <jakub@redhat.com>
3695
3696 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
3697 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
3698 literal.
3699
3700 2020-03-13 Patrick Palka <ppalka@redhat.com>
3701
3702 PR c++/67960
3703 * call.c (build_over_call): Use a warning_sentinel to disable
3704 warn_deprecated_decl before calling build_addr_func.
3705
3706 2020-03-12 Jakub Jelinek <jakub@redhat.com>
3707
3708 PR c++/94124
3709 * decl.c (reshape_init_array_1): Don't unshare constructor if there
3710 aren't any trailing zero elts, otherwise only unshare the first
3711 nelts.
3712
3713 2020-03-11 Jason Merrill <jason@redhat.com>
3714
3715 PR c++/93907
3716 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
3717 argument.
3718
3719 2020-03-11 Marek Polacek <polacek@redhat.com>
3720 Jason Merrill <jason@redhat.com>
3721
3722 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
3723 * constexpr.c (cref_has_const_field): New function.
3724 (modifying_const_object_p): Consider a COMPONENT_REF
3725 const only if any of its fields are const.
3726 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
3727 as readonly after its initialization has been done.
3728
3729 2020-03-10 Marek Polacek <polacek@redhat.com>
3730
3731 PR c++/94124 - wrong conversion error with non-viable overload.
3732 * decl.c (reshape_init_array_1): Unshare a constructor if we
3733 stripped trailing zero-initializers.
3734
3735 2020-03-10 Jason Merrill <jason@redhat.com>
3736
3737 PR c++/93901
3738 * pt.c (maybe_instantiate_noexcept): Always update clones.
3739
3740 2020-03-10 Jason Merrill <jason@redhat.com>
3741
3742 PR c++/93596
3743 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
3744
3745 2020-03-10 Jason Merrill <jason@redhat.com>
3746
3747 PR c++/93922
3748 PR c++/94041
3749 PR c++/52320
3750 PR c++/66139
3751 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
3752 66139: Don't split_nonconstant_init. Remove pre_p parameter.
3753
3754 2020-03-09 Marek Polacek <polacek@redhat.com>
3755
3756 PR c++/92031 - bogus taking address of rvalue error.
3757 PR c++/91465 - ICE with template codes in check_narrowing.
3758 PR c++/93870 - wrong error when converting template non-type arg.
3759 PR c++/94068 - ICE with template codes in check_narrowing.
3760 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
3761 in a template when not ck_identity and we're dealing with a class.
3762 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
3763 in a template if we need a temporary.
3764 * decl.c (compute_array_index_type_loc): Remove
3765 instantiate_non_dependent_expr_sfinae call. Call
3766 fold_non_dependent_expr instead of maybe_constant_value.
3767 (build_explicit_specifier): Don't instantiate or create a sentinel
3768 before converting the expression.
3769 * except.c (build_noexcept_spec): Likewise.
3770 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
3771 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
3772 build_converted_constant_expr returned.
3773 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
3774 of maybe_constant_value.
3775
3776 2020-03-09 Jakub Jelinek <jakub@redhat.com>
3777
3778 PR c++/94067
3779 Revert
3780 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
3781
3782 * constexpr.c (cxx_eval_constant_expression): Do not handle
3783 RROTATE_EXPR and LROTATE_EXPR.
3784
3785 2020-03-09 Marek Polacek <polacek@redhat.com>
3786
3787 PR c++/94050 - ABI issue with alignas on armv7hl.
3788 * class.c (layout_class_type): Don't replace a class's
3789 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
3790
3791 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
3792
3793 * coroutines.cc (build_actor_fn): Factor out code inserting the
3794 default return_void call to...
3795 (morph_fn_to_coro): ...here, also hoist local var declarations.
3796
3797 2020-03-08 Patrick Palka <ppalka@redhat.com>
3798
3799 PR c++/93729
3800 * call.c (convert_like_real): Check complain before emitting an error
3801 about binding a bit-field to a reference.
3802
3803 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
3804 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
3805 TYPE_NAME.
3806
3807 2020-03-06 Nathan Sidwell <nathan@acm.org>
3808
3809 PR c++/94027
3810 * mangle.c (find_substitution): Don't call same_type_p on template
3811 args that cannot match.
3812
3813 2020-03-04 Martin Sebor <msebor@redhat.com>
3814
3815 PR c++/90938
3816 * tree.c (type_initializer_zero_p): Fail for structs initialized
3817 with non-structs.
3818
3819 2020-03-04 Jason Merrill <jason@redhat.com>
3820
3821 PR c++/90432
3822 * init.c (perform_member_init): Don't do aggregate initialization of
3823 empty field.
3824 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
3825 initialization of empty field.
3826
3827 2020-03-04 Martin Liska <mliska@suse.cz>
3828
3829 * method.c: Wrap array in ctor with braces in order
3830 to silent clang warnings.
3831
3832 2020-03-03 Jason Merrill <jason@redhat.com>
3833 Marek Polacek <polacek@redhat.com>
3834
3835 PR c++/90505 - mismatch in template argument deduction.
3836 * pt.c (tsubst): Don't reduce the template level of template
3837 parameters when tf_partial.
3838
3839 2020-03-03 Jakub Jelinek <jakub@redhat.com>
3840
3841 PR c++/93998
3842 * constexpr.c (cxx_eval_constant_expression)
3843 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
3844 *non_constant_p is true.
3845
3846 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
3847
3848 * coroutines.cc (captures_temporary): Strip component_ref
3849 to its base object.
3850
3851 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
3852
3853 * coroutines.cc (finish_co_await_expr): Build co_await_expr
3854 with unknown_type_node.
3855 (finish_co_yield_expr): Ditto.
3856 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
3857 with unknown type as dependent.
3858
3859 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
3860
3861 * coroutines.cc (struct local_var_info): Adjust to remove the
3862 reference to the captured var, and just to note that this is a
3863 lambda capture proxy.
3864 (transform_local_var_uses): Handle lambda captures specially.
3865 (struct param_frame_data): Add a visited set.
3866 (register_param_uses): Also check for param uses in lambda
3867 capture proxies.
3868 (struct local_vars_frame_data): Remove captures list.
3869 (register_local_var_uses): Handle lambda capture proxies by
3870 noting and bypassing them.
3871 (morph_fn_to_coro): Update to remove lifetime extension of
3872 lambda capture-by-copy vars.
3873
3874 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
3875
3876 * coroutines.cc (build_co_await): Do not build frame
3877 awaitable proxy vars when the co_await expression is
3878 a function parameter or local var.
3879 (co_await_expander): Do not initialise a frame var with
3880 itself.
3881 (transform_await_expr): Only substitute the awaitable
3882 frame var if it's needed.
3883 (register_awaits): Do not make frame copies for param
3884 or local vars that are awaitables.
3885
3886 2020-02-28 Jason Merrill <jason@redhat.com>
3887
3888 Implement P2092R0, Disambiguating Nested-Requirements
3889 * parser.c (cp_parser_requirement_parameter_list): Pass
3890 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
3891
3892 * call.c (build_user_type_conversion_1): Don't look at the second
3893 conversion of a non-viable candidate.
3894
3895 2020-02-28 Jakub Jelinek <jakub@redhat.com>
3896
3897 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
3898 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
3899 functions in unevaluated contexts.
3900
3901 2020-02-27 Nathan Sidwell <nathan@acm.org>
3902
3903 PR c++/93933
3904 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
3905 cp_tree_equal.
3906 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
3907 * typeck.c (comptypes): Assert we don't get any argument packs.
3908
3909 * class.c (adjust_clone_args): Correct arg-checking assert.
3910 * typeck.c (comptypes): Assert not nulls.
3911
3912 2020-02-26 Marek Polacek <polacek@redhat.com>
3913
3914 PR c++/93789 - ICE with invalid array bounds.
3915 * decl.c (compute_array_index_type_loc): Don't use the folded
3916 size when folding cleared TREE_CONSTANT.
3917
3918 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
3919
3920 * class.c (classtype_has_non_deleted_copy_ctor): New.
3921 * coroutines.cc (struct param_info): Keep track of params
3922 that are references, and cache the original type and whether
3923 the DTOR is trivial.
3924 (build_actor_fn): Handle param copies always, and adjust the
3925 handling for references.
3926 (register_param_uses): Only handle uses here.
3927 (classtype_has_non_deleted_copy_ctor): New.
3928 (morph_fn_to_coro): Adjust param copy handling to match n4849
3929 by reordering ahead of the promise CTOR and always making a
3930 frame copy, even if the param is unused in the coroutine body.
3931 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
3932
3933 2020-02-26 Patrick Palka <ppalka@redhat.com>
3934
3935 * constraint.cc (finish_constraint_binary_op): Set expr's location range
3936 to the range of its operands.
3937 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
3938 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
3939 instead of the corresponding template arguments ARGS and adjust body
3940 accordingly.
3941 (diagnose_requires_expr): Likewise.
3942 (diagnose_atomic_constraint): Likewise. When printing an atomic
3943 constraint expression, print the instantiated parameter mapping
3944 alongside it.
3945 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
3946 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
3947 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
3948
3949 2020-02-26 Marek Polacek <polacek@redhat.com>
3950
3951 PR c++/93676 - value-init crash in template.
3952 * init.c (build_new_1): Don't call build_vec_init in a template.
3953
3954 2020-02-26 Marek Polacek <polacek@redhat.com>
3955
3956 PR c++/93862 - ICE with static_cast when converting from int[].
3957 * call.c (reference_compatible_p): No longer static.
3958 * cp-tree.h (reference_compatible_p): Declare.
3959 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
3960 of reference_related_p.
3961
3962 2020-02-26 Marek Polacek <polacek@redhat.com>
3963
3964 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
3965 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
3966 field.
3967
3968 2020-02-24 Martin Sebor <msebor@redhat.com>
3969
3970 PR c++/93804
3971 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
3972 in shared C/C++ code in headers.
3973 Remove a duplicate hunk of code.
3974
3975 2020-02-24 Marek Polacek <polacek@redhat.com>
3976
3977 PR c++/93869 - ICE with -Wmismatched-tags.
3978 * parser.c (cp_parser_check_class_key): Check class_key earlier.
3979
3980 2020-02-24 Marek Polacek <polacek@redhat.com>
3981
3982 PR c++/93712 - ICE with ill-formed array list-initialization.
3983 * call.c (next_conversion): Return NULL for ck_aggr.
3984 (build_aggr_conv): Set u.expr instead of u.next.
3985 (build_array_conv): Likewise.
3986 (build_complex_conv): Likewise.
3987 (conv_get_original_expr): Handle ck_aggr.
3988
3989 2020-02-24 Jakub Jelinek <jakub@redhat.com>
3990
3991 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
3992 * call.c (build_over_call): Don't evaluate immediate functions in
3993 unevaluated operands.
3994
3995 2020-02-24 Jason Merrill <jason@redhat.com>
3996
3997 P0780R2: Resolve lambda init-capture pack grammar.
3998 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
3999 ...&x=y.
4000
4001 2020-02-22 Marek Polacek <polacek@redhat.com>
4002
4003 PR c++/93882
4004 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
4005
4006 2020-02-21 Martin Sebor <msebor@redhat.com>
4007
4008 PR gcov-profile/93753
4009 * class.c (check_flexarrays): Tighten up a test for potential members
4010 of anonymous structs or unions.
4011
4012 2020-02-20 Martin Sebor <msebor@redhat.com>
4013
4014 PR c++/93801
4015 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
4016
4017 2020-02-20 Martin Liska <mliska@suse.cz>
4018
4019 PR translation/93841
4020 * config/or1k/or1k.opt: Remove superfluous word.
4021 * doc/invoke.texi: Likewise.
4022
4023 2020-02-20 Martin Liska <mliska@suse.cz>
4024
4025 PR translation/93838
4026 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
4027
4028 2020-02-19 Marek Polacek <polacek@redhat.com>
4029
4030 PR c++/93169 - wrong-code with a non-constexpr constructor.
4031 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
4032 on constant CONSTRUCTORs.
4033
4034 2020-02-15 Marek Polacek <polacek@redhat.com>
4035
4036 PR c++/93710 - poor diagnostic for array initializer.
4037 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
4038 for an error call.
4039
4040 2020-02-15 Jason Merrill <jason@redhat.com>
4041
4042 PR c++/92556
4043 * pt.c (any_template_parm_r): Look into lambda body.
4044
4045 PR c++/92583
4046 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
4047
4048 2020-02-14 Jakub Jelinek <jakub@redhat.com>
4049
4050 PR c++/61414
4051 * class.c (enum_min_precision): Change prec type from int to int &.
4052
4053 PR libstdc++/92906
4054 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
4055 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
4056 (fallback_dfloat32_type, fallback_dfloat64_type,
4057 fallback_dfloat128_type): Define.
4058 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
4059 dfloat*_type_node.
4060 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
4061 is disabled for compatibility.
4062
4063 2020-02-13 Jason Merrill <jason@redhat.com>
4064
4065 PR c++/93713
4066 * name-lookup.c (matching_fn_p): A function does not match a
4067 template.
4068
4069 PR c++/93643
4070 PR c++/91476
4071 * tree.c (decl_linkage): Always lk_none for locals.
4072
4073 2020-02-12 Jason Merrill <jason@redhat.com>
4074
4075 PR c++/92583
4076 PR c++/92654
4077 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
4078 * pt.c (find_parameter_packs_r): Not here.
4079
4080 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
4081
4082 * coroutines.cc (build_actor_fn): Implement deallocation function
4083 selection per n4849, dcl.fct.def.coroutine bullet 12.
4084 (morph_fn_to_coro): Implement allocation function selection per
4085 n4849, dcl.fct.def.coroutine bullets 9 and 10.
4086
4087 2020-02-12 Marek Polacek <polacek@redhat.com>
4088
4089 PR c++/93684 - ICE-on-invalid with broken attribute.
4090 * parser.c (cp_parser_std_attribute): Peek a token first before
4091 consuming it.
4092
4093 2020-02-11 Jason Merrill <jason@redhat.com>
4094
4095 PR c++/93675
4096 * class.c (add_implicitly_declared_members): Use do_friend.
4097 * method.c (implicitly_declare_fn): Fix friend handling.
4098 (decl_remember_implicit_trigger_p): New.
4099 (synthesize_method): Use it.
4100 * decl2.c (mark_used): Use it.
4101
4102 2020-02-11 Jason Merrill <jason@redhat.com>
4103
4104 PR c++/93650
4105 PR c++/90691
4106 * constexpr.c (maybe_constant_value): Correct earlier change.
4107 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
4108 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
4109
4110 2020-02-12 Patrick Palka <ppalka@redhat.com>
4111
4112 PR c++/69448
4113 PR c++/80471
4114 * type-utils.h (find_type_usage): Refactor to take a tree * and to
4115 return a tree *, and update documentation accordingly.
4116 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
4117 decltype(auto) node.
4118 (make_constrained_decltype_auto): No need to explicitly set
4119 AUTO_IS_DECLTYPE anymore.
4120 (splice_late_return_type): Use find_type_usage to find and
4121 replace a possibly nested auto node instead of using is_auto.
4122 Check test for is_auto into an assert when deciding whether
4123 to late_return_type.
4124 (type_uses_auto): Adjust the call to find_type_usage.
4125 * parser.c (cp_parser_decltype): No need to explicitly set
4126 AUTO_IS_DECLTYPE anymore.
4127
4128 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
4129 (dump_simple_decl): Handle standard concept definitions as well as
4130 variable concept definitions.
4131
4132 2020-02-10 Jakub Jelinek <jakub@redhat.com>
4133
4134 PR other/93641
4135 * error.c (dump_decl_name): Fix up last argument to strncmp.
4136
4137 2020-02-10 Jason Merrill <jason@redhat.com>
4138
4139 PR c++/93618
4140 * tree.c (array_of_unknown_bound_p): New.
4141 * init.c (perform_member_init): Do nothing for flexible arrays.
4142
4143 2020-02-09 Jakub Jelinek <jakub@redhat.com>
4144
4145 PR c++/93633
4146 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
4147 ARRAY_TYPE, use the element type. Punt if objtype after that is not
4148 a class type.
4149
4150 2020-02-08 Jason Merrill <jason@redhat.com>
4151
4152 PR c++/90691
4153 * expr.c (fold_for_warn): Call maybe_constant_value.
4154 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
4155 (maybe_constant_value): Add uid_sensitive parm.
4156 (get_fundef_copy): Don't copy if it's true.
4157 (cxx_eval_call_expression): Don't instantiate if it's true.
4158 (cxx_eval_outermost_constant_expr): Likewise.
4159
4160 PR c++/92852
4161 * constexpr.c (maybe_constant_value): Don't unshare if the cached
4162 value is the same as the argument.
4163
4164 * typeck.c (maybe_warn_about_returning_address_of_local): Add
4165 location parameter.
4166
4167 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
4168 if appropriate.
4169
4170 2020-02-08 Jakub Jelinek <jakub@redhat.com>
4171
4172 PR c++/93549
4173 * constexpr.c (find_array_ctor_elt): If last element has no index,
4174 for flag_checking verify all elts have no index. If i is within the
4175 elts, return it directly, if it is right after the last elt, append
4176 if NULL index, otherwise force indexes on all elts.
4177 (cxx_eval_store_expression): Allow cep->index to be NULL.
4178
4179 2020-02-07 Marek Polacek <polacek@redhat.com>
4180
4181 PR c++/92947 - Paren init of aggregates in unevaluated context.
4182 * call.c (build_new_method_call_1): Don't check
4183 cp_unevaluated_operand. Check the return value of digest_init.
4184
4185 2020-02-06 Jason Merrill <jason@redhat.com>
4186
4187 PR c++/92654
4188 * tree.c (cp_walk_subtrees): Walk into type template arguments.
4189 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
4190 instead of TYPE_ALIAS_P.
4191 * pt.c (push_template_decl_real): Likewise.
4192 (find_parameter_packs_r): Likewise. Remove dead code.
4193 * error.c (find_typenames_r): Remove dead code.
4194
4195 2020-02-06 Jason Merrill <jason@redhat.com>
4196
4197 PR c++/92517
4198 * parser.c (cp_parser_constraint_primary_expression): Do the main
4199 parse non-tentatively.
4200
4201 2020-02-06 Marek Polacek <polacek@redhat.com>
4202
4203 PR c++/93597 - ICE with lambda in operator function.
4204 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
4205
4206 2020-02-05 Jason Merrill <jason@redhat.com>
4207
4208 PR c++/93140
4209 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
4210 handling of TREE_CHAIN for empty pack.
4211
4212 2020-02-05 Jakub Jelinek <jakub@redhat.com>
4213
4214 PR c++/93557
4215 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
4216 prior to passing it to c_build_vec_convert.
4217
4218 2020-02-05 Marek Polacek <polacek@redhat.com>
4219
4220 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
4221 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
4222 TREE_SIDE_EFFECTS.
4223
4224 2020-02-05 Jason Merrill <jason@redhat.com>
4225
4226 PR c++/92593
4227 * decl.c (grokdeclarator): Reject field of current class type even
4228 in a template.
4229
4230 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
4231
4232 * coroutines.cc (maybe_promote_captured_temps): Increase the index
4233 number for temporary variables' name.
4234
4235 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
4236
4237 * coroutines.cc (build_co_await): Call convert_from_reference
4238 to wrap co_await_expr with indirect_ref which avoid
4239 reference/non-reference type confusion.
4240
4241 (co_await_expander): Sink to call_expr if await_resume
4242 is wrapped by indirect_ref.
4243
4244 2020-02-04 Jason Merrill <jason@redhat.com>
4245
4246 PR c++/93551
4247 * constraint.cc (satisfy_declaration_constraints): Check return
4248 value of push_tinst_level.
4249
4250 PR c++/90951
4251 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
4252 elements instead of value-initializing them.
4253
4254 PR c++/86917
4255 * init.c (perform_member_init): Simplify.
4256 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
4257 flexarray.
4258 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
4259
4260 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
4261
4262 * coroutines.cc (find_promise_type): Delete unused forward
4263 declaration.
4264 (struct coroutine_info): Add a bool for no promise type error.
4265 (coro_promise_type_found_p): Only emit the error for a missing
4266 promise once in each affected coroutine.
4267
4268 2020-02-03 Jason Merrill <jason@redhat.com>
4269
4270 PR c++/66477
4271 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
4272 defer loading the value of a reference.
4273
4274 2020-02-03 Jason Merrill <jason@redhat.com>
4275
4276 PR c++/91953
4277 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
4278 empty class type.
4279 [COMPONENT_REF]: A member function reference doesn't use the object
4280 as an rvalue.
4281
4282 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
4283
4284 PR c++/93458
4285 * coroutines.cc (struct coroutine_info): Add a bool flag to note
4286 that we emitted an error for a bad function return type.
4287 (get_coroutine_info): Tolerate an unset info table in case of
4288 missing traits.
4289 (find_coro_traits_template_decl): In case of error or if we didn't
4290 find a type template, note we emitted the error and suppress
4291 duplicates.
4292 (find_coro_handle_template_decl): Likewise.
4293 (instantiate_coro_traits): Only check for error_mark_node in the
4294 return from lookup_qualified_name.
4295 (coro_promise_type_found_p): Reorder initialization so that we check
4296 for the traits and their usability before allocation of the info
4297 table. Check for a suitable return type and emit a diagnostic for
4298 here instead of relying on the lookup machinery. This allows the
4299 error to have a better location, and means we can suppress multiple
4300 copies.
4301 (coro_function_valid_p): Re-check for a valid promise (and thus the
4302 traits) before proceeding. Tolerate missing info as a fatal error.
4303
4304 2020-02-03 Jason Merrill <jason@redhat.com>
4305
4306 PR c++/88256
4307 * cp-gimplify.c (predeclare_vla): New.
4308 (cp_genericize_r) [NOP_EXPR]: Call it.
4309
4310 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
4311
4312 * coroutines.cc (transform_await_wrapper): Set actor funcion as
4313 new context of label_decl.
4314 (build_actor_fn): Fill new field of await_xform_data.
4315
4316 2020-02-02 Marek Polacek <polacek@redhat.com>
4317
4318 PR c++/93530 - ICE on invalid alignas in a template.
4319 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
4320 decl_attributes.
4321
4322 2020-01-31 Jason Merrill <jason@redhat.com>
4323
4324 PR c++/86216
4325 * semantics.c (process_outer_var_ref): Capture VLAs even in
4326 unevaluated context.
4327
4328 PR c++/14179
4329 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
4330 non-aggregate elements.
4331 (reshape_init_array): Add first_initializer_p parm.
4332 (reshape_init_r): Change first_initializer_p from bool to tree.
4333 (reshape_init): Pass init to it.
4334
4335 PR c++/14179
4336 * parser.c (cp_parser_initializer_list): Suppress location wrappers
4337 after 256 elements.
4338
4339 2020-01-29 Jason Merrill <jason@redhat.com>
4340
4341 PR c++/82521
4342 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
4343 the expression was dependent before substitution.
4344
4345 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
4346
4347 * coroutines.cc (act_des_fn): New.
4348 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
4349 Access promise via actor function's frame pointer argument.
4350 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
4351
4352 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
4353
4354 * coroutines.cc (co_await_expander): Handle type conversion case.
4355
4356 2020-01-29 Jason Merrill <jason@redhat.com>
4357
4358 PR c++/90333
4359 PR c++/89640
4360 PR c++/60503
4361 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
4362 a trailing return type.
4363 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
4364 parens.
4365
4366 2020-01-29 Marek Polacek <polacek@redhat.com>
4367
4368 PR c++/91754 - Fix template arguments comparison with class NTTP.
4369 * pt.c (class_nttp_const_wrapper_p): New.
4370 (template_args_equal): See through class_nttp_const_wrapper_p
4371 arguments.
4372
4373 2020-01-29 Marek Polacek <polacek@redhat.com>
4374
4375 PR c++/92948 - Fix class NTTP with template arguments.
4376 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
4377 converting a value-dependent expression to a class type.
4378 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
4379 as the result of the tsubst_copy call.
4380
4381 2020-01-29 Jakub Jelinek <jakub@redhat.com>
4382
4383 PR c++/91118
4384 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
4385 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
4386
4387 2020-01-28 Jason Merrill <jason@redhat.com>
4388
4389 PR c++/93442
4390 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
4391
4392 PR c++/93477
4393 PR c++/91476
4394 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
4395
4396 PR c++/90546
4397 * call.c (build_user_type_conversion_1): Allow a template conversion
4398 returning an rvalue reference to bind directly to an lvalue.
4399
4400 PR c++/90731
4401 * decl.c (grokdeclarator): Propagate eh spec from typedef.
4402
4403 2020-01-28 Martin Liska <mliska@suse.cz>
4404
4405 PR c++/92440
4406 * pt.c (redeclare_class_template): Group couple of
4407 errors and inform messages with auto_diagnostic_group.
4408
4409 2020-01-28 Martin Liska <mliska@suse.cz>
4410
4411 PR c++/92440
4412 * pt.c (redeclare_class_template): Use inform
4413 for the second location.
4414
4415 2020-01-27 Jason Merrill <jason@redhat.com>
4416
4417 PR c++/90966
4418 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
4419
4420 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
4421
4422 PR c++/93443
4423 * coroutines.cc (morph_fn_to_coro): Check the ramp return
4424 value when it is constructed from the 'get return object'.
4425
4426 2020-01-27 Nathan Sidwell <nathan@acm.org>
4427
4428 PR c++/91826
4429 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
4430
4431 2020-01-26 Jason Merrill <jason@redhat.com>
4432
4433 PR c++/90992
4434 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
4435 temporarily enable -Wsystem-headers. Change second warning to
4436 conditional inform.
4437
4438 PR c++/90997
4439 * semantics.c (finish_call_expr): Don't call
4440 instantiate_non_dependent_expr before warn_for_memset.
4441
4442 2020-01-25 Marek Polacek <polacek@redhat.com>
4443
4444 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
4445 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
4446 dynamic_cast diagnostic.
4447
4448 2020-01-24 Jason Merrill <jason@redhat.com>
4449
4450 PR c++/93400 - ICE with constrained friend.
4451 * constraint.cc (maybe_substitute_reqs_for): New.
4452 * decl.c (function_requirements_equivalent_p): Call it.
4453 * pt.c (tsubst_friend_function): Only substitute
4454 TEMPLATE_PARMS_CONSTRAINTS.
4455 (tsubst_template_parms): Copy constraints.
4456
4457 2020-01-24 Jason Merrill <jason@redhat.com>
4458
4459 PR c++/93279 - ICE with lambda in member operator.
4460 * name-lookup.c (maybe_save_operator_binding): Don't remember
4461 class-scope bindings.
4462
4463 2020-01-24 Jason Merrill <jason@redhat.com>
4464
4465 PR c++/93377 - ICE with member alias in constraint.
4466 * pt.c (any_template_parm_r): Look at template arguments for all
4467 aliases, not only alias templates.
4468
4469 2020-01-24 Marek Polacek <polacek@redhat.com>
4470
4471 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
4472 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
4473
4474 2020-01-24 Jason Merrill <jason@redhat.com>
4475
4476 PR c++/92852 - ICE with generic lambda and reference var.
4477 * constexpr.c (maybe_constant_value): Likewise.
4478
4479 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
4480
4481 PR c++/92804
4482 * parser.c (cp_parser_nested_name_specifier_opt): Properly
4483 diagnose concept-ids.
4484
4485 2020-01-23 Jason Merrill <jason@redhat.com>
4486
4487 PR c++/93331 - ICE with __builtin_strchr.
4488 * constexpr.c (cxx_eval_builtin_function_call): Use the original
4489 argument if we didn't manage to extract a STRING_CST.
4490
4491 PR c++/93345 - ICE with defaulted dtor and template.
4492 PR c++/33799
4493 * decl.c (cxx_maybe_build_cleanup): Don't try to set
4494 throwing_cleanup in a template.
4495
4496 2020-01-22 Marek Polacek <polacek@redhat.com>
4497
4498 PR c++/92907 - noexcept does not consider "const" in member functions.
4499 * g++.dg/cpp0x/noexcept56.C: New test.
4500
4501 2020-01-22 Marek Polacek <polacek@redhat.com>
4502
4503 PR c++/93324 - ICE with -Wall on constexpr if.
4504 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
4505
4506 2020-01-22 Patrick Palka <ppalka@redhat.com>
4507
4508 * constraint.cc (get_mapped_args): Avoid using auto_vec
4509 as a vector element. Release the vectors inside the lists
4510 vector.
4511 * parser.c (cp_literal_operator_id): Free the buffer.
4512
4513 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
4514
4515 * coroutines.cc (finish_co_await_expr): Add error check on return
4516 value of build_co_await.
4517 (finish_co_yield_expr,): Ditto.
4518
4519 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
4520
4521 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
4522 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
4523 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
4524
4525 2020-01-21 Jason Merrill <jason@redhat.com>
4526
4527 PR c++/60855 - ICE with sizeof VLA capture.
4528 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
4529
4530 PR c++/90732 - ICE with VLA capture and generic lambda.
4531 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
4532
4533 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
4534 Bin Cheng <bin.cheng@linux.alibaba.com>
4535
4536 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
4537 from complete_type_or_else.
4538 (register_param_uses): Likewise.
4539 (build_co_await): Do not try to use complete_type_or_else for void
4540 types, otherwise for incomplete types, check for NULL return from
4541 complete_type_or_else.
4542
4543 2020-01-21 Jason Merrill <jason@redhat.com>
4544
4545 PR c++/91476 - anon-namespace reference temp clash between TUs.
4546 * decl2.c (copy_linkage): Factor out of get_guard.
4547 * call.c (make_temporary_var_for_ref_to_temp): Use it.
4548 * decl.c (cp_finish_decomp): Use it.
4549 (cp_finish_decl): determine_visibility sooner.
4550
4551 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
4552
4553 * coroutines.cc (finish_co_await_expr): Set return value flag.
4554 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
4555
4556 2020-01-19 Jason Merrill <jason@redhat.com>
4557
4558 PR c++/33799 - destroy return value, take 2.
4559 * cp-tree.h (current_retval_sentinel): New macro.
4560 (struct language_function): Add throwing_cleanup bitfield.
4561 * decl.c (cxx_maybe_build_cleanup): Set it.
4562 * except.c (maybe_set_retval_sentinel)
4563 (maybe_splice_retval_cleanup): New functions.
4564 * parser.c (cp_parser_compound_statement): Call
4565 maybe_splice_retval_cleanup.
4566 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
4567
4568 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
4569
4570 2020-01-18 Jakub Jelinek <jakub@redhat.com>
4571
4572 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
4573 but non-NO_DOLLAR_IN_LABEL case build.
4574
4575 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
4576
4577 * Make-lang.in: Add coroutines.o.
4578 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
4579 (DECL_COROUTINE_P): New.
4580 * lex.c (init_reswords): Enable keywords when the coroutine flag
4581 is set,
4582 * operators.def (co_await): New operator.
4583 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
4584 (op_error): Likewise.
4585 (build_new_op_1): Likewise.
4586 (build_new_function_call): Validate coroutine builtin arguments.
4587 * constexpr.c (potential_constant_expression_1): Handle
4588 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
4589 * coroutines.cc: New file.
4590 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
4591 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
4592 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
4593 * cp-tree.h (coro_validate_builtin_call): New.
4594 * decl.c (emit_coro_helper): New.
4595 (finish_function): Handle the case when a function is found to
4596 be a coroutine, perform the outlining and emit the outlined
4597 functions. Set a bit to signal that this is a coroutine component.
4598 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
4599 (cp_parser_unary_expression): Handle co_await.
4600 (cp_parser_assignment_expression): Handle co_yield.
4601 (cp_parser_statement): Handle RID_CO_RETURN.
4602 (cp_parser_jump_statement): Handle co_return.
4603 (cp_parser_operator): Handle co_await operator.
4604 (cp_parser_yield_expression): New.
4605 (cp_parser_required_error): Handle RT_CO_YIELD.
4606 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
4607 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
4608 CO_RETURN_EXPRs.
4609 * tree.c (cp_walk_subtrees): Likewise.
4610
4611 2020-01-17 Jason Merrill <jason@redhat.com>
4612
4613 PR c++/92531 - ICE with noexcept(lambda).
4614 * pt.c (uses_template_parms): Don't try to enumerate all the
4615 expression cases.
4616
4617 2020-01-17 Jakub Jelinek <jakub@redhat.com>
4618
4619 PR c++/93228
4620 * parser.c (cp_parser_template_name): Look up deprecated attribute
4621 in DECL_TEMPLATE_RESULT or its type's attributes.
4622
4623 2020-01-16 Jason Merrill <jason@redhat.com>
4624
4625 PR c++/93286 - ICE with __is_constructible and variadic template.
4626 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
4627 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
4628
4629 PR c++/93280 - ICE with aggregate assignment and DMI.
4630 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
4631 * typeck2.c (digest_nsdmi_init): Not here.
4632
4633 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
4634
4635 PR c++/91073
4636 * cp-tree.h (is_constrained_auto): New.
4637 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
4638 handle concept-check expressions; take a cp_decl_specifier_seq*
4639 instead of a bool.
4640 (cp_parser_condition): Update call.
4641 (cp_parser_simple_declaration): Likewise.
4642 (cp_parser_placeholder_type_specifier): Correctly handle
4643 concept-check expressions.
4644
4645 2020-01-15 Jason Merrill <jason@redhat.com>
4646
4647 Revert
4648 PR c++/33799 - destroy return value if local cleanup throws.
4649 * cp-tree.h (current_retval_sentinel): New macro.
4650 * decl.c (start_preparsed_function): Set up cleanup for retval.
4651 * typeck.c (check_return_expr): Set current_retval_sentinel.
4652
4653 PR c++/93257 - consteval void function.
4654 * constexpr.c (verify_constant): Allow void_node.
4655
4656 PR c++/92871 - bad code with xvalue and GNU ?: extension.
4657 * call.c (prevent_lifetime_extension): New.
4658 (build_conditional_expr_1): Use it.
4659
4660 2020-01-14 Nathan Sidwell <nathan@acm.org>
4661
4662 PR c++/90916
4663 * pt.c (retrieve_specialization): Use get_template_info, not open
4664 coding access.
4665
4666 PR c++/90916
4667 * pt.c (retrieve_specialization): Get the TI from the decl or the
4668 classtype as appropriate.
4669
4670 2020-01-14 David Malcolm <dmalcolm@redhat.com>
4671
4672 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
4673 New static constant.
4674 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
4675 (struct named_label_hash::empty_zero_p): Likewise.
4676 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
4677
4678 2020-01-14 Jason Merrill <jason@redhat.com>
4679
4680 PR c++/92590 - wrong handling of inherited default ctor.
4681 * class.c (add_method): A constrained inherited ctor doesn't hide an
4682 implicit derived ctor.
4683 Revert:
4684 PR c++/92552 - ICE with inherited constrained default ctor.
4685 * pt.c (instantiate_class_template_1): Copy
4686 TYPE_HAS_USER_CONSTRUCTOR.
4687 PR c++/91930 - ICE with constrained inherited default ctor.
4688 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
4689 for inherited constructor.
4690 PR c++/92594 - ICE with inherited trivial default ctor.
4691 * method.c (trivial_fn_p): Treat an inherited default constructor
4692 like a normal default constructor.
4693
4694 PR c++/92594 - ICE with inherited trivial default ctor.
4695 * method.c (trivial_fn_p): Treat an inherited default constructor
4696 like a normal default constructor.
4697
4698 PR c++/92009 - ICE with punning of typeid.
4699 * rtti.c (get_tinfo_desc): Call xref_basetypes.
4700 * constexpr.c (cxx_fold_indirect_ref): Don't strip
4701 REINTERPRET_CAST_P.
4702
4703 2020-01-13 Jason Merrill <jason@redhat.com>
4704
4705 PR c++/92746 - ICE with noexcept of function concept check.
4706 * except.c (check_noexcept_r): Handle concept-check.
4707
4708 PR c++/92582 - ICE with member template as requirement.
4709 * pt.c (struct find_template_parameter_info): Add ctx_parms.
4710 (any_template_parm_r): Handle TEMPLATE_DECL.
4711 (find_template_parameters): Take parms instead of their depth.
4712 * constraint.cc (build_parameter_mapping): Pass them.
4713
4714 PR c++/33799 - destroy return value if local cleanup throws.
4715 * cp-tree.h (current_retval_sentinel): New macro.
4716 * decl.c (start_preparsed_function): Set up cleanup for retval.
4717 * typeck.c (check_return_expr): Set current_retval_sentinel.
4718
4719 PR c++/93238 - short right-shift with enum.
4720 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
4721
4722 2020-01-10 Jason Merrill <jason@redhat.com>
4723
4724 * typeck.c (cp_build_binary_op): Restore short_shift code.
4725
4726 PR c++/93143 - incorrect tree sharing with constexpr.
4727 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
4728 CONSTRUCTORs are already unshared.
4729
4730 PR c++/93173 - incorrect tree sharing.
4731 PR c++/93033
4732 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
4733 copy_if_shared after cp_genericize_tree.
4734 * typeck2.c (split_nonconstant_init): Don't unshare here.
4735
4736 2020-01-08 Jason Merrill <jason@redhat.com>
4737
4738 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
4739 TARGET_EXPR_DIRECT_INIT_P.
4740 * constexpr.c (cxx_eval_constant_expression): Likewise.
4741
4742 2020-01-08 Jason Merrill <jason@redhat.com>
4743
4744 PR c++/91369 - constexpr destructor and member initializer.
4745 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
4746 when not preevaluating.
4747
4748 2020-01-08 Jason Merrill <jason@redhat.com>
4749
4750 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
4751 support.
4752
4753 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
4754
4755 * init.c (build_new): Add location_t parameter and use it throughout.
4756 (build_raw_new_expr): Likewise.
4757 * parser.c (cp_parser_new_expression): Pass the combined_loc.
4758 * pt.c (tsubst_copy_and_build): Adjust call.
4759 * cp-tree.h: Update declarations.
4760
4761 2020-01-07 Jason Merrill <jason@redhat.com>
4762
4763 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
4764 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
4765 explicit class visibility for a template.
4766
4767 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
4768
4769 * mangle.c (mangle_type_attribute_p): New function, split out from...
4770 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
4771 that contain a space.
4772
4773 2020-01-07 Jakub Jelinek <jakub@redhat.com>
4774
4775 PR c++/91369
4776 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
4777 member, initialize it to zero in ctor.
4778 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
4779 a heap object. Don't cache calls to functions which allocate some
4780 heap objects and don't deallocate them or deallocate some heap
4781 objects they didn't allocate.
4782
4783 2020-01-06 Jason Merrill <jason@redhat.com>
4784
4785 PR c++/92552 - ICE with inherited constrained default ctor.
4786 * pt.c (instantiate_class_template_1): Copy
4787 TYPE_HAS_USER_CONSTRUCTOR.
4788 * class.c (one_inherited_ctor): Don't set it here.
4789
4790 2020-01-06 Andrew Sutton <asutton@lock3software.com>
4791
4792 PR c++/92739 - parsing requires clause with attributes.
4793 * parser.c (cp_parser_constraint_requires_parens): Exclude
4794 attributes as postfix expressions.
4795
4796 2020-01-05 Jakub Jelinek <jakub@redhat.com>
4797
4798 PR c++/93138
4799 * parser.c (cp_parser_check_class_key): Disable access checks for the
4800 simple name lookup.
4801 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
4802 !warn_redundant_tags.
4803
4804 2010-01-05 Jakub Jelinek <jakub@redhat.com>
4805
4806 PR c++/93046
4807 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
4808 TARGET_EXPR if it has been gimplified already.
4809
4810 2020-01-03 Jason Merrill <jason@redhat.com>
4811
4812 PR c++/93033 - incorrect tree node sharing with array init.
4813 * typeck2.c (split_nonconstant_init): Unshare non-decl.
4814 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
4815
4816 2020-01-02 Jason Merrill <jason@redhat.com>
4817
4818 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
4819 C++17.
4820
4821 2020-01-02 Jakub Jelinek <jakub@redhat.com>
4822
4823 PR c/90677
4824 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
4825 has not been found, rather than error_mark_node.
4826
4827 2020-01-01 Jakub Jelinek <jakub@redhat.com>
4828
4829 Update copyright years.
4830 \f
4831 Copyright (C) 2020 Free Software Foundation, Inc.
4832
4833 Copying and distribution of this file, with or without modification,
4834 are permitted in any medium without royalty provided the copyright
4835 notice and this notice are preserved.