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