c++: Refrain from using replace_placeholders in constexpr evaluation [PR94205]
[gcc.git] / gcc / cp / ChangeLog
1 2020-04-04 Patrick Palka <ppalka@redhat.com>
2
3 PR c++/94205
4 PR c++/79937
5 * constexpr.c (struct constexpr_ctx): New field 'parent'.
6 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
7 flag from the original constructor to the reduced constructor.
8 (lookup_placeholder): Prefer to return the outermost matching object
9 by recursively calling lookup_placeholder on the 'parent' context,
10 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
11 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
12 context via 'new_ctx.parent' when being expanded without an explicit
13 target. Don't call replace_placeholders.
14 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
15
16 PR c++/94219
17 PR c++/94205
18 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
19 support for VECTOR_TYPEs, and optimizations for the common case)
20 from ...
21 (cxx_eval_store_expression): ... here. Rename local variable
22 'changed_active_union_member_p' to 'activated_union_member_p'. Record
23 the sequence of indexes into 'indexes' that yields the subobject we're
24 assigning to. Record the integer offsets of the constructor indexes
25 we're assigning through into 'index_pos_hints'. After evaluating the
26 initializer of the store expression, recompute 'valp' using 'indexes'
27 and using 'index_pos_hints' as hints.
28 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
29 to recompute the constructor_elt pointer we're assigning through after
30 evaluating each initializer.
31
32 2020-04-04 Jason Merrill <jason@redhat.com>
33
34 PR c++/67825
35 * constraint.cc (tsubst_valid_expression_requirement): Call
36 convert_to_void.
37
38 2020-04-04 Jason Merrill <jason@redhat.com>
39
40 PR c++/94453
41 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
42 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
43 NON_LVALUE_EXPR.
44
45 2020-04-04 Jakub Jelinek <jakub@redhat.com>
46
47 PR debug/94441
48 * parser.c (cp_parser_omp_for_loop): Use
49 protected_set_expr_location_if_unset.
50 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
51
52 PR c++/94477
53 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
54 omp_parallel_combined_clauses.
55
56 2020-04-03 Jason Merrill <jason@redhat.com>
57
58 PR c++/91966
59 * pt.c (complex_pack_expansion_r): New.
60 (complex_alias_template_p): Use it.
61
62 2020-03-31 Jason Merrill <jason@redhat.com>
63
64 PR c++/94205
65 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
66 replace_placeholders.
67 * typeck2.c (store_init_value): Fix arguments to
68 fold_non_dependent_expr.
69
70 2020-03-31 Jason Merrill <jason@redhat.com>
71
72 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
73 local variables.
74
75 2020-03-30 Jason Merrill <jason@redhat.com>
76
77 PR c++/90711
78 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
79 (called_fns_equal): Check DECL_CONTEXT.
80
81 2020-03-30 Jakub Jelinek <jakub@redhat.com>
82
83 PR c++/94385
84 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
85 STATEMENT_CODE_P code.
86
87 2020-03-28 Patrick Palka <ppalka@redhat.com>
88
89 PR c++/94306
90 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
91 "requires {" when "requires requires {" was probably intended.
92
93 PR c++/94252
94 * constraint.cc (tsubst_compound_requirement): Always suppress errors
95 from type_deducible_p and expression_convertible_p, as they're not
96 substitution errors.
97 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
98 that we diagnose INTEGER_CST expressions of non-bool type via the
99 default case.
100 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
101 * parser.c (cp_parser_requires_expression): Always parse the requirement
102 body as if we're processing a template, by temporarily incrementing
103 processing_template_decl. Afterwards, if we're not actually in a
104 template context, perform semantic processing to diagnose any invalid
105 types and expressions.
106 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
107 * semantics.c (finish_static_assert): Explain an assertion failure
108 when the condition is a REQUIRES_EXPR like we do when it is a concept
109 check.
110
111 * constraint.cc (diagnose_compound_requirement): When diagnosing a
112 compound requirement, maybe replay the satisfaction failure, subject to
113 the current diagnosis depth.
114
115 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
116 as well as its range, because build_x_binary_op doesn't always do so.
117 (current_constraint_diagnosis_depth): New.
118 (concepts_diagnostics_max_depth_exceeded_p): New.
119 (collect_operands_of_disjunction): New.
120 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
121 replay each branch of the disjunction, subject to the current diagnosis
122 depth.
123 (diagnose_valid_expression): When diagnosing a satisfaction failure,
124 maybe replay the substitution error, subject to the current diagnosis
125 recursion.
126 (diagnose_valid_type): Likewise.
127 (diagnose_nested_requiremnet): Likewise.
128 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
129 current_constraint_diagnosis_depth when diagnosing.
130 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
131 current_constraint_diagnosis_depth when diagnosing.
132 (diagnosing_failed_constraint::replay_errors_p): New static member
133 function.
134 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
135 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
136 the limit was exceeded.
137 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
138
139 2020-03-27 Nathan Sidwell <nathan@acm.org>
140
141 PR c++/84733
142 * name-lookup.c (do_pushdecl): Look through cleanp levels.
143
144 2020-03-27 Martin Sebor <msebor@redhat.com>
145
146 PR c++/94078
147 PR c++/93824
148 PR c++/93810
149 * cp-tree.h (most_specialized_partial_spec): Declare.
150 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
151 from declarations.
152 (specialization_of): New function.
153 (cp_parser_check_class_key): Move code...
154 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
155 -Wredundant-tags on first-time declarations in other declarators.
156 Correct handling of template specializations.
157 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
158 when -Wredundant-tags is enabled. Use primary template or partial
159 specialization as the guide for uses of implicit instantiations.
160 * pt.c (most_specialized_partial_spec): Declare extern.
161
162 2020-03-27 Nathan Sidwell <nathan@acm.org>
163
164 PR c++/94257
165 * name-lookup.c (push_namespace): Triage ambiguous lookups that
166 contain namespaces.
167
168 2020-03-27 Jakub Jelinek <jakub@redhat.com>
169
170 PR c++/94326
171 * call.c (set_flags_from_callee): Don't update
172 cp_function_chain->can_throw or current_function_returns_abnormally
173 if cp_unevaluated_operand.
174
175 PR c++/94339
176 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
177 operand and creating a new COMPOUND_EXPR if anything changed.
178
179 2020-03-26 Marek Polacek <polacek@redhat.com>
180
181 PR c++/94336 - template keyword accepted before destructor names.
182 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
183 is followed by a destructor name.
184
185 2020-03-27 Patrick Palka <ppalka@redhat.com>
186
187 * decl.c (compute_array_index_type_loc): Remove redundant
188 type_dependent_expression_p check that is subsumed by
189 value_dependent_expression_p.
190 * decl2.c (is_late_template_attribute): Likewise.
191 * pt.c (uses_template_parms): Likewise.
192 (dependent_template_arg_p): Likewise.
193
194 2020-03-26 Marek Polacek <polacek@redhat.com>
195
196 DR 1710
197 PR c++/94057 - template keyword in a typename-specifier.
198 * parser.c (check_template_keyword_in_nested_name_spec): New.
199 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
200 'template'. Call check_template_keyword_in_nested_name_spec.
201 (cp_parser_simple_type_specifier): Assume that a <
202 following a qualified-id in a typename-specifier begins
203 a template argument list.
204
205 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
206
207 * coroutines.cc (coro_init_identifiers): Initialize an identifier
208 for the cororoutine handle 'address' method name.
209 (struct coro_aw_data): Add fields to cover the continuations.
210 (co_await_expander): Determine the kind of await_suspend in use.
211 If we have the case that returns a continuation handle, then save
212 this and make the target for 'scope exit without cleanup' be the
213 continuation resume label.
214 (expand_co_awaits): Remove.
215 (struct suspend_point_info): Remove fields that kept the returned
216 await_suspend handle type.
217 (transform_await_expr): Remove code tracking continuation handles.
218 (build_actor_fn): Add the continuation handle as an actor-function
219 scope var. Build the symmetric transfer continuation point. Call
220 the tree walk for co_await expansion directly, rather than via a
221 trivial shim function.
222 (register_await_info): Remove fields tracking continuation handles.
223 (get_await_suspend_return_type): Remove.
224 (register_awaits): Remove code tracking continuation handles.
225 (morph_fn_to_coro): Remove code tracking continuation handles.
226
227 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
228
229 * coroutines.cc (co_await_expander): If we are expanding the
230 initial await expression, set a boolean flag to show that we
231 have now reached the initial await_resume() method call.
232 (expand_co_awaits): Handle the 'initial await resume called' flag.
233 (build_actor_fn): Insert the initial await expression into the
234 start of the user-authored function-body. Handle the 'initial await
235 resume called' flag.
236 (morph_fn_to_coro): Initialise the 'initial await resume called'
237 flag. Modify the unhandled exception catch clause to recognise
238 exceptions that occur before the initial await_resume() and re-
239 throw them.
240
241 2020-03-26 Jakub Jelinek <jakub@redhat.com>
242
243 PR c++/81349
244 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
245 true for all TEMPLATE_DECLs.
246
247 PR c++/94272
248 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
249
250 2020-03-25 Patrick Palka <ppalka@redhat.com>
251
252 PR c++/94265
253 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
254 current condition chain when the if-statement has a non-empty
255 init-statement.
256
257 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
258
259 PR c++/94319
260 * coroutines.cc (captures_temporary): Fix a missing dereference.
261
262 2020-03-24 Marek Polacek <polacek@redhat.com>
263
264 PR c++/94190 - wrong no post-decrement operator error in template.
265 * call.c (convert_like_real): Use convert_from_reference on the result.
266
267 2020-03-24 Jason Merrill <jason@redhat.com>
268
269 PR c++/94186
270 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
271 error.
272 (tsubst_nested_requirement): Likewise.
273 (get_constraint_error_location): Allow missing context.
274 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
275 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
276
277 2020-03-24 Jason Merrill <jason@redhat.com>
278
279 * pt.c (any_template_parm_r): Look into the type of a non-type
280 template parm.
281
282 2020-03-24 Jason Merrill <jason@redhat.com>
283
284 * cp-tree.h (cp_expr): When constructing from an expr and a
285 location, call protected_set_expr_location.
286
287 2020-03-23 Patrick Palka <ppalka@redhat.com>
288
289 PR c++/93805
290 * except.c (maybe_noexcept_warning): Add TODO.
291 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
292
293 2020-03-23 nathans <nathan@acm.org>
294
295 PR c++/94044
296 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
297 operand.
298
299 2020-03-21 Patrick Palka <ppalka@redhat.com>
300
301 PR c++/94066
302 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
303 handle unions without an initializer.
304 (cxx_eval_component_reference): Emit a different diagnostic when the
305 constructor element corresponding to a union member is NULL.
306 (cxx_eval_bare_aggregate): When constructing a union, always set the
307 active union member before evaluating the initializer. Relax assertion
308 that verifies the index of the constructor element we're initializing
309 hasn't been changed.
310 (cxx_eval_store_expression): Diagnose changing the active union member
311 while the union is in the process of being initialized. After setting
312 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
313 CONSTRUCTOR.
314 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
315 CONSTRUCTOR returned by lookup_placeholder.
316
317 2020-03-20 Patrick Palka <ppalka@redhat.com>
318
319 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
320 the "[with ]" bits to here from ...
321 (pp_cxx_atomic_constraint): ... here.
322 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
323 * error.c (rebuild_concept_check): Delete.
324 (print_concept_check_info): Print the dependent form of the constraint and the
325 preferably substituted parameter mapping alongside it.
326
327 2020-03-19 Jason Merrill <jason@redhat.com>
328
329 PR c++/94175
330 * cp-gimplify.c (simple_empty_class_p): Look through
331 SIMPLE_TARGET_EXPR_P.
332 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
333 [RETURN_EXPR]: Avoid producing 'return *retval;'.
334 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
335 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
336 is non-null.
337
338 2020-03-19 Jakub Jelinek <jakub@redhat.com>
339
340 PR c++/93931
341 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
342 on outer_automatic_var_p decls.
343 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
344 capture proxy decls.
345
346 2020-03-18 Nathan Sidwell <nathan@acm.org>
347
348 PR c++/94147 - mangling of lambdas assigned to globals
349 * parser.c (cp_parser_init_declarator): Namespace-scope variables
350 provide a lambda scope.
351 * tree.c (no_linkage_check): Lambdas with a variable for extra
352 scope have a linkage from the variable.
353
354 2020-03-18 Jakub Jelinek <jakub@redhat.com>
355
356 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
357 strictly_subsumes): Fix up duplicated word issue in a comment.
358 * coroutines.cc (build_init_or_final_await, captures_temporary):
359 Likewise.
360 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
361 * pt.c (append_type_to_template_for_access_check): Likewise.
362
363 PR c++/91759
364 * decl.c (grokfndecl): Restore old diagnostics about deduction
365 guide declared in different scope if in_namespace is NULL_TREE.
366
367 2020-03-17 Jakub Jelinek <jakub@redhat.com>
368
369 PR c++/90995
370 * parser.c (cp_parser_enum_specifier): Use temp_override for
371 parser->colon_corrects_to_scope_p, replace goto out with return.
372 If scoped enum or enum with underlying type is not followed by
373 { or ;, call cp_parser_commit_to_tentative_parse before calling
374 cp_parser_error and make sure to return error_mark_node instead of
375 NULL_TREE. Formatting fixes.
376
377 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
378
379 PR c++/94197
380 * method.c (assignable_expr): Use cp_unevaluated.
381 (is_xible_helper): Push a non-deferred access check for
382 the stub objects created by assignable_expr and constructible_expr.
383
384 2020-03-17 Jakub Jelinek <jakub@redhat.com>
385
386 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
387 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
388 in a comment.
389 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
390 cp_parser_placeholder_type_specifier,
391 cp_parser_constraint_requires_parens): Likewise.
392 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
393
394 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
395
396 * coroutines.cc (co_await_expander): Fix indentation.
397
398 2020-03-14 Jason Merrill <jason@redhat.com>
399
400 PR c++/92068
401 * pt.c (process_partial_specialization): Error rather than crash on
402 extra pack expansion.
403
404 2020-03-14 Jason Merrill <jason@redhat.com>
405
406 PR c++/92909
407 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
408 DECL_ORIGINAL_TYPE of a typedef.
409
410 2020-03-14 Jason Merrill <jason@redhat.com>
411
412 PR c++/93248
413 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
414 substituting DECL_ARGUMENTS.
415
416 2020-03-14 Jakub Jelinek <jakub@redhat.com>
417
418 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
419 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
420 literal.
421
422 2020-03-13 Patrick Palka <ppalka@redhat.com>
423
424 PR c++/67960
425 * call.c (build_over_call): Use a warning_sentinel to disable
426 warn_deprecated_decl before calling build_addr_func.
427
428 2020-03-12 Jakub Jelinek <jakub@redhat.com>
429
430 PR c++/94124
431 * decl.c (reshape_init_array_1): Don't unshare constructor if there
432 aren't any trailing zero elts, otherwise only unshare the first
433 nelts.
434
435 2020-03-11 Jason Merrill <jason@redhat.com>
436
437 PR c++/93907
438 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
439 argument.
440
441 2020-03-11 Marek Polacek <polacek@redhat.com>
442 Jason Merrill <jason@redhat.com>
443
444 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
445 * constexpr.c (cref_has_const_field): New function.
446 (modifying_const_object_p): Consider a COMPONENT_REF
447 const only if any of its fields are const.
448 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
449 as readonly after its initialization has been done.
450
451 2020-03-10 Marek Polacek <polacek@redhat.com>
452
453 PR c++/94124 - wrong conversion error with non-viable overload.
454 * decl.c (reshape_init_array_1): Unshare a constructor if we
455 stripped trailing zero-initializers.
456
457 2020-03-10 Jason Merrill <jason@redhat.com>
458
459 PR c++/93901
460 * pt.c (maybe_instantiate_noexcept): Always update clones.
461
462 2020-03-10 Jason Merrill <jason@redhat.com>
463
464 PR c++/93596
465 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
466
467 2020-03-10 Jason Merrill <jason@redhat.com>
468
469 PR c++/93922
470 PR c++/94041
471 PR c++/52320
472 PR c++/66139
473 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
474 66139: Don't split_nonconstant_init. Remove pre_p parameter.
475
476 2020-03-09 Marek Polacek <polacek@redhat.com>
477
478 PR c++/92031 - bogus taking address of rvalue error.
479 PR c++/91465 - ICE with template codes in check_narrowing.
480 PR c++/93870 - wrong error when converting template non-type arg.
481 PR c++/94068 - ICE with template codes in check_narrowing.
482 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
483 in a template when not ck_identity and we're dealing with a class.
484 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
485 in a template if we need a temporary.
486 * decl.c (compute_array_index_type_loc): Remove
487 instantiate_non_dependent_expr_sfinae call. Call
488 fold_non_dependent_expr instead of maybe_constant_value.
489 (build_explicit_specifier): Don't instantiate or create a sentinel
490 before converting the expression.
491 * except.c (build_noexcept_spec): Likewise.
492 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
493 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
494 build_converted_constant_expr returned.
495 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
496 of maybe_constant_value.
497
498 2020-03-09 Jakub Jelinek <jakub@redhat.com>
499
500 PR c++/94067
501 Revert
502 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
503
504 * constexpr.c (cxx_eval_constant_expression): Do not handle
505 RROTATE_EXPR and LROTATE_EXPR.
506
507 2020-03-09 Marek Polacek <polacek@redhat.com>
508
509 PR c++/94050 - ABI issue with alignas on armv7hl.
510 * class.c (layout_class_type): Don't replace a class's
511 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
512
513 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
514
515 * coroutines.cc (build_actor_fn): Factor out code inserting the
516 default return_void call to...
517 (morph_fn_to_coro): ...here, also hoist local var declarations.
518
519 2020-03-08 Patrick Palka <ppalka@redhat.com>
520
521 PR c++/93729
522 * call.c (convert_like_real): Check complain before emitting an error
523 about binding a bit-field to a reference.
524
525 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
526 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
527 TYPE_NAME.
528
529 2020-03-06 Nathan Sidwell <nathan@acm.org>
530
531 PR c++/94027
532 * mangle.c (find_substitution): Don't call same_type_p on template
533 args that cannot match.
534
535 2020-03-04 Martin Sebor <msebor@redhat.com>
536
537 PR c++/90938
538 * tree.c (type_initializer_zero_p): Fail for structs initialized
539 with non-structs.
540
541 2020-03-04 Jason Merrill <jason@redhat.com>
542
543 PR c++/90432
544 * init.c (perform_member_init): Don't do aggregate initialization of
545 empty field.
546 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
547 initialization of empty field.
548
549 2020-03-04 Martin Liska <mliska@suse.cz>
550
551 * method.c: Wrap array in ctor with braces in order
552 to silent clang warnings.
553
554 2020-03-03 Jason Merrill <jason@redhat.com>
555 Marek Polacek <polacek@redhat.com>
556
557 PR c++/90505 - mismatch in template argument deduction.
558 * pt.c (tsubst): Don't reduce the template level of template
559 parameters when tf_partial.
560
561 2020-03-03 Jakub Jelinek <jakub@redhat.com>
562
563 PR c++/93998
564 * constexpr.c (cxx_eval_constant_expression)
565 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
566 *non_constant_p is true.
567
568 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
569
570 * coroutines.cc (captures_temporary): Strip component_ref
571 to its base object.
572
573 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
574
575 * coroutines.cc (finish_co_await_expr): Build co_await_expr
576 with unknown_type_node.
577 (finish_co_yield_expr): Ditto.
578 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
579 with unknown type as dependent.
580
581 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
582
583 * coroutines.cc (struct local_var_info): Adjust to remove the
584 reference to the captured var, and just to note that this is a
585 lambda capture proxy.
586 (transform_local_var_uses): Handle lambda captures specially.
587 (struct param_frame_data): Add a visited set.
588 (register_param_uses): Also check for param uses in lambda
589 capture proxies.
590 (struct local_vars_frame_data): Remove captures list.
591 (register_local_var_uses): Handle lambda capture proxies by
592 noting and bypassing them.
593 (morph_fn_to_coro): Update to remove lifetime extension of
594 lambda capture-by-copy vars.
595
596 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
597
598 * coroutines.cc (build_co_await): Do not build frame
599 awaitable proxy vars when the co_await expression is
600 a function parameter or local var.
601 (co_await_expander): Do not initialise a frame var with
602 itself.
603 (transform_await_expr): Only substitute the awaitable
604 frame var if it's needed.
605 (register_awaits): Do not make frame copies for param
606 or local vars that are awaitables.
607
608 2020-02-28 Jason Merrill <jason@redhat.com>
609
610 Implement P2092R0, Disambiguating Nested-Requirements
611 * parser.c (cp_parser_requirement_parameter_list): Pass
612 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
613
614 * call.c (build_user_type_conversion_1): Don't look at the second
615 conversion of a non-viable candidate.
616
617 2020-02-28 Jakub Jelinek <jakub@redhat.com>
618
619 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
620 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
621 functions in unevaluated contexts.
622
623 2020-02-27 Nathan Sidwell <nathan@acm.org>
624
625 PR c++/93933
626 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
627 cp_tree_equal.
628 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
629 * typeck.c (comptypes): Assert we don't get any argument packs.
630
631 * class.c (adjust_clone_args): Correct arg-checking assert.
632 * typeck.c (comptypes): Assert not nulls.
633
634 2020-02-26 Marek Polacek <polacek@redhat.com>
635
636 PR c++/93789 - ICE with invalid array bounds.
637 * decl.c (compute_array_index_type_loc): Don't use the folded
638 size when folding cleared TREE_CONSTANT.
639
640 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
641
642 * class.c (classtype_has_non_deleted_copy_ctor): New.
643 * coroutines.cc (struct param_info): Keep track of params
644 that are references, and cache the original type and whether
645 the DTOR is trivial.
646 (build_actor_fn): Handle param copies always, and adjust the
647 handling for references.
648 (register_param_uses): Only handle uses here.
649 (classtype_has_non_deleted_copy_ctor): New.
650 (morph_fn_to_coro): Adjust param copy handling to match n4849
651 by reordering ahead of the promise CTOR and always making a
652 frame copy, even if the param is unused in the coroutine body.
653 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
654
655 2020-02-26 Patrick Palka <ppalka@redhat.com>
656
657 * constraint.cc (finish_constraint_binary_op): Set expr's location range
658 to the range of its operands.
659 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
660 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
661 instead of the corresponding template arguments ARGS and adjust body
662 accordingly.
663 (diagnose_requires_expr): Likewise.
664 (diagnose_atomic_constraint): Likewise. When printing an atomic
665 constraint expression, print the instantiated parameter mapping
666 alongside it.
667 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
668 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
669 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
670
671 2020-02-26 Marek Polacek <polacek@redhat.com>
672
673 PR c++/93676 - value-init crash in template.
674 * init.c (build_new_1): Don't call build_vec_init in a template.
675
676 2020-02-26 Marek Polacek <polacek@redhat.com>
677
678 PR c++/93862 - ICE with static_cast when converting from int[].
679 * call.c (reference_compatible_p): No longer static.
680 * cp-tree.h (reference_compatible_p): Declare.
681 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
682 of reference_related_p.
683
684 2020-02-26 Marek Polacek <polacek@redhat.com>
685
686 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
687 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
688 field.
689
690 2020-02-24 Martin Sebor <msebor@redhat.com>
691
692 PR c++/93804
693 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
694 in shared C/C++ code in headers.
695 Remove a duplicate hunk of code.
696
697 2020-02-24 Marek Polacek <polacek@redhat.com>
698
699 PR c++/93869 - ICE with -Wmismatched-tags.
700 * parser.c (cp_parser_check_class_key): Check class_key earlier.
701
702 2020-02-24 Marek Polacek <polacek@redhat.com>
703
704 PR c++/93712 - ICE with ill-formed array list-initialization.
705 * call.c (next_conversion): Return NULL for ck_aggr.
706 (build_aggr_conv): Set u.expr instead of u.next.
707 (build_array_conv): Likewise.
708 (build_complex_conv): Likewise.
709 (conv_get_original_expr): Handle ck_aggr.
710
711 2020-02-24 Jakub Jelinek <jakub@redhat.com>
712
713 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
714 * call.c (build_over_call): Don't evaluate immediate functions in
715 unevaluated operands.
716
717 2020-02-24 Jason Merrill <jason@redhat.com>
718
719 P0780R2: Resolve lambda init-capture pack grammar.
720 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
721 ...&x=y.
722
723 2020-02-22 Marek Polacek <polacek@redhat.com>
724
725 PR c++/93882
726 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
727
728 2020-02-21 Martin Sebor <msebor@redhat.com>
729
730 PR gcov-profile/93753
731 * class.c (check_flexarrays): Tighten up a test for potential members
732 of anonymous structs or unions.
733
734 2020-02-20 Martin Sebor <msebor@redhat.com>
735
736 PR c++/93801
737 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
738
739 2020-02-20 Martin Liska <mliska@suse.cz>
740
741 PR translation/93841
742 * config/or1k/or1k.opt: Remove superfluous word.
743 * doc/invoke.texi: Likewise.
744
745 2020-02-20 Martin Liska <mliska@suse.cz>
746
747 PR translation/93838
748 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
749
750 2020-02-19 Marek Polacek <polacek@redhat.com>
751
752 PR c++/93169 - wrong-code with a non-constexpr constructor.
753 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
754 on constant CONSTRUCTORs.
755
756 2020-02-15 Marek Polacek <polacek@redhat.com>
757
758 PR c++/93710 - poor diagnostic for array initializer.
759 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
760 for an error call.
761
762 2020-02-15 Jason Merrill <jason@redhat.com>
763
764 PR c++/92556
765 * pt.c (any_template_parm_r): Look into lambda body.
766
767 PR c++/92583
768 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
769
770 2020-02-14 Jakub Jelinek <jakub@redhat.com>
771
772 PR c++/61414
773 * class.c (enum_min_precision): Change prec type from int to int &.
774
775 PR libstdc++/92906
776 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
777 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
778 (fallback_dfloat32_type, fallback_dfloat64_type,
779 fallback_dfloat128_type): Define.
780 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
781 dfloat*_type_node.
782 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
783 is disabled for compatibility.
784
785 2020-02-13 Jason Merrill <jason@redhat.com>
786
787 PR c++/93713
788 * name-lookup.c (matching_fn_p): A function does not match a
789 template.
790
791 PR c++/93643
792 PR c++/91476
793 * tree.c (decl_linkage): Always lk_none for locals.
794
795 2020-02-12 Jason Merrill <jason@redhat.com>
796
797 PR c++/92583
798 PR c++/92654
799 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
800 * pt.c (find_parameter_packs_r): Not here.
801
802 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
803
804 * coroutines.cc (build_actor_fn): Implement deallocation function
805 selection per n4849, dcl.fct.def.coroutine bullet 12.
806 (morph_fn_to_coro): Implement allocation function selection per
807 n4849, dcl.fct.def.coroutine bullets 9 and 10.
808
809 2020-02-12 Marek Polacek <polacek@redhat.com>
810
811 PR c++/93684 - ICE-on-invalid with broken attribute.
812 * parser.c (cp_parser_std_attribute): Peek a token first before
813 consuming it.
814
815 2020-02-11 Jason Merrill <jason@redhat.com>
816
817 PR c++/93675
818 * class.c (add_implicitly_declared_members): Use do_friend.
819 * method.c (implicitly_declare_fn): Fix friend handling.
820 (decl_remember_implicit_trigger_p): New.
821 (synthesize_method): Use it.
822 * decl2.c (mark_used): Use it.
823
824 2020-02-11 Jason Merrill <jason@redhat.com>
825
826 PR c++/93650
827 PR c++/90691
828 * constexpr.c (maybe_constant_value): Correct earlier change.
829 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
830 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
831
832 2020-02-12 Patrick Palka <ppalka@redhat.com>
833
834 PR c++/69448
835 PR c++/80471
836 * type-utils.h (find_type_usage): Refactor to take a tree * and to
837 return a tree *, and update documentation accordingly.
838 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
839 decltype(auto) node.
840 (make_constrained_decltype_auto): No need to explicitly set
841 AUTO_IS_DECLTYPE anymore.
842 (splice_late_return_type): Use find_type_usage to find and
843 replace a possibly nested auto node instead of using is_auto.
844 Check test for is_auto into an assert when deciding whether
845 to late_return_type.
846 (type_uses_auto): Adjust the call to find_type_usage.
847 * parser.c (cp_parser_decltype): No need to explicitly set
848 AUTO_IS_DECLTYPE anymore.
849
850 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
851 (dump_simple_decl): Handle standard concept definitions as well as
852 variable concept definitions.
853
854 2020-02-10 Jakub Jelinek <jakub@redhat.com>
855
856 PR other/93641
857 * error.c (dump_decl_name): Fix up last argument to strncmp.
858
859 2020-02-10 Jason Merrill <jason@redhat.com>
860
861 PR c++/93618
862 * tree.c (array_of_unknown_bound_p): New.
863 * init.c (perform_member_init): Do nothing for flexible arrays.
864
865 2020-02-09 Jakub Jelinek <jakub@redhat.com>
866
867 PR c++/93633
868 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
869 ARRAY_TYPE, use the element type. Punt if objtype after that is not
870 a class type.
871
872 2020-02-08 Jason Merrill <jason@redhat.com>
873
874 PR c++/90691
875 * expr.c (fold_for_warn): Call maybe_constant_value.
876 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
877 (maybe_constant_value): Add uid_sensitive parm.
878 (get_fundef_copy): Don't copy if it's true.
879 (cxx_eval_call_expression): Don't instantiate if it's true.
880 (cxx_eval_outermost_constant_expr): Likewise.
881
882 PR c++/92852
883 * constexpr.c (maybe_constant_value): Don't unshare if the cached
884 value is the same as the argument.
885
886 * typeck.c (maybe_warn_about_returning_address_of_local): Add
887 location parameter.
888
889 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
890 if appropriate.
891
892 2020-02-08 Jakub Jelinek <jakub@redhat.com>
893
894 PR c++/93549
895 * constexpr.c (find_array_ctor_elt): If last element has no index,
896 for flag_checking verify all elts have no index. If i is within the
897 elts, return it directly, if it is right after the last elt, append
898 if NULL index, otherwise force indexes on all elts.
899 (cxx_eval_store_expression): Allow cep->index to be NULL.
900
901 2020-02-07 Marek Polacek <polacek@redhat.com>
902
903 PR c++/92947 - Paren init of aggregates in unevaluated context.
904 * call.c (build_new_method_call_1): Don't check
905 cp_unevaluated_operand. Check the return value of digest_init.
906
907 2020-02-06 Jason Merrill <jason@redhat.com>
908
909 PR c++/92654
910 * tree.c (cp_walk_subtrees): Walk into type template arguments.
911 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
912 instead of TYPE_ALIAS_P.
913 * pt.c (push_template_decl_real): Likewise.
914 (find_parameter_packs_r): Likewise. Remove dead code.
915 * error.c (find_typenames_r): Remove dead code.
916
917 2020-02-06 Jason Merrill <jason@redhat.com>
918
919 PR c++/92517
920 * parser.c (cp_parser_constraint_primary_expression): Do the main
921 parse non-tentatively.
922
923 2020-02-06 Marek Polacek <polacek@redhat.com>
924
925 PR c++/93597 - ICE with lambda in operator function.
926 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
927
928 2020-02-05 Jason Merrill <jason@redhat.com>
929
930 PR c++/93140
931 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
932 handling of TREE_CHAIN for empty pack.
933
934 2020-02-05 Jakub Jelinek <jakub@redhat.com>
935
936 PR c++/93557
937 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
938 prior to passing it to c_build_vec_convert.
939
940 2020-02-05 Marek Polacek <polacek@redhat.com>
941
942 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
943 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
944 TREE_SIDE_EFFECTS.
945
946 2020-02-05 Jason Merrill <jason@redhat.com>
947
948 PR c++/92593
949 * decl.c (grokdeclarator): Reject field of current class type even
950 in a template.
951
952 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
953
954 * coroutines.cc (maybe_promote_captured_temps): Increase the index
955 number for temporary variables' name.
956
957 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
958
959 * coroutines.cc (build_co_await): Call convert_from_reference
960 to wrap co_await_expr with indirect_ref which avoid
961 reference/non-reference type confusion.
962
963 (co_await_expander): Sink to call_expr if await_resume
964 is wrapped by indirect_ref.
965
966 2020-02-04 Jason Merrill <jason@redhat.com>
967
968 PR c++/93551
969 * constraint.cc (satisfy_declaration_constraints): Check return
970 value of push_tinst_level.
971
972 PR c++/90951
973 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
974 elements instead of value-initializing them.
975
976 PR c++/86917
977 * init.c (perform_member_init): Simplify.
978 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
979 flexarray.
980 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
981
982 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
983
984 * coroutines.cc (find_promise_type): Delete unused forward
985 declaration.
986 (struct coroutine_info): Add a bool for no promise type error.
987 (coro_promise_type_found_p): Only emit the error for a missing
988 promise once in each affected coroutine.
989
990 2020-02-03 Jason Merrill <jason@redhat.com>
991
992 PR c++/66477
993 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
994 defer loading the value of a reference.
995
996 2020-02-03 Jason Merrill <jason@redhat.com>
997
998 PR c++/91953
999 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
1000 empty class type.
1001 [COMPONENT_REF]: A member function reference doesn't use the object
1002 as an rvalue.
1003
1004 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
1005
1006 PR c++/93458
1007 * coroutines.cc (struct coroutine_info): Add a bool flag to note
1008 that we emitted an error for a bad function return type.
1009 (get_coroutine_info): Tolerate an unset info table in case of
1010 missing traits.
1011 (find_coro_traits_template_decl): In case of error or if we didn't
1012 find a type template, note we emitted the error and suppress
1013 duplicates.
1014 (find_coro_handle_template_decl): Likewise.
1015 (instantiate_coro_traits): Only check for error_mark_node in the
1016 return from lookup_qualified_name.
1017 (coro_promise_type_found_p): Reorder initialization so that we check
1018 for the traits and their usability before allocation of the info
1019 table. Check for a suitable return type and emit a diagnostic for
1020 here instead of relying on the lookup machinery. This allows the
1021 error to have a better location, and means we can suppress multiple
1022 copies.
1023 (coro_function_valid_p): Re-check for a valid promise (and thus the
1024 traits) before proceeding. Tolerate missing info as a fatal error.
1025
1026 2020-02-03 Jason Merrill <jason@redhat.com>
1027
1028 PR c++/88256
1029 * cp-gimplify.c (predeclare_vla): New.
1030 (cp_genericize_r) [NOP_EXPR]: Call it.
1031
1032 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
1033
1034 * coroutines.cc (transform_await_wrapper): Set actor funcion as
1035 new context of label_decl.
1036 (build_actor_fn): Fill new field of await_xform_data.
1037
1038 2020-02-02 Marek Polacek <polacek@redhat.com>
1039
1040 PR c++/93530 - ICE on invalid alignas in a template.
1041 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
1042 decl_attributes.
1043
1044 2020-01-31 Jason Merrill <jason@redhat.com>
1045
1046 PR c++/86216
1047 * semantics.c (process_outer_var_ref): Capture VLAs even in
1048 unevaluated context.
1049
1050 PR c++/14179
1051 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
1052 non-aggregate elements.
1053 (reshape_init_array): Add first_initializer_p parm.
1054 (reshape_init_r): Change first_initializer_p from bool to tree.
1055 (reshape_init): Pass init to it.
1056
1057 PR c++/14179
1058 * parser.c (cp_parser_initializer_list): Suppress location wrappers
1059 after 256 elements.
1060
1061 2020-01-29 Jason Merrill <jason@redhat.com>
1062
1063 PR c++/82521
1064 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
1065 the expression was dependent before substitution.
1066
1067 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
1068
1069 * coroutines.cc (act_des_fn): New.
1070 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
1071 Access promise via actor function's frame pointer argument.
1072 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
1073
1074 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
1075
1076 * coroutines.cc (co_await_expander): Handle type conversion case.
1077
1078 2020-01-29 Jason Merrill <jason@redhat.com>
1079
1080 PR c++/90333
1081 PR c++/89640
1082 PR c++/60503
1083 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
1084 a trailing return type.
1085 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
1086 parens.
1087
1088 2020-01-29 Marek Polacek <polacek@redhat.com>
1089
1090 PR c++/91754 - Fix template arguments comparison with class NTTP.
1091 * pt.c (class_nttp_const_wrapper_p): New.
1092 (template_args_equal): See through class_nttp_const_wrapper_p
1093 arguments.
1094
1095 2020-01-29 Marek Polacek <polacek@redhat.com>
1096
1097 PR c++/92948 - Fix class NTTP with template arguments.
1098 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
1099 converting a value-dependent expression to a class type.
1100 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
1101 as the result of the tsubst_copy call.
1102
1103 2020-01-29 Jakub Jelinek <jakub@redhat.com>
1104
1105 PR c++/91118
1106 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
1107 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
1108
1109 2020-01-28 Jason Merrill <jason@redhat.com>
1110
1111 PR c++/93442
1112 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
1113
1114 PR c++/93477
1115 PR c++/91476
1116 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
1117
1118 PR c++/90546
1119 * call.c (build_user_type_conversion_1): Allow a template conversion
1120 returning an rvalue reference to bind directly to an lvalue.
1121
1122 PR c++/90731
1123 * decl.c (grokdeclarator): Propagate eh spec from typedef.
1124
1125 2020-01-28 Martin Liska <mliska@suse.cz>
1126
1127 PR c++/92440
1128 * pt.c (redeclare_class_template): Group couple of
1129 errors and inform messages with auto_diagnostic_group.
1130
1131 2020-01-28 Martin Liska <mliska@suse.cz>
1132
1133 PR c++/92440
1134 * pt.c (redeclare_class_template): Use inform
1135 for the second location.
1136
1137 2020-01-27 Jason Merrill <jason@redhat.com>
1138
1139 PR c++/90966
1140 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
1141
1142 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
1143
1144 PR c++/93443
1145 * coroutines.cc (morph_fn_to_coro): Check the ramp return
1146 value when it is constructed from the 'get return object'.
1147
1148 2020-01-27 Nathan Sidwell <nathan@acm.org>
1149
1150 PR c++/91826
1151 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
1152
1153 2020-01-26 Jason Merrill <jason@redhat.com>
1154
1155 PR c++/90992
1156 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
1157 temporarily enable -Wsystem-headers. Change second warning to
1158 conditional inform.
1159
1160 PR c++/90997
1161 * semantics.c (finish_call_expr): Don't call
1162 instantiate_non_dependent_expr before warn_for_memset.
1163
1164 2020-01-25 Marek Polacek <polacek@redhat.com>
1165
1166 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
1167 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
1168 dynamic_cast diagnostic.
1169
1170 2020-01-24 Jason Merrill <jason@redhat.com>
1171
1172 PR c++/93400 - ICE with constrained friend.
1173 * constraint.cc (maybe_substitute_reqs_for): New.
1174 * decl.c (function_requirements_equivalent_p): Call it.
1175 * pt.c (tsubst_friend_function): Only substitute
1176 TEMPLATE_PARMS_CONSTRAINTS.
1177 (tsubst_template_parms): Copy constraints.
1178
1179 2020-01-24 Jason Merrill <jason@redhat.com>
1180
1181 PR c++/93279 - ICE with lambda in member operator.
1182 * name-lookup.c (maybe_save_operator_binding): Don't remember
1183 class-scope bindings.
1184
1185 2020-01-24 Jason Merrill <jason@redhat.com>
1186
1187 PR c++/93377 - ICE with member alias in constraint.
1188 * pt.c (any_template_parm_r): Look at template arguments for all
1189 aliases, not only alias templates.
1190
1191 2020-01-24 Marek Polacek <polacek@redhat.com>
1192
1193 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
1194 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
1195
1196 2020-01-24 Jason Merrill <jason@redhat.com>
1197
1198 PR c++/92852 - ICE with generic lambda and reference var.
1199 * constexpr.c (maybe_constant_value): Likewise.
1200
1201 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
1202
1203 PR c++/92804
1204 * parser.c (cp_parser_nested_name_specifier_opt): Properly
1205 diagnose concept-ids.
1206
1207 2020-01-23 Jason Merrill <jason@redhat.com>
1208
1209 PR c++/93331 - ICE with __builtin_strchr.
1210 * constexpr.c (cxx_eval_builtin_function_call): Use the original
1211 argument if we didn't manage to extract a STRING_CST.
1212
1213 PR c++/93345 - ICE with defaulted dtor and template.
1214 PR c++/33799
1215 * decl.c (cxx_maybe_build_cleanup): Don't try to set
1216 throwing_cleanup in a template.
1217
1218 2020-01-22 Marek Polacek <polacek@redhat.com>
1219
1220 PR c++/92907 - noexcept does not consider "const" in member functions.
1221 * g++.dg/cpp0x/noexcept56.C: New test.
1222
1223 2020-01-22 Marek Polacek <polacek@redhat.com>
1224
1225 PR c++/93324 - ICE with -Wall on constexpr if.
1226 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
1227
1228 2020-01-22 Patrick Palka <ppalka@redhat.com>
1229
1230 * constraint.cc (get_mapped_args): Avoid using auto_vec
1231 as a vector element. Release the vectors inside the lists
1232 vector.
1233 * parser.c (cp_literal_operator_id): Free the buffer.
1234
1235 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
1236
1237 * coroutines.cc (finish_co_await_expr): Add error check on return
1238 value of build_co_await.
1239 (finish_co_yield_expr,): Ditto.
1240
1241 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
1242
1243 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
1244 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
1245 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
1246
1247 2020-01-21 Jason Merrill <jason@redhat.com>
1248
1249 PR c++/60855 - ICE with sizeof VLA capture.
1250 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
1251
1252 PR c++/90732 - ICE with VLA capture and generic lambda.
1253 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
1254
1255 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
1256 Bin Cheng <bin.cheng@linux.alibaba.com>
1257
1258 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
1259 from complete_type_or_else.
1260 (register_param_uses): Likewise.
1261 (build_co_await): Do not try to use complete_type_or_else for void
1262 types, otherwise for incomplete types, check for NULL return from
1263 complete_type_or_else.
1264
1265 2020-01-21 Jason Merrill <jason@redhat.com>
1266
1267 PR c++/91476 - anon-namespace reference temp clash between TUs.
1268 * decl2.c (copy_linkage): Factor out of get_guard.
1269 * call.c (make_temporary_var_for_ref_to_temp): Use it.
1270 * decl.c (cp_finish_decomp): Use it.
1271 (cp_finish_decl): determine_visibility sooner.
1272
1273 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
1274
1275 * coroutines.cc (finish_co_await_expr): Set return value flag.
1276 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
1277
1278 2020-01-19 Jason Merrill <jason@redhat.com>
1279
1280 PR c++/33799 - destroy return value, take 2.
1281 * cp-tree.h (current_retval_sentinel): New macro.
1282 (struct language_function): Add throwing_cleanup bitfield.
1283 * decl.c (cxx_maybe_build_cleanup): Set it.
1284 * except.c (maybe_set_retval_sentinel)
1285 (maybe_splice_retval_cleanup): New functions.
1286 * parser.c (cp_parser_compound_statement): Call
1287 maybe_splice_retval_cleanup.
1288 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
1289
1290 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
1291
1292 2020-01-18 Jakub Jelinek <jakub@redhat.com>
1293
1294 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
1295 but non-NO_DOLLAR_IN_LABEL case build.
1296
1297 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
1298
1299 * Make-lang.in: Add coroutines.o.
1300 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
1301 (DECL_COROUTINE_P): New.
1302 * lex.c (init_reswords): Enable keywords when the coroutine flag
1303 is set,
1304 * operators.def (co_await): New operator.
1305 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
1306 (op_error): Likewise.
1307 (build_new_op_1): Likewise.
1308 (build_new_function_call): Validate coroutine builtin arguments.
1309 * constexpr.c (potential_constant_expression_1): Handle
1310 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
1311 * coroutines.cc: New file.
1312 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
1313 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
1314 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
1315 * cp-tree.h (coro_validate_builtin_call): New.
1316 * decl.c (emit_coro_helper): New.
1317 (finish_function): Handle the case when a function is found to
1318 be a coroutine, perform the outlining and emit the outlined
1319 functions. Set a bit to signal that this is a coroutine component.
1320 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
1321 (cp_parser_unary_expression): Handle co_await.
1322 (cp_parser_assignment_expression): Handle co_yield.
1323 (cp_parser_statement): Handle RID_CO_RETURN.
1324 (cp_parser_jump_statement): Handle co_return.
1325 (cp_parser_operator): Handle co_await operator.
1326 (cp_parser_yield_expression): New.
1327 (cp_parser_required_error): Handle RT_CO_YIELD.
1328 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
1329 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
1330 CO_RETURN_EXPRs.
1331 * tree.c (cp_walk_subtrees): Likewise.
1332
1333 2020-01-17 Jason Merrill <jason@redhat.com>
1334
1335 PR c++/92531 - ICE with noexcept(lambda).
1336 * pt.c (uses_template_parms): Don't try to enumerate all the
1337 expression cases.
1338
1339 2020-01-17 Jakub Jelinek <jakub@redhat.com>
1340
1341 PR c++/93228
1342 * parser.c (cp_parser_template_name): Look up deprecated attribute
1343 in DECL_TEMPLATE_RESULT or its type's attributes.
1344
1345 2020-01-16 Jason Merrill <jason@redhat.com>
1346
1347 PR c++/93286 - ICE with __is_constructible and variadic template.
1348 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
1349 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
1350
1351 PR c++/93280 - ICE with aggregate assignment and DMI.
1352 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
1353 * typeck2.c (digest_nsdmi_init): Not here.
1354
1355 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
1356
1357 PR c++/91073
1358 * cp-tree.h (is_constrained_auto): New.
1359 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
1360 handle concept-check expressions; take a cp_decl_specifier_seq*
1361 instead of a bool.
1362 (cp_parser_condition): Update call.
1363 (cp_parser_simple_declaration): Likewise.
1364 (cp_parser_placeholder_type_specifier): Correctly handle
1365 concept-check expressions.
1366
1367 2020-01-15 Jason Merrill <jason@redhat.com>
1368
1369 Revert
1370 PR c++/33799 - destroy return value if local cleanup throws.
1371 * cp-tree.h (current_retval_sentinel): New macro.
1372 * decl.c (start_preparsed_function): Set up cleanup for retval.
1373 * typeck.c (check_return_expr): Set current_retval_sentinel.
1374
1375 PR c++/93257 - consteval void function.
1376 * constexpr.c (verify_constant): Allow void_node.
1377
1378 PR c++/92871 - bad code with xvalue and GNU ?: extension.
1379 * call.c (prevent_lifetime_extension): New.
1380 (build_conditional_expr_1): Use it.
1381
1382 2020-01-14 Nathan Sidwell <nathan@acm.org>
1383
1384 PR c++/90916
1385 * pt.c (retrieve_specialization): Use get_template_info, not open
1386 coding access.
1387
1388 PR c++/90916
1389 * pt.c (retrieve_specialization): Get the TI from the decl or the
1390 classtype as appropriate.
1391
1392 2020-01-14 David Malcolm <dmalcolm@redhat.com>
1393
1394 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
1395 New static constant.
1396 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
1397 (struct named_label_hash::empty_zero_p): Likewise.
1398 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
1399
1400 2020-01-14 Jason Merrill <jason@redhat.com>
1401
1402 PR c++/92590 - wrong handling of inherited default ctor.
1403 * class.c (add_method): A constrained inherited ctor doesn't hide an
1404 implicit derived ctor.
1405 Revert:
1406 PR c++/92552 - ICE with inherited constrained default ctor.
1407 * pt.c (instantiate_class_template_1): Copy
1408 TYPE_HAS_USER_CONSTRUCTOR.
1409 PR c++/91930 - ICE with constrained inherited default ctor.
1410 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
1411 for inherited constructor.
1412 PR c++/92594 - ICE with inherited trivial default ctor.
1413 * method.c (trivial_fn_p): Treat an inherited default constructor
1414 like a normal default constructor.
1415
1416 PR c++/92594 - ICE with inherited trivial default ctor.
1417 * method.c (trivial_fn_p): Treat an inherited default constructor
1418 like a normal default constructor.
1419
1420 PR c++/92009 - ICE with punning of typeid.
1421 * rtti.c (get_tinfo_desc): Call xref_basetypes.
1422 * constexpr.c (cxx_fold_indirect_ref): Don't strip
1423 REINTERPRET_CAST_P.
1424
1425 2020-01-13 Jason Merrill <jason@redhat.com>
1426
1427 PR c++/92746 - ICE with noexcept of function concept check.
1428 * except.c (check_noexcept_r): Handle concept-check.
1429
1430 PR c++/92582 - ICE with member template as requirement.
1431 * pt.c (struct find_template_parameter_info): Add ctx_parms.
1432 (any_template_parm_r): Handle TEMPLATE_DECL.
1433 (find_template_parameters): Take parms instead of their depth.
1434 * constraint.cc (build_parameter_mapping): Pass them.
1435
1436 PR c++/33799 - destroy return value if local cleanup throws.
1437 * cp-tree.h (current_retval_sentinel): New macro.
1438 * decl.c (start_preparsed_function): Set up cleanup for retval.
1439 * typeck.c (check_return_expr): Set current_retval_sentinel.
1440
1441 PR c++/93238 - short right-shift with enum.
1442 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
1443
1444 2020-01-10 Jason Merrill <jason@redhat.com>
1445
1446 * typeck.c (cp_build_binary_op): Restore short_shift code.
1447
1448 PR c++/93143 - incorrect tree sharing with constexpr.
1449 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
1450 CONSTRUCTORs are already unshared.
1451
1452 PR c++/93173 - incorrect tree sharing.
1453 PR c++/93033
1454 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
1455 copy_if_shared after cp_genericize_tree.
1456 * typeck2.c (split_nonconstant_init): Don't unshare here.
1457
1458 2020-01-08 Jason Merrill <jason@redhat.com>
1459
1460 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
1461 TARGET_EXPR_DIRECT_INIT_P.
1462 * constexpr.c (cxx_eval_constant_expression): Likewise.
1463
1464 2020-01-08 Jason Merrill <jason@redhat.com>
1465
1466 PR c++/91369 - constexpr destructor and member initializer.
1467 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
1468 when not preevaluating.
1469
1470 2020-01-08 Jason Merrill <jason@redhat.com>
1471
1472 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
1473 support.
1474
1475 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
1476
1477 * init.c (build_new): Add location_t parameter and use it throughout.
1478 (build_raw_new_expr): Likewise.
1479 * parser.c (cp_parser_new_expression): Pass the combined_loc.
1480 * pt.c (tsubst_copy_and_build): Adjust call.
1481 * cp-tree.h: Update declarations.
1482
1483 2020-01-07 Jason Merrill <jason@redhat.com>
1484
1485 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
1486 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
1487 explicit class visibility for a template.
1488
1489 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
1490
1491 * mangle.c (mangle_type_attribute_p): New function, split out from...
1492 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
1493 that contain a space.
1494
1495 2020-01-07 Jakub Jelinek <jakub@redhat.com>
1496
1497 PR c++/91369
1498 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
1499 member, initialize it to zero in ctor.
1500 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
1501 a heap object. Don't cache calls to functions which allocate some
1502 heap objects and don't deallocate them or deallocate some heap
1503 objects they didn't allocate.
1504
1505 2020-01-06 Jason Merrill <jason@redhat.com>
1506
1507 PR c++/92552 - ICE with inherited constrained default ctor.
1508 * pt.c (instantiate_class_template_1): Copy
1509 TYPE_HAS_USER_CONSTRUCTOR.
1510 * class.c (one_inherited_ctor): Don't set it here.
1511
1512 2020-01-06 Andrew Sutton <asutton@lock3software.com>
1513
1514 PR c++/92739 - parsing requires clause with attributes.
1515 * parser.c (cp_parser_constraint_requires_parens): Exclude
1516 attributes as postfix expressions.
1517
1518 2020-01-05 Jakub Jelinek <jakub@redhat.com>
1519
1520 PR c++/93138
1521 * parser.c (cp_parser_check_class_key): Disable access checks for the
1522 simple name lookup.
1523 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
1524 !warn_redundant_tags.
1525
1526 2010-01-05 Jakub Jelinek <jakub@redhat.com>
1527
1528 PR c++/93046
1529 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
1530 TARGET_EXPR if it has been gimplified already.
1531
1532 2020-01-03 Jason Merrill <jason@redhat.com>
1533
1534 PR c++/93033 - incorrect tree node sharing with array init.
1535 * typeck2.c (split_nonconstant_init): Unshare non-decl.
1536 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
1537
1538 2020-01-02 Jason Merrill <jason@redhat.com>
1539
1540 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
1541 C++17.
1542
1543 2020-01-02 Jakub Jelinek <jakub@redhat.com>
1544
1545 PR c/90677
1546 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
1547 has not been found, rather than error_mark_node.
1548
1549 2020-01-01 Jakub Jelinek <jakub@redhat.com>
1550
1551 Update copyright years.
1552 \f
1553 Copyright (C) 2020 Free Software Foundation, Inc.
1554
1555 Copying and distribution of this file, with or without modification,
1556 are permitted in any medium without royalty provided the copyright
1557 notice and this notice are preserved.