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