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