1 2020-05-06 Jakub Jelinek <jakub@redhat.com>
4 * method.c (defaulted_late_check): Don't call synthesize_method
5 on constexpr sfk_comparison if it has been called on it already.
7 2020-05-06 Nathan Sidwell <nathan@acm.org>
10 * decl.c (grokdeclarator): Don't splice template attributes in
11 parm context -- they can apply to the parm.
13 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
15 * coroutines.cc: Remove references to n4849 throughout.
17 2020-05-05 Jason Merrill <jason@redhat.com>
20 * pt.c (more_specialized_fn): Do consider parms with no deducible
23 2020-05-05 Jason Merrill <jason@redhat.com>
26 * constexpr.c (potential_constant_expression_1): In a lambda
27 function, consider a captured variable directly.
29 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
31 * coroutines.cc (transform_await_wrapper): Check that we have
32 no unlowered co_yields.
33 (captures_temporary): Likewise.
34 (register_awaits): Likewise.
36 2020-05-05 Nathan Sidwell <nathan@acm.org>
39 * coroutines.cc (morph_fn_to_coro): Just check for
41 * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name.
43 2020-05-05 Marek Polacek <polacek@redhat.com>
44 Jason Merrill <jason@redhat.com>
47 * parser.c (cp_parser_postfix_dot_deref_expression): If we have
48 a type-dependent object of class type, stash it to
49 parser->context->object_type. If the postfix expression doesn't have
51 (cp_parser_class_name): Consider object scope too.
52 (cp_parser_lookup_name): Remove code dealing with the case when
53 object_type is unknown_type_node.
55 2020-05-04 Patrick Palka <ppalka@redhat.com>
58 * cp-gimplify.c (cp_fold) <case CALL_EXPR>: Move some variable
59 declarations closer to their uses. Copy the CALL_EXPR only
60 when one of its arguments has changed.
61 <case TREE_VEC>: Instead of first collecting the folded
62 arguments into a releasing_vec, just make a copy of the TREE_VEC
63 as soon as folding changes one of its arguments.
65 2020-05-04 Iain Sandoe <iain@sandoe.co.uk>
67 * coroutines.cc (morph_fn_to_coro): Mark the coro.gro variable
68 as artificial and ignored.
70 2020-05-04 Nathan Sidwell <nathan@acm.org>
72 pt.c (process_template_parm): Don't walk the template list twice,
73 remember the final node instead.
74 (end_template_parm_list): Refactor. Comment on why we do a pop
77 PR c++/94827 -- don't save parms in nested requirement
78 * constraint.cc (tsubst_nested_requirement): TYPE directly holds
79 notmalized requirement.
80 (finish_nested_requirement): Don't stash current tpl parms into
82 (diagnose_nested_requirement): TYPE directly holds notmalized
85 2020-05-01 Patrick Palka <ppalka@redhat.com>
88 * cp-tree.h (check_accessibility_of_qualified_id): Add
89 tsubst_flags_t parameter and change return type to bool.
90 * parser.c (cp_parser_lookup_name): Pass tf_warning_to_error to
91 check_accessibility_of_qualified_id.
92 * pt.c (tsubst_qualified_id): Return error_mark_node if
93 check_accessibility_of_qualified_id returns false.
94 * semantics.c (check_accessibility_of_qualified_id): Add
95 complain parameter. Pass complain instead of
96 tf_warning_or_error to perform_or_defer_access_check. Return
97 true unless perform_or_defer_access_check returns false.
99 2020-05-01 Marek Polacek <polacek@redhat.com>
102 * typeck2.c (process_init_constructor_record): Return PICFLAG_ERRONEOUS
103 if an initializer element was erroneous.
105 2020-05-01 Jason Merrill <jason@redhat.com>
108 * init.c (get_nsdmi): Don't push_to_top_level for a local class.
110 2020-05-01 Jason Merrill <jason@redhat.com>
113 * decl.c (cp_finish_decl): Also clear TREE_READONLY if
114 -fmerge-all-constants.
116 2020-05-01 Jason Merrill <jason@redhat.com>
119 * pt.c (tsubst_decl): Make sure DECL_VALUE_EXPR continues to have
120 the same type as the variable.
122 2020-04-30 Jason Merrill <jason@redhat.com>
123 Nathan Sidwell <nathan@acm.org>
126 * constraint.cc (map_arguments): If ARGS is null, it's a
127 self-mapping of parms.
128 (finish_nested_requirement): Do not pass argified
129 current_template_parms to normalization.
130 (tsubst_nested_requirement): Don't assert no template parms.
132 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
135 * coroutines.cc (transform_local_var_uses): Defer walking
136 the DECL_INITIALs of BIND_EXPR vars until all the frame
137 allocations have been made.
139 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
142 * coroutines.cc (register_awaits): Update target
143 expressions for awaitable and suspend handle
146 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
149 * coroutines.cc (build_co_await): Account for variables
150 with DECL_VALUE_EXPRs.
151 (captures_temporary): Likewise.
152 (register_awaits): Likewise.
154 2020-04-29 Patrick Palka <ppalka@redhat.com>
157 * pt.c (find_template_parameter_info::parm_list): New field.
158 (keep_template_parm): Use the new field to build up the
159 parameter list here instead of ...
160 (find_template_parameters): ... here. Return ftpi.parm_list.
162 2020-04-29 Jakub Jelinek <jakub@redhat.com>
165 * class.c (build_base_field): Set DECL_FIELD_ABI_IGNORED on C++17 empty
166 base artificial FIELD_DECLs.
167 (layout_class_type): Set DECL_FIELD_ABI_IGNORED on empty class
168 field_poverlapping_p FIELD_DECLs.
170 2020-04-29 Patrick Palka <ppalka@redhat.com>
173 * constraint.cc (satisfy_declaration_constraints): Use saved_t
174 instead of t as the key to decl_satisfied_cache.
177 * error.c (print_requires_expression_info): Print the dependent
178 form of the parameter list with its template parameter mapping,
179 rather than printing the substituted form.
181 2020-04-28 Jason Merrill <jason@redhat.com>
184 * decl.c (use_eh_spec_block): Check nothrow type after
186 * pt.c (maybe_instantiate_noexcept): Call synthesize_method for
187 DECL_MAYBE_DELETED fns here.
188 * decl2.c (mark_used): Not here.
189 * method.c (get_defaulted_eh_spec): Reject DECL_MAYBE_DELETED here.
191 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
194 * coroutines.cc (instantiate_coro_traits): Pass a reference to
195 object type rather than a pointer type for 'this', for method
197 (struct param_info): Add a field to hold that the parm is a lambda
199 (morph_fn_to_coro): Check for lambda closure pointers in the
200 args. Use a reference to *this when building the args list for the
201 promise allocator lookup.
203 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
206 * coroutines.cc (coro_promise_type_found_p): Do not
207 exclude non-classes here (this needs to be handled in the
209 (morph_fn_to_coro): Allow for the case where the coroutine
212 2020-04-27 Iain Sandoe <iain@sandoe.co.uk>
215 * coroutines.cc (struct local_var_info): Add fields for static
216 variables and those with DECL_VALUE_EXPR redirection.
217 (transform_local_var_uses): Skip past typedefs and static vars
218 and then account for redirected variables.
219 (register_local_var_uses): Likewise.
221 2020-04-27 Jason Merrill <jason@redhat.com>
225 * decl.c (grokdeclarator): Move dependent attribute to decl.
226 * decl2.c (splice_template_attributes): No longer static.
228 2020-04-27 Patrick Palka <ppalka@redhat.com>
231 * constexpr.c (cxx_eval_call_expression): Don't set new_obj if we're
232 evaluating the target constructor of a delegating constructor.
233 (cxx_eval_store_expression): Don't set TREE_READONLY if the LHS of the
234 INIT_EXPR is '*this'.
236 2020-04-26 Marek Polacek <polacek@redhat.com>
239 * call.c (struct conversion): Add copy_init_p.
240 (standard_conversion): Set copy_init_p in ck_base and ck_rvalue
241 if FLAGS demands LOOKUP_ONLYCONVERTING.
242 (convert_like_real) <case ck_base>: If copy_init_p is set, or
243 LOOKUP_ONLYCONVERTING into FLAGS.
245 2020-04-26 Iain Sandoe <iain@sandoe.co.uk>
248 * coroutines.cc (morph_fn_to_coro): Ensure that
249 unnamed function params have a usable and distinct
252 2020-04-24 Jason Merrill <jason@redhat.com>
255 * decl.c (redeclaration_error_message): Reject defaulted comparison
256 operator that has been previously declared.
258 2020-04-25 Patrick Palka <ppalka@redhat.com>
260 * parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
261 concepts if the invalid identifier is 'requires'.
263 2020-04-25 Jakub Jelinek <jakub@redhat.com>
266 * semantics.c (finish_call_expr): When looking if all overloads
267 are noreturn, use STRIP_TEMPLATE to look through TEMPLATE_DECLs.
269 2020-04-24 Martin Liska <mliska@suse.cz>
271 * coroutines.cc: Fix compilation error for release checking
272 where we miss declaration of ‘coro_body_contains_bind_expr_p’.
274 2020-04-23 Patrick Palka <ppalka@redhat.com>
276 * tree.c (zero_init_expr_p): Use uses_template_parms instead of
280 * pt.c (template_class_depth): Walk into the DECL_FRIEND_CONTEXT of a
281 friend declaration rather than into its CP_DECL_CONTEXT.
283 2020-04-23 Iain Sandoe <iain@sandoe.co.uk>
286 * coroutines.cc (await_statement_expander): Simplify cases.
287 (struct susp_frame_data): Add fields for truth and/or if
288 cases, rename one field.
289 (analyze_expression_awaits): New.
290 (expand_one_truth_if): New.
291 (add_var_to_bind): New helper.
292 (coro_build_add_if_not_cond_break): New helper.
293 (await_statement_walker): Handle conditional expressions,
294 handle expansion of truth-and/or-if cases.
295 (bind_expr_find_in_subtree): New, checking-only.
296 (coro_body_contains_bind_expr_p): New, checking-only.
297 (morph_fn_to_coro): Ensure that we have a top level bind
300 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
303 * class.c (check_field_decls): Change "define" to "declare" in
304 -Weffc++ diagnostics.
306 2020-04-22 Patrick Palka <ppalka@redhat.com>
310 * constraint.cc (satisfy_declaration_constraints): If the inherited
311 constructor points to an instantiation of a constructor template,
312 remember and use its attached template arguments.
314 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
317 * class.c (check_field_decls): Change "override" to "define" in
318 -Weffc++ diagnostics.
320 2020-04-22 Iain Sandoe <iain@sandoe.co.uk>
323 * coroutines.cc (struct param_info): Add a field to note that
325 (morph_fn_to_coro): Convert this to a reference before using it
326 in the promise parameter preview.
328 2020-04-22 Jason Merrill <jason@redhat.com>
331 * pt.c (register_parameter_specializations): If the instantiation is
332 still a parameter pack, don't wrap it in a NONTYPE_ARGUMENT_PACK.
333 (tsubst_pack_expansion, tsubst_expr): Adjust.
335 2020-04-22 Martin Sebor <msebor@redhat.com>
336 Jason Merrill <jason@redhat.com>
339 * decl.c (reshape_init_array_1): Avoid stripping redundant trailing
341 * mangle.c (write_expression): ...and handle them here even for
342 pointers to members by calling zero_init_expr_p.
343 * cp-tree.h (zero_init_expr_p): Declare.
344 * tree.c (zero_init_expr_p): Define.
345 (type_initializer_zero_p): Remove.
346 * pt.c (tparm_obj_values): New hash_map.
347 (get_template_parm_object): Store to it.
348 (tparm_object_argument): New.
350 2020-04-22 Patrick Palka <ppalka@redhat.com>
353 * constraint.cc (diagnose_valid_expression): Check convert_to_void here
354 as well as in tsubst_valid_expression_requirement.
356 2020-04-21 Patrick Palka <ppalka@redhat.com>
359 * constraint.cc (satisfy_declaration_constraints): Don't strip the
360 inherited constructor if it already has template information.
363 * pt.c (any_template_parm_r) <case IDENTIFIER_NODE>: New case. If this
364 is a conversion operator, visit its TREE_TYPE.
366 2020-04-21 Nathan Sidwell <nathan@acm.org>
368 * pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for
371 2020-04-21 Iain Sandoe <iain@sandoe.co.uk>
374 * coroutines.cc (morph_fn_to_coro): Simplify return
377 2020-04-17 Marek Polacek <polacek@redhat.com>
380 * constexpr.c (cxx_eval_outermost_constant_expr): Return when T is
381 a BRACE_ENCLOSED_INITIALIZER_P.
382 (is_nondependent_constant_expression): Don't check
383 BRACE_ENCLOSED_INITIALIZER_P.
384 (is_nondependent_static_init_expression): Likewise.
386 2020-04-20 Patrick Palka <ppalka@redhat.com>
389 * cp-tree.h (lss_policy::lss_nop): New enumerator.
390 * pt.c (local_specialization_stack::local_specialization_stack): Handle
392 (local_specialization_stack::~local_specialization_stack): Likewise.
393 (tsubst_pack_expansion): Use a local_specialization_stack instead of
394 manually saving and restoring local_specializations. Conditionally
395 replace local_specializations sooner, before the handling of the
396 unsubstituted_packs case.
398 2020-04-20 Marek Polacek <polacek@redhat.com>
400 PR c++/94505 - bogus -Wparentheses warning with fold-expression.
401 * pt.c (fold_expression): Add warning_sentinel for -Wparentheses
402 before calling build_x_binary_op.
404 2020-04-20 Marek Polacek <polacek@redhat.com>
406 * coroutines.cc (captures_temporary): Don't assign the result of
407 STRIP_NOPS to the same variable.
409 2020-04-20 Nathan Sidwell <nathan@acm.org>
411 PR c++/94454 - tpl-tpl-parms are not canonicalizable types
412 * pt.c (canonical_type_parameter): Assert not a tpl-tpl-parm.
413 (process_template_parm): tpl-tpl-parms are structural.
414 (rewrite_template_parm): Propagate structuralness.
416 PR c++/94454 - Expr pack expansion equality
417 * tree.c (cp_tree_equal) [TEMPLATE_ID_EXPR, default]: Refactor.
418 [EXPR_PACK_EXPANSION]: Add.
420 PR c++/94454 Template Argument Hashing
421 * pt.c (iterative_hash_template_arg): Strip nodes as
422 template_args_equal does.
423 [ARGUMENT_PACK_SELECT, TREE_VEC, CONSTRUCTOR]: Refactor.
424 [node_class:TEMPLATE_TEMPLATE_PARM]: Hash by level & index.
425 [node_class:default]: Refactor.
427 2020-04-18 Patrick Palka <ppalka@redhat.com>
430 * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
431 comparing_specializations if the parameters' contexts are identical.
434 * pt.c (splice_late_return_type): Propagate cv-qualifiers and
435 PLACEHOLDER_TYPE_CONSTRAINTS from the original auto node to the new one.
437 2020-04-17 Patrick Palka <ppalka@redhat.com>
440 * lambda.c (lambda_capture_field_type): Avoid doing auto deduction if
441 the explicit initializer has parameter packs.
444 * parser.c (cp_parser_check_template_parameters): Before issuing a hard
445 error, first try simulating an error instead.
447 2020-04-17 Jakub Jelinek <jakub@redhat.com>
450 * call.c (build_conditional_expr_1): Remove redundant assignment to
453 2020-04-16 Patrick Palka <ppalka@redhat.com>
456 * cvt.c (ocp_convert): If the result of scalar_constant_value is
457 erroneous, ignore it and use the original expression.
459 2020-04-16 Jakub Jelinek <jakub@redhat.com>
462 * parser.c (cp_parser_simple_declaration): Fix up a pasto in
465 2020-04-15 Jakub Jelinek <jakub@redhat.com>
468 * parser.c (cp_parser_pragma) <case PRAGMA_OMP_REQUIRES>: Reject
469 requires directive when not at file or namespace scope.
471 2020-04-14 Iain Sandoe <iain@sandoe.co.uk>
474 * coroutines.cc (build_actor_fn): Check that the target can
475 support the resume tailcall before mandating it.
477 2020-04-14 Patrick Palka <ppalka@redhat.com>
480 * cxx-pretty-print.c (cxx_pretty_printer:simple_type_specifier)
481 <case DECLTYPE_TYPE>: Handle DECLTYPE_TYPE here instead of ...
482 (pp_cxx_type_specifier_seq) <case DECLTYPE_TYPE>: ... here.
483 (cxx_pretty_printer::direct_abstract_declarator) <case DECLTYPE_TYPE>:
487 * constexpr.c (replace_result_decl_data): New struct.
488 (replace_result_decl_data_r): New function.
489 (replace_result_decl): New function.
490 (cxx_eval_call_expression): Use it.
491 * tree.c (build_aggr_init_expr): Set the location of the AGGR_INIT_EXPR
492 to that of its initializer.
494 2020-04-13 Marek Polacek <polacek@redhat.com>
497 * name-lookup.c (check_local_shadow): Add an inform call.
499 2020-04-13 Patrick Palka <ppalka@redhat.com>
502 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
503 dump_function_decl when printing a function template instantiation as a
507 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
509 (cxx_eval_bare_aggregate): Use get_or_insert_ctor_field instead of
510 assuming the the next index belongs at the end of the new CONSTRUCTOR.
511 (cxx_eval_store_expression): Revert PR c++/78572 fix.
513 2020-04-13 Nathan Sidwell <nathan@acm.org>
515 PR c++/94426 lambdas with internal linkage are different to no-linkage
516 * decl2.c (determine_visibility): A lambda's visibility is
517 affected by its extra scope.
518 * pt.c (instantiate_decl): Determine var's visibility before
519 instantiating its initializer.
520 * tree.c (no_linkage_check): Revert code looking at visibility of
521 lambda's extra scope.
523 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
526 * coroutines.cc (co_await_expander): Remove.
527 (expand_one_await_expression): New.
528 (process_one_statement): New.
529 (await_statement_expander): New.
530 (build_actor_fn): Revise to use per-statement expander.
531 (struct susp_frame_data): Reorder and comment.
532 (register_awaits): Factor code.
533 (replace_statement_captures): New, factored from...
534 (maybe_promote_captured_temps):.. here.
535 (await_statement_walker): Revise to process per statement.
536 (morph_fn_to_coro): Use revised susp_frame_data layout.
538 2020-04-10 Marek Polacek <polacek@redhat.com>
541 * method.c (constructible_expr): In C++20, try using parenthesized
542 initialization of aggregates to determine the result of
545 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
547 * coroutines.cc (co_await_expander): Simplify.
549 2020-04-09 Jason Merrill <jason@redhat.com>
552 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
553 ctx->object and ctx->global->values first.
555 2020-04-09 Marek Polacek <polacek@redhat.com>
558 * call.c (initialize_reference): If the reference binding failed, maybe
559 try initializing from { }.
560 * decl.c (grok_reference_init): For T& t(e), set
561 LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet.
563 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
564 Jun Ma <JunMa@linux.alibaba.com>
566 * coroutines.cc (maybe_promote_captured_temps): Add a cleanup
567 expression, if needed, to any call from which we promoted
568 temporaries captured by reference.
570 2020-04-08 Marek Polacek <polacek@redhat.com>
572 PR c++/94507 - ICE-on-invalid with lambda template.
573 * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
574 tsubst_function_decl returns error_mark_node.
576 2020-04-08 Martin Liska <mliska@suse.cz>
579 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
580 (cxx_init_decl_processing): Mark replaceable all implicitly defined
583 2020-04-08 Patrick Palka <ppalka@redhat.com>
585 Core issues 1001 and 1322
587 * pt.c (rebuild_function_or_method_type): Split function out from ...
588 (tsubst_function_type): ... here.
589 (maybe_rebuild_function_decl_type): New function.
590 (tsubst_function_decl): Use it.
592 2020-04-08 Jakub Jelinek <jakub@redhat.com>
595 * decl.c (begin_destructor_body): For CLASSTYPE_VBASECLASSES class
596 dtors, if CLASSTYPE_PRIMARY_BINFO is non-NULL, but not BINFO_VIRTUAL_P,
597 look at CLASSTYPE_PRIMARY_BINFO of its BINFO_TYPE if it is not
598 BINFO_VIRTUAL_P, and so on.
600 2020-04-08 Marek Polacek <polacek@redhat.com>
602 PR c++/94478 - ICE with defaulted comparison operator
603 * method.c (early_check_defaulted_comparison): Give an error when the
606 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
609 * paser.c (cp_parser_oacc_declare): Add check that variables
610 are declared in the same scope as the directive.
612 2020-04-07 Jason Merrill <jason@redhat.com>
615 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
618 * parser.c (cp_parser_placeholder_type_specifier): Use
621 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
623 * coroutines.cc (maybe_promote_captured_temps): Ensure that
624 reference capture placeholder vars are properly declared.
626 2020-04-07 Patrick Palka <ppalka@redhat.com>
629 * tree.c (replace_placeholders): Look through all handled components,
630 not just COMPONENT_REFs.
631 * typeck2.c (process_init_constructor_array): Propagate
632 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
633 the array initializer.
635 2020-04-07 Jakub Jelinek <jakub@redhat.com>
638 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
639 if cp_parser_omp_master succeeded.
641 2020-04-06 Jason Merrill <jason@redhat.com>
644 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
646 2020-04-04 Marek Polacek <polacek@redhat.com>
647 Jason Merrill <jason@redhat.com>
649 PR c++/94155 - crash in gimplifier with paren init of aggregates.
650 * init.c (build_vec_init): Fill in indexes.
652 2020-04-04 Jason Merrill <jason@redhat.com>
655 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
657 2020-04-04 Patrick Palka <ppalka@redhat.com>
661 * constexpr.c (struct constexpr_ctx): New field 'parent'.
662 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
663 flag from the original constructor to the reduced constructor.
664 (lookup_placeholder): Prefer to return the outermost matching object
665 by recursively calling lookup_placeholder on the 'parent' context,
666 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
667 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
668 context via 'new_ctx.parent' when being expanded without an explicit
669 target. Don't call replace_placeholders.
670 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
674 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
675 support for VECTOR_TYPEs, and optimizations for the common case)
677 (cxx_eval_store_expression): ... here. Rename local variable
678 'changed_active_union_member_p' to 'activated_union_member_p'. Record
679 the sequence of indexes into 'indexes' that yields the subobject we're
680 assigning to. Record the integer offsets of the constructor indexes
681 we're assigning through into 'index_pos_hints'. After evaluating the
682 initializer of the store expression, recompute 'valp' using 'indexes'
683 and using 'index_pos_hints' as hints.
684 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
685 to recompute the constructor_elt pointer we're assigning through after
686 evaluating each initializer.
688 2020-04-04 Jason Merrill <jason@redhat.com>
691 * constraint.cc (tsubst_valid_expression_requirement): Call
694 2020-04-04 Jason Merrill <jason@redhat.com>
697 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
698 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
701 2020-04-04 Jakub Jelinek <jakub@redhat.com>
704 * parser.c (cp_parser_omp_for_loop): Use
705 protected_set_expr_location_if_unset.
706 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
709 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
710 omp_parallel_combined_clauses.
712 2020-04-03 Jason Merrill <jason@redhat.com>
715 * pt.c (complex_pack_expansion_r): New.
716 (complex_alias_template_p): Use it.
718 2020-03-31 Jason Merrill <jason@redhat.com>
721 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
722 replace_placeholders.
723 * typeck2.c (store_init_value): Fix arguments to
724 fold_non_dependent_expr.
726 2020-03-31 Jason Merrill <jason@redhat.com>
728 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
731 2020-03-30 Jason Merrill <jason@redhat.com>
734 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
735 (called_fns_equal): Check DECL_CONTEXT.
737 2020-03-30 Jakub Jelinek <jakub@redhat.com>
740 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
741 STATEMENT_CODE_P code.
743 2020-03-28 Patrick Palka <ppalka@redhat.com>
746 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
747 "requires {" when "requires requires {" was probably intended.
750 * constraint.cc (tsubst_compound_requirement): Always suppress errors
751 from type_deducible_p and expression_convertible_p, as they're not
753 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
754 that we diagnose INTEGER_CST expressions of non-bool type via the
756 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
757 * parser.c (cp_parser_requires_expression): Always parse the requirement
758 body as if we're processing a template, by temporarily incrementing
759 processing_template_decl. Afterwards, if we're not actually in a
760 template context, perform semantic processing to diagnose any invalid
761 types and expressions.
762 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
763 * semantics.c (finish_static_assert): Explain an assertion failure
764 when the condition is a REQUIRES_EXPR like we do when it is a concept
767 * constraint.cc (diagnose_compound_requirement): When diagnosing a
768 compound requirement, maybe replay the satisfaction failure, subject to
769 the current diagnosis depth.
771 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
772 as well as its range, because build_x_binary_op doesn't always do so.
773 (current_constraint_diagnosis_depth): New.
774 (concepts_diagnostics_max_depth_exceeded_p): New.
775 (collect_operands_of_disjunction): New.
776 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
777 replay each branch of the disjunction, subject to the current diagnosis
779 (diagnose_valid_expression): When diagnosing a satisfaction failure,
780 maybe replay the substitution error, subject to the current diagnosis
782 (diagnose_valid_type): Likewise.
783 (diagnose_nested_requiremnet): Likewise.
784 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
785 current_constraint_diagnosis_depth when diagnosing.
786 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
787 current_constraint_diagnosis_depth when diagnosing.
788 (diagnosing_failed_constraint::replay_errors_p): New static member
790 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
791 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
792 the limit was exceeded.
793 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
795 2020-03-27 Nathan Sidwell <nathan@acm.org>
798 * name-lookup.c (do_pushdecl): Look through cleanp levels.
800 2020-03-27 Martin Sebor <msebor@redhat.com>
805 * cp-tree.h (most_specialized_partial_spec): Declare.
806 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
808 (specialization_of): New function.
809 (cp_parser_check_class_key): Move code...
810 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
811 -Wredundant-tags on first-time declarations in other declarators.
812 Correct handling of template specializations.
813 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
814 when -Wredundant-tags is enabled. Use primary template or partial
815 specialization as the guide for uses of implicit instantiations.
816 * pt.c (most_specialized_partial_spec): Declare extern.
818 2020-03-27 Nathan Sidwell <nathan@acm.org>
821 * name-lookup.c (push_namespace): Triage ambiguous lookups that
824 2020-03-27 Jakub Jelinek <jakub@redhat.com>
827 * call.c (set_flags_from_callee): Don't update
828 cp_function_chain->can_throw or current_function_returns_abnormally
829 if cp_unevaluated_operand.
832 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
833 operand and creating a new COMPOUND_EXPR if anything changed.
835 2020-03-26 Marek Polacek <polacek@redhat.com>
837 PR c++/94336 - template keyword accepted before destructor names.
838 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
839 is followed by a destructor name.
841 2020-03-27 Patrick Palka <ppalka@redhat.com>
843 * decl.c (compute_array_index_type_loc): Remove redundant
844 type_dependent_expression_p check that is subsumed by
845 value_dependent_expression_p.
846 * decl2.c (is_late_template_attribute): Likewise.
847 * pt.c (uses_template_parms): Likewise.
848 (dependent_template_arg_p): Likewise.
850 2020-03-26 Marek Polacek <polacek@redhat.com>
853 PR c++/94057 - template keyword in a typename-specifier.
854 * parser.c (check_template_keyword_in_nested_name_spec): New.
855 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
856 'template'. Call check_template_keyword_in_nested_name_spec.
857 (cp_parser_simple_type_specifier): Assume that a <
858 following a qualified-id in a typename-specifier begins
859 a template argument list.
861 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
863 * coroutines.cc (coro_init_identifiers): Initialize an identifier
864 for the cororoutine handle 'address' method name.
865 (struct coro_aw_data): Add fields to cover the continuations.
866 (co_await_expander): Determine the kind of await_suspend in use.
867 If we have the case that returns a continuation handle, then save
868 this and make the target for 'scope exit without cleanup' be the
869 continuation resume label.
870 (expand_co_awaits): Remove.
871 (struct suspend_point_info): Remove fields that kept the returned
872 await_suspend handle type.
873 (transform_await_expr): Remove code tracking continuation handles.
874 (build_actor_fn): Add the continuation handle as an actor-function
875 scope var. Build the symmetric transfer continuation point. Call
876 the tree walk for co_await expansion directly, rather than via a
877 trivial shim function.
878 (register_await_info): Remove fields tracking continuation handles.
879 (get_await_suspend_return_type): Remove.
880 (register_awaits): Remove code tracking continuation handles.
881 (morph_fn_to_coro): Remove code tracking continuation handles.
883 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
885 * coroutines.cc (co_await_expander): If we are expanding the
886 initial await expression, set a boolean flag to show that we
887 have now reached the initial await_resume() method call.
888 (expand_co_awaits): Handle the 'initial await resume called' flag.
889 (build_actor_fn): Insert the initial await expression into the
890 start of the user-authored function-body. Handle the 'initial await
892 (morph_fn_to_coro): Initialise the 'initial await resume called'
893 flag. Modify the unhandled exception catch clause to recognise
894 exceptions that occur before the initial await_resume() and re-
897 2020-03-26 Jakub Jelinek <jakub@redhat.com>
900 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
901 true for all TEMPLATE_DECLs.
904 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
906 2020-03-25 Patrick Palka <ppalka@redhat.com>
909 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
910 current condition chain when the if-statement has a non-empty
913 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
916 * coroutines.cc (captures_temporary): Fix a missing dereference.
918 2020-03-24 Marek Polacek <polacek@redhat.com>
920 PR c++/94190 - wrong no post-decrement operator error in template.
921 * call.c (convert_like_real): Use convert_from_reference on the result.
923 2020-03-24 Jason Merrill <jason@redhat.com>
926 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
928 (tsubst_nested_requirement): Likewise.
929 (get_constraint_error_location): Allow missing context.
930 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
931 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
933 2020-03-24 Jason Merrill <jason@redhat.com>
935 * pt.c (any_template_parm_r): Look into the type of a non-type
938 2020-03-24 Jason Merrill <jason@redhat.com>
940 * cp-tree.h (cp_expr): When constructing from an expr and a
941 location, call protected_set_expr_location.
943 2020-03-23 Patrick Palka <ppalka@redhat.com>
946 * except.c (maybe_noexcept_warning): Add TODO.
947 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
949 2020-03-23 nathans <nathan@acm.org>
952 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
955 2020-03-21 Patrick Palka <ppalka@redhat.com>
958 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
959 handle unions without an initializer.
960 (cxx_eval_component_reference): Emit a different diagnostic when the
961 constructor element corresponding to a union member is NULL.
962 (cxx_eval_bare_aggregate): When constructing a union, always set the
963 active union member before evaluating the initializer. Relax assertion
964 that verifies the index of the constructor element we're initializing
966 (cxx_eval_store_expression): Diagnose changing the active union member
967 while the union is in the process of being initialized. After setting
968 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
970 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
971 CONSTRUCTOR returned by lookup_placeholder.
973 2020-03-20 Patrick Palka <ppalka@redhat.com>
975 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
976 the "[with ]" bits to here from ...
977 (pp_cxx_atomic_constraint): ... here.
978 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
979 * error.c (rebuild_concept_check): Delete.
980 (print_concept_check_info): Print the dependent form of the constraint and the
981 preferably substituted parameter mapping alongside it.
983 2020-03-19 Jason Merrill <jason@redhat.com>
986 * cp-gimplify.c (simple_empty_class_p): Look through
987 SIMPLE_TARGET_EXPR_P.
988 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
989 [RETURN_EXPR]: Avoid producing 'return *retval;'.
990 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
991 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
994 2020-03-19 Jakub Jelinek <jakub@redhat.com>
997 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
998 on outer_automatic_var_p decls.
999 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
1000 capture proxy decls.
1002 2020-03-18 Nathan Sidwell <nathan@acm.org>
1004 PR c++/94147 - mangling of lambdas assigned to globals
1005 * parser.c (cp_parser_init_declarator): Namespace-scope variables
1006 provide a lambda scope.
1007 * tree.c (no_linkage_check): Lambdas with a variable for extra
1008 scope have a linkage from the variable.
1010 2020-03-18 Jakub Jelinek <jakub@redhat.com>
1012 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
1013 strictly_subsumes): Fix up duplicated word issue in a comment.
1014 * coroutines.cc (build_init_or_final_await, captures_temporary):
1016 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
1017 * pt.c (append_type_to_template_for_access_check): Likewise.
1020 * decl.c (grokfndecl): Restore old diagnostics about deduction
1021 guide declared in different scope if in_namespace is NULL_TREE.
1023 2020-03-17 Jakub Jelinek <jakub@redhat.com>
1026 * parser.c (cp_parser_enum_specifier): Use temp_override for
1027 parser->colon_corrects_to_scope_p, replace goto out with return.
1028 If scoped enum or enum with underlying type is not followed by
1029 { or ;, call cp_parser_commit_to_tentative_parse before calling
1030 cp_parser_error and make sure to return error_mark_node instead of
1031 NULL_TREE. Formatting fixes.
1033 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
1036 * method.c (assignable_expr): Use cp_unevaluated.
1037 (is_xible_helper): Push a non-deferred access check for
1038 the stub objects created by assignable_expr and constructible_expr.
1040 2020-03-17 Jakub Jelinek <jakub@redhat.com>
1042 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
1043 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
1045 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
1046 cp_parser_placeholder_type_specifier,
1047 cp_parser_constraint_requires_parens): Likewise.
1048 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
1050 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
1052 * coroutines.cc (co_await_expander): Fix indentation.
1054 2020-03-14 Jason Merrill <jason@redhat.com>
1057 * pt.c (process_partial_specialization): Error rather than crash on
1058 extra pack expansion.
1060 2020-03-14 Jason Merrill <jason@redhat.com>
1063 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
1064 DECL_ORIGINAL_TYPE of a typedef.
1066 2020-03-14 Jason Merrill <jason@redhat.com>
1069 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
1070 substituting DECL_ARGUMENTS.
1072 2020-03-14 Jakub Jelinek <jakub@redhat.com>
1074 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
1075 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
1078 2020-03-13 Patrick Palka <ppalka@redhat.com>
1081 * call.c (build_over_call): Use a warning_sentinel to disable
1082 warn_deprecated_decl before calling build_addr_func.
1084 2020-03-12 Jakub Jelinek <jakub@redhat.com>
1087 * decl.c (reshape_init_array_1): Don't unshare constructor if there
1088 aren't any trailing zero elts, otherwise only unshare the first
1091 2020-03-11 Jason Merrill <jason@redhat.com>
1094 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
1097 2020-03-11 Marek Polacek <polacek@redhat.com>
1098 Jason Merrill <jason@redhat.com>
1100 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
1101 * constexpr.c (cref_has_const_field): New function.
1102 (modifying_const_object_p): Consider a COMPONENT_REF
1103 const only if any of its fields are const.
1104 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
1105 as readonly after its initialization has been done.
1107 2020-03-10 Marek Polacek <polacek@redhat.com>
1109 PR c++/94124 - wrong conversion error with non-viable overload.
1110 * decl.c (reshape_init_array_1): Unshare a constructor if we
1111 stripped trailing zero-initializers.
1113 2020-03-10 Jason Merrill <jason@redhat.com>
1116 * pt.c (maybe_instantiate_noexcept): Always update clones.
1118 2020-03-10 Jason Merrill <jason@redhat.com>
1121 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
1123 2020-03-10 Jason Merrill <jason@redhat.com>
1129 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
1130 66139: Don't split_nonconstant_init. Remove pre_p parameter.
1132 2020-03-09 Marek Polacek <polacek@redhat.com>
1134 PR c++/92031 - bogus taking address of rvalue error.
1135 PR c++/91465 - ICE with template codes in check_narrowing.
1136 PR c++/93870 - wrong error when converting template non-type arg.
1137 PR c++/94068 - ICE with template codes in check_narrowing.
1138 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
1139 in a template when not ck_identity and we're dealing with a class.
1140 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
1141 in a template if we need a temporary.
1142 * decl.c (compute_array_index_type_loc): Remove
1143 instantiate_non_dependent_expr_sfinae call. Call
1144 fold_non_dependent_expr instead of maybe_constant_value.
1145 (build_explicit_specifier): Don't instantiate or create a sentinel
1146 before converting the expression.
1147 * except.c (build_noexcept_spec): Likewise.
1148 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
1149 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
1150 build_converted_constant_expr returned.
1151 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
1152 of maybe_constant_value.
1154 2020-03-09 Jakub Jelinek <jakub@redhat.com>
1158 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
1160 * constexpr.c (cxx_eval_constant_expression): Do not handle
1161 RROTATE_EXPR and LROTATE_EXPR.
1163 2020-03-09 Marek Polacek <polacek@redhat.com>
1165 PR c++/94050 - ABI issue with alignas on armv7hl.
1166 * class.c (layout_class_type): Don't replace a class's
1167 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
1169 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
1171 * coroutines.cc (build_actor_fn): Factor out code inserting the
1172 default return_void call to...
1173 (morph_fn_to_coro): ...here, also hoist local var declarations.
1175 2020-03-08 Patrick Palka <ppalka@redhat.com>
1178 * call.c (convert_like_real): Check complain before emitting an error
1179 about binding a bit-field to a reference.
1181 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
1182 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
1185 2020-03-06 Nathan Sidwell <nathan@acm.org>
1188 * mangle.c (find_substitution): Don't call same_type_p on template
1189 args that cannot match.
1191 2020-03-04 Martin Sebor <msebor@redhat.com>
1194 * tree.c (type_initializer_zero_p): Fail for structs initialized
1197 2020-03-04 Jason Merrill <jason@redhat.com>
1200 * init.c (perform_member_init): Don't do aggregate initialization of
1202 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
1203 initialization of empty field.
1205 2020-03-04 Martin Liska <mliska@suse.cz>
1207 * method.c: Wrap array in ctor with braces in order
1208 to silent clang warnings.
1210 2020-03-03 Jason Merrill <jason@redhat.com>
1211 Marek Polacek <polacek@redhat.com>
1213 PR c++/90505 - mismatch in template argument deduction.
1214 * pt.c (tsubst): Don't reduce the template level of template
1215 parameters when tf_partial.
1217 2020-03-03 Jakub Jelinek <jakub@redhat.com>
1220 * constexpr.c (cxx_eval_constant_expression)
1221 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
1222 *non_constant_p is true.
1224 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
1226 * coroutines.cc (captures_temporary): Strip component_ref
1229 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
1231 * coroutines.cc (finish_co_await_expr): Build co_await_expr
1232 with unknown_type_node.
1233 (finish_co_yield_expr): Ditto.
1234 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
1235 with unknown type as dependent.
1237 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
1239 * coroutines.cc (struct local_var_info): Adjust to remove the
1240 reference to the captured var, and just to note that this is a
1241 lambda capture proxy.
1242 (transform_local_var_uses): Handle lambda captures specially.
1243 (struct param_frame_data): Add a visited set.
1244 (register_param_uses): Also check for param uses in lambda
1246 (struct local_vars_frame_data): Remove captures list.
1247 (register_local_var_uses): Handle lambda capture proxies by
1248 noting and bypassing them.
1249 (morph_fn_to_coro): Update to remove lifetime extension of
1250 lambda capture-by-copy vars.
1252 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
1254 * coroutines.cc (build_co_await): Do not build frame
1255 awaitable proxy vars when the co_await expression is
1256 a function parameter or local var.
1257 (co_await_expander): Do not initialise a frame var with
1259 (transform_await_expr): Only substitute the awaitable
1260 frame var if it's needed.
1261 (register_awaits): Do not make frame copies for param
1262 or local vars that are awaitables.
1264 2020-02-28 Jason Merrill <jason@redhat.com>
1266 Implement P2092R0, Disambiguating Nested-Requirements
1267 * parser.c (cp_parser_requirement_parameter_list): Pass
1268 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
1270 * call.c (build_user_type_conversion_1): Don't look at the second
1271 conversion of a non-viable candidate.
1273 2020-02-28 Jakub Jelinek <jakub@redhat.com>
1275 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
1276 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
1277 functions in unevaluated contexts.
1279 2020-02-27 Nathan Sidwell <nathan@acm.org>
1282 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
1284 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
1285 * typeck.c (comptypes): Assert we don't get any argument packs.
1287 * class.c (adjust_clone_args): Correct arg-checking assert.
1288 * typeck.c (comptypes): Assert not nulls.
1290 2020-02-26 Marek Polacek <polacek@redhat.com>
1292 PR c++/93789 - ICE with invalid array bounds.
1293 * decl.c (compute_array_index_type_loc): Don't use the folded
1294 size when folding cleared TREE_CONSTANT.
1296 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
1298 * class.c (classtype_has_non_deleted_copy_ctor): New.
1299 * coroutines.cc (struct param_info): Keep track of params
1300 that are references, and cache the original type and whether
1301 the DTOR is trivial.
1302 (build_actor_fn): Handle param copies always, and adjust the
1303 handling for references.
1304 (register_param_uses): Only handle uses here.
1305 (classtype_has_non_deleted_copy_ctor): New.
1306 (morph_fn_to_coro): Adjust param copy handling to match n4849
1307 by reordering ahead of the promise CTOR and always making a
1308 frame copy, even if the param is unused in the coroutine body.
1309 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
1311 2020-02-26 Patrick Palka <ppalka@redhat.com>
1313 * constraint.cc (finish_constraint_binary_op): Set expr's location range
1314 to the range of its operands.
1315 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
1316 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
1317 instead of the corresponding template arguments ARGS and adjust body
1319 (diagnose_requires_expr): Likewise.
1320 (diagnose_atomic_constraint): Likewise. When printing an atomic
1321 constraint expression, print the instantiated parameter mapping
1323 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
1324 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
1325 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
1327 2020-02-26 Marek Polacek <polacek@redhat.com>
1329 PR c++/93676 - value-init crash in template.
1330 * init.c (build_new_1): Don't call build_vec_init in a template.
1332 2020-02-26 Marek Polacek <polacek@redhat.com>
1334 PR c++/93862 - ICE with static_cast when converting from int[].
1335 * call.c (reference_compatible_p): No longer static.
1336 * cp-tree.h (reference_compatible_p): Declare.
1337 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
1338 of reference_related_p.
1340 2020-02-26 Marek Polacek <polacek@redhat.com>
1342 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
1343 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
1346 2020-02-24 Martin Sebor <msebor@redhat.com>
1349 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
1350 in shared C/C++ code in headers.
1351 Remove a duplicate hunk of code.
1353 2020-02-24 Marek Polacek <polacek@redhat.com>
1355 PR c++/93869 - ICE with -Wmismatched-tags.
1356 * parser.c (cp_parser_check_class_key): Check class_key earlier.
1358 2020-02-24 Marek Polacek <polacek@redhat.com>
1360 PR c++/93712 - ICE with ill-formed array list-initialization.
1361 * call.c (next_conversion): Return NULL for ck_aggr.
1362 (build_aggr_conv): Set u.expr instead of u.next.
1363 (build_array_conv): Likewise.
1364 (build_complex_conv): Likewise.
1365 (conv_get_original_expr): Handle ck_aggr.
1367 2020-02-24 Jakub Jelinek <jakub@redhat.com>
1369 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
1370 * call.c (build_over_call): Don't evaluate immediate functions in
1371 unevaluated operands.
1373 2020-02-24 Jason Merrill <jason@redhat.com>
1375 P0780R2: Resolve lambda init-capture pack grammar.
1376 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
1379 2020-02-22 Marek Polacek <polacek@redhat.com>
1382 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
1384 2020-02-21 Martin Sebor <msebor@redhat.com>
1386 PR gcov-profile/93753
1387 * class.c (check_flexarrays): Tighten up a test for potential members
1388 of anonymous structs or unions.
1390 2020-02-20 Martin Sebor <msebor@redhat.com>
1393 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
1395 2020-02-20 Martin Liska <mliska@suse.cz>
1397 PR translation/93841
1398 * config/or1k/or1k.opt: Remove superfluous word.
1399 * doc/invoke.texi: Likewise.
1401 2020-02-20 Martin Liska <mliska@suse.cz>
1403 PR translation/93838
1404 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
1406 2020-02-19 Marek Polacek <polacek@redhat.com>
1408 PR c++/93169 - wrong-code with a non-constexpr constructor.
1409 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
1410 on constant CONSTRUCTORs.
1412 2020-02-15 Marek Polacek <polacek@redhat.com>
1414 PR c++/93710 - poor diagnostic for array initializer.
1415 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
1418 2020-02-15 Jason Merrill <jason@redhat.com>
1421 * pt.c (any_template_parm_r): Look into lambda body.
1424 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
1426 2020-02-14 Jakub Jelinek <jakub@redhat.com>
1429 * class.c (enum_min_precision): Change prec type from int to int &.
1432 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
1433 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
1434 (fallback_dfloat32_type, fallback_dfloat64_type,
1435 fallback_dfloat128_type): Define.
1436 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
1438 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
1439 is disabled for compatibility.
1441 2020-02-13 Jason Merrill <jason@redhat.com>
1444 * name-lookup.c (matching_fn_p): A function does not match a
1449 * tree.c (decl_linkage): Always lk_none for locals.
1451 2020-02-12 Jason Merrill <jason@redhat.com>
1455 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
1456 * pt.c (find_parameter_packs_r): Not here.
1458 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
1460 * coroutines.cc (build_actor_fn): Implement deallocation function
1461 selection per n4849, dcl.fct.def.coroutine bullet 12.
1462 (morph_fn_to_coro): Implement allocation function selection per
1463 n4849, dcl.fct.def.coroutine bullets 9 and 10.
1465 2020-02-12 Marek Polacek <polacek@redhat.com>
1467 PR c++/93684 - ICE-on-invalid with broken attribute.
1468 * parser.c (cp_parser_std_attribute): Peek a token first before
1471 2020-02-11 Jason Merrill <jason@redhat.com>
1474 * class.c (add_implicitly_declared_members): Use do_friend.
1475 * method.c (implicitly_declare_fn): Fix friend handling.
1476 (decl_remember_implicit_trigger_p): New.
1477 (synthesize_method): Use it.
1478 * decl2.c (mark_used): Use it.
1480 2020-02-11 Jason Merrill <jason@redhat.com>
1484 * constexpr.c (maybe_constant_value): Correct earlier change.
1485 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
1486 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
1488 2020-02-12 Patrick Palka <ppalka@redhat.com>
1492 * type-utils.h (find_type_usage): Refactor to take a tree * and to
1493 return a tree *, and update documentation accordingly.
1494 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
1495 decltype(auto) node.
1496 (make_constrained_decltype_auto): No need to explicitly set
1497 AUTO_IS_DECLTYPE anymore.
1498 (splice_late_return_type): Use find_type_usage to find and
1499 replace a possibly nested auto node instead of using is_auto.
1500 Check test for is_auto into an assert when deciding whether
1501 to late_return_type.
1502 (type_uses_auto): Adjust the call to find_type_usage.
1503 * parser.c (cp_parser_decltype): No need to explicitly set
1504 AUTO_IS_DECLTYPE anymore.
1506 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
1507 (dump_simple_decl): Handle standard concept definitions as well as
1508 variable concept definitions.
1510 2020-02-10 Jakub Jelinek <jakub@redhat.com>
1513 * error.c (dump_decl_name): Fix up last argument to strncmp.
1515 2020-02-10 Jason Merrill <jason@redhat.com>
1518 * tree.c (array_of_unknown_bound_p): New.
1519 * init.c (perform_member_init): Do nothing for flexible arrays.
1521 2020-02-09 Jakub Jelinek <jakub@redhat.com>
1524 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
1525 ARRAY_TYPE, use the element type. Punt if objtype after that is not
1528 2020-02-08 Jason Merrill <jason@redhat.com>
1531 * expr.c (fold_for_warn): Call maybe_constant_value.
1532 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
1533 (maybe_constant_value): Add uid_sensitive parm.
1534 (get_fundef_copy): Don't copy if it's true.
1535 (cxx_eval_call_expression): Don't instantiate if it's true.
1536 (cxx_eval_outermost_constant_expr): Likewise.
1539 * constexpr.c (maybe_constant_value): Don't unshare if the cached
1540 value is the same as the argument.
1542 * typeck.c (maybe_warn_about_returning_address_of_local): Add
1545 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
1548 2020-02-08 Jakub Jelinek <jakub@redhat.com>
1551 * constexpr.c (find_array_ctor_elt): If last element has no index,
1552 for flag_checking verify all elts have no index. If i is within the
1553 elts, return it directly, if it is right after the last elt, append
1554 if NULL index, otherwise force indexes on all elts.
1555 (cxx_eval_store_expression): Allow cep->index to be NULL.
1557 2020-02-07 Marek Polacek <polacek@redhat.com>
1559 PR c++/92947 - Paren init of aggregates in unevaluated context.
1560 * call.c (build_new_method_call_1): Don't check
1561 cp_unevaluated_operand. Check the return value of digest_init.
1563 2020-02-06 Jason Merrill <jason@redhat.com>
1566 * tree.c (cp_walk_subtrees): Walk into type template arguments.
1567 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
1568 instead of TYPE_ALIAS_P.
1569 * pt.c (push_template_decl_real): Likewise.
1570 (find_parameter_packs_r): Likewise. Remove dead code.
1571 * error.c (find_typenames_r): Remove dead code.
1573 2020-02-06 Jason Merrill <jason@redhat.com>
1576 * parser.c (cp_parser_constraint_primary_expression): Do the main
1577 parse non-tentatively.
1579 2020-02-06 Marek Polacek <polacek@redhat.com>
1581 PR c++/93597 - ICE with lambda in operator function.
1582 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
1584 2020-02-05 Jason Merrill <jason@redhat.com>
1587 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
1588 handling of TREE_CHAIN for empty pack.
1590 2020-02-05 Jakub Jelinek <jakub@redhat.com>
1593 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
1594 prior to passing it to c_build_vec_convert.
1596 2020-02-05 Marek Polacek <polacek@redhat.com>
1598 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
1599 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
1602 2020-02-05 Jason Merrill <jason@redhat.com>
1605 * decl.c (grokdeclarator): Reject field of current class type even
1608 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
1610 * coroutines.cc (maybe_promote_captured_temps): Increase the index
1611 number for temporary variables' name.
1613 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
1615 * coroutines.cc (build_co_await): Call convert_from_reference
1616 to wrap co_await_expr with indirect_ref which avoid
1617 reference/non-reference type confusion.
1619 (co_await_expander): Sink to call_expr if await_resume
1620 is wrapped by indirect_ref.
1622 2020-02-04 Jason Merrill <jason@redhat.com>
1625 * constraint.cc (satisfy_declaration_constraints): Check return
1626 value of push_tinst_level.
1629 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
1630 elements instead of value-initializing them.
1633 * init.c (perform_member_init): Simplify.
1634 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
1636 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
1638 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
1640 * coroutines.cc (find_promise_type): Delete unused forward
1642 (struct coroutine_info): Add a bool for no promise type error.
1643 (coro_promise_type_found_p): Only emit the error for a missing
1644 promise once in each affected coroutine.
1646 2020-02-03 Jason Merrill <jason@redhat.com>
1649 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
1650 defer loading the value of a reference.
1652 2020-02-03 Jason Merrill <jason@redhat.com>
1655 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
1657 [COMPONENT_REF]: A member function reference doesn't use the object
1660 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
1663 * coroutines.cc (struct coroutine_info): Add a bool flag to note
1664 that we emitted an error for a bad function return type.
1665 (get_coroutine_info): Tolerate an unset info table in case of
1667 (find_coro_traits_template_decl): In case of error or if we didn't
1668 find a type template, note we emitted the error and suppress
1670 (find_coro_handle_template_decl): Likewise.
1671 (instantiate_coro_traits): Only check for error_mark_node in the
1672 return from lookup_qualified_name.
1673 (coro_promise_type_found_p): Reorder initialization so that we check
1674 for the traits and their usability before allocation of the info
1675 table. Check for a suitable return type and emit a diagnostic for
1676 here instead of relying on the lookup machinery. This allows the
1677 error to have a better location, and means we can suppress multiple
1679 (coro_function_valid_p): Re-check for a valid promise (and thus the
1680 traits) before proceeding. Tolerate missing info as a fatal error.
1682 2020-02-03 Jason Merrill <jason@redhat.com>
1685 * cp-gimplify.c (predeclare_vla): New.
1686 (cp_genericize_r) [NOP_EXPR]: Call it.
1688 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
1690 * coroutines.cc (transform_await_wrapper): Set actor funcion as
1691 new context of label_decl.
1692 (build_actor_fn): Fill new field of await_xform_data.
1694 2020-02-02 Marek Polacek <polacek@redhat.com>
1696 PR c++/93530 - ICE on invalid alignas in a template.
1697 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
1700 2020-01-31 Jason Merrill <jason@redhat.com>
1703 * semantics.c (process_outer_var_ref): Capture VLAs even in
1704 unevaluated context.
1707 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
1708 non-aggregate elements.
1709 (reshape_init_array): Add first_initializer_p parm.
1710 (reshape_init_r): Change first_initializer_p from bool to tree.
1711 (reshape_init): Pass init to it.
1714 * parser.c (cp_parser_initializer_list): Suppress location wrappers
1717 2020-01-29 Jason Merrill <jason@redhat.com>
1720 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
1721 the expression was dependent before substitution.
1723 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
1725 * coroutines.cc (act_des_fn): New.
1726 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
1727 Access promise via actor function's frame pointer argument.
1728 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
1730 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
1732 * coroutines.cc (co_await_expander): Handle type conversion case.
1734 2020-01-29 Jason Merrill <jason@redhat.com>
1739 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
1740 a trailing return type.
1741 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
1744 2020-01-29 Marek Polacek <polacek@redhat.com>
1746 PR c++/91754 - Fix template arguments comparison with class NTTP.
1747 * pt.c (class_nttp_const_wrapper_p): New.
1748 (template_args_equal): See through class_nttp_const_wrapper_p
1751 2020-01-29 Marek Polacek <polacek@redhat.com>
1753 PR c++/92948 - Fix class NTTP with template arguments.
1754 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
1755 converting a value-dependent expression to a class type.
1756 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
1757 as the result of the tsubst_copy call.
1759 2020-01-29 Jakub Jelinek <jakub@redhat.com>
1762 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
1763 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
1765 2020-01-28 Jason Merrill <jason@redhat.com>
1768 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
1772 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
1775 * call.c (build_user_type_conversion_1): Allow a template conversion
1776 returning an rvalue reference to bind directly to an lvalue.
1779 * decl.c (grokdeclarator): Propagate eh spec from typedef.
1781 2020-01-28 Martin Liska <mliska@suse.cz>
1784 * pt.c (redeclare_class_template): Group couple of
1785 errors and inform messages with auto_diagnostic_group.
1787 2020-01-28 Martin Liska <mliska@suse.cz>
1790 * pt.c (redeclare_class_template): Use inform
1791 for the second location.
1793 2020-01-27 Jason Merrill <jason@redhat.com>
1796 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
1798 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
1801 * coroutines.cc (morph_fn_to_coro): Check the ramp return
1802 value when it is constructed from the 'get return object'.
1804 2020-01-27 Nathan Sidwell <nathan@acm.org>
1807 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
1809 2020-01-26 Jason Merrill <jason@redhat.com>
1812 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
1813 temporarily enable -Wsystem-headers. Change second warning to
1817 * semantics.c (finish_call_expr): Don't call
1818 instantiate_non_dependent_expr before warn_for_memset.
1820 2020-01-25 Marek Polacek <polacek@redhat.com>
1822 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
1823 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
1824 dynamic_cast diagnostic.
1826 2020-01-24 Jason Merrill <jason@redhat.com>
1828 PR c++/93400 - ICE with constrained friend.
1829 * constraint.cc (maybe_substitute_reqs_for): New.
1830 * decl.c (function_requirements_equivalent_p): Call it.
1831 * pt.c (tsubst_friend_function): Only substitute
1832 TEMPLATE_PARMS_CONSTRAINTS.
1833 (tsubst_template_parms): Copy constraints.
1835 2020-01-24 Jason Merrill <jason@redhat.com>
1837 PR c++/93279 - ICE with lambda in member operator.
1838 * name-lookup.c (maybe_save_operator_binding): Don't remember
1839 class-scope bindings.
1841 2020-01-24 Jason Merrill <jason@redhat.com>
1843 PR c++/93377 - ICE with member alias in constraint.
1844 * pt.c (any_template_parm_r): Look at template arguments for all
1845 aliases, not only alias templates.
1847 2020-01-24 Marek Polacek <polacek@redhat.com>
1849 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
1850 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
1852 2020-01-24 Jason Merrill <jason@redhat.com>
1854 PR c++/92852 - ICE with generic lambda and reference var.
1855 * constexpr.c (maybe_constant_value): Likewise.
1857 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
1860 * parser.c (cp_parser_nested_name_specifier_opt): Properly
1861 diagnose concept-ids.
1863 2020-01-23 Jason Merrill <jason@redhat.com>
1865 PR c++/93331 - ICE with __builtin_strchr.
1866 * constexpr.c (cxx_eval_builtin_function_call): Use the original
1867 argument if we didn't manage to extract a STRING_CST.
1869 PR c++/93345 - ICE with defaulted dtor and template.
1871 * decl.c (cxx_maybe_build_cleanup): Don't try to set
1872 throwing_cleanup in a template.
1874 2020-01-22 Marek Polacek <polacek@redhat.com>
1876 PR c++/92907 - noexcept does not consider "const" in member functions.
1877 * g++.dg/cpp0x/noexcept56.C: New test.
1879 2020-01-22 Marek Polacek <polacek@redhat.com>
1881 PR c++/93324 - ICE with -Wall on constexpr if.
1882 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
1884 2020-01-22 Patrick Palka <ppalka@redhat.com>
1886 * constraint.cc (get_mapped_args): Avoid using auto_vec
1887 as a vector element. Release the vectors inside the lists
1889 * parser.c (cp_literal_operator_id): Free the buffer.
1891 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
1893 * coroutines.cc (finish_co_await_expr): Add error check on return
1894 value of build_co_await.
1895 (finish_co_yield_expr,): Ditto.
1897 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
1899 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
1900 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
1901 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
1903 2020-01-21 Jason Merrill <jason@redhat.com>
1905 PR c++/60855 - ICE with sizeof VLA capture.
1906 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
1908 PR c++/90732 - ICE with VLA capture and generic lambda.
1909 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
1911 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
1912 Bin Cheng <bin.cheng@linux.alibaba.com>
1914 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
1915 from complete_type_or_else.
1916 (register_param_uses): Likewise.
1917 (build_co_await): Do not try to use complete_type_or_else for void
1918 types, otherwise for incomplete types, check for NULL return from
1919 complete_type_or_else.
1921 2020-01-21 Jason Merrill <jason@redhat.com>
1923 PR c++/91476 - anon-namespace reference temp clash between TUs.
1924 * decl2.c (copy_linkage): Factor out of get_guard.
1925 * call.c (make_temporary_var_for_ref_to_temp): Use it.
1926 * decl.c (cp_finish_decomp): Use it.
1927 (cp_finish_decl): determine_visibility sooner.
1929 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
1931 * coroutines.cc (finish_co_await_expr): Set return value flag.
1932 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
1934 2020-01-19 Jason Merrill <jason@redhat.com>
1936 PR c++/33799 - destroy return value, take 2.
1937 * cp-tree.h (current_retval_sentinel): New macro.
1938 (struct language_function): Add throwing_cleanup bitfield.
1939 * decl.c (cxx_maybe_build_cleanup): Set it.
1940 * except.c (maybe_set_retval_sentinel)
1941 (maybe_splice_retval_cleanup): New functions.
1942 * parser.c (cp_parser_compound_statement): Call
1943 maybe_splice_retval_cleanup.
1944 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
1946 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
1948 2020-01-18 Jakub Jelinek <jakub@redhat.com>
1950 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
1951 but non-NO_DOLLAR_IN_LABEL case build.
1953 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
1955 * Make-lang.in: Add coroutines.o.
1956 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
1957 (DECL_COROUTINE_P): New.
1958 * lex.c (init_reswords): Enable keywords when the coroutine flag
1960 * operators.def (co_await): New operator.
1961 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
1962 (op_error): Likewise.
1963 (build_new_op_1): Likewise.
1964 (build_new_function_call): Validate coroutine builtin arguments.
1965 * constexpr.c (potential_constant_expression_1): Handle
1966 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
1967 * coroutines.cc: New file.
1968 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
1969 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
1970 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
1971 * cp-tree.h (coro_validate_builtin_call): New.
1972 * decl.c (emit_coro_helper): New.
1973 (finish_function): Handle the case when a function is found to
1974 be a coroutine, perform the outlining and emit the outlined
1975 functions. Set a bit to signal that this is a coroutine component.
1976 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
1977 (cp_parser_unary_expression): Handle co_await.
1978 (cp_parser_assignment_expression): Handle co_yield.
1979 (cp_parser_statement): Handle RID_CO_RETURN.
1980 (cp_parser_jump_statement): Handle co_return.
1981 (cp_parser_operator): Handle co_await operator.
1982 (cp_parser_yield_expression): New.
1983 (cp_parser_required_error): Handle RT_CO_YIELD.
1984 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
1985 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
1987 * tree.c (cp_walk_subtrees): Likewise.
1989 2020-01-17 Jason Merrill <jason@redhat.com>
1991 PR c++/92531 - ICE with noexcept(lambda).
1992 * pt.c (uses_template_parms): Don't try to enumerate all the
1995 2020-01-17 Jakub Jelinek <jakub@redhat.com>
1998 * parser.c (cp_parser_template_name): Look up deprecated attribute
1999 in DECL_TEMPLATE_RESULT or its type's attributes.
2001 2020-01-16 Jason Merrill <jason@redhat.com>
2003 PR c++/93286 - ICE with __is_constructible and variadic template.
2004 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
2005 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
2007 PR c++/93280 - ICE with aggregate assignment and DMI.
2008 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
2009 * typeck2.c (digest_nsdmi_init): Not here.
2011 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
2014 * cp-tree.h (is_constrained_auto): New.
2015 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
2016 handle concept-check expressions; take a cp_decl_specifier_seq*
2018 (cp_parser_condition): Update call.
2019 (cp_parser_simple_declaration): Likewise.
2020 (cp_parser_placeholder_type_specifier): Correctly handle
2021 concept-check expressions.
2023 2020-01-15 Jason Merrill <jason@redhat.com>
2026 PR c++/33799 - destroy return value if local cleanup throws.
2027 * cp-tree.h (current_retval_sentinel): New macro.
2028 * decl.c (start_preparsed_function): Set up cleanup for retval.
2029 * typeck.c (check_return_expr): Set current_retval_sentinel.
2031 PR c++/93257 - consteval void function.
2032 * constexpr.c (verify_constant): Allow void_node.
2034 PR c++/92871 - bad code with xvalue and GNU ?: extension.
2035 * call.c (prevent_lifetime_extension): New.
2036 (build_conditional_expr_1): Use it.
2038 2020-01-14 Nathan Sidwell <nathan@acm.org>
2041 * pt.c (retrieve_specialization): Use get_template_info, not open
2045 * pt.c (retrieve_specialization): Get the TI from the decl or the
2046 classtype as appropriate.
2048 2020-01-14 David Malcolm <dmalcolm@redhat.com>
2050 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
2051 New static constant.
2052 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
2053 (struct named_label_hash::empty_zero_p): Likewise.
2054 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
2056 2020-01-14 Jason Merrill <jason@redhat.com>
2058 PR c++/92590 - wrong handling of inherited default ctor.
2059 * class.c (add_method): A constrained inherited ctor doesn't hide an
2060 implicit derived ctor.
2062 PR c++/92552 - ICE with inherited constrained default ctor.
2063 * pt.c (instantiate_class_template_1): Copy
2064 TYPE_HAS_USER_CONSTRUCTOR.
2065 PR c++/91930 - ICE with constrained inherited default ctor.
2066 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
2067 for inherited constructor.
2068 PR c++/92594 - ICE with inherited trivial default ctor.
2069 * method.c (trivial_fn_p): Treat an inherited default constructor
2070 like a normal default constructor.
2072 PR c++/92594 - ICE with inherited trivial default ctor.
2073 * method.c (trivial_fn_p): Treat an inherited default constructor
2074 like a normal default constructor.
2076 PR c++/92009 - ICE with punning of typeid.
2077 * rtti.c (get_tinfo_desc): Call xref_basetypes.
2078 * constexpr.c (cxx_fold_indirect_ref): Don't strip
2081 2020-01-13 Jason Merrill <jason@redhat.com>
2083 PR c++/92746 - ICE with noexcept of function concept check.
2084 * except.c (check_noexcept_r): Handle concept-check.
2086 PR c++/92582 - ICE with member template as requirement.
2087 * pt.c (struct find_template_parameter_info): Add ctx_parms.
2088 (any_template_parm_r): Handle TEMPLATE_DECL.
2089 (find_template_parameters): Take parms instead of their depth.
2090 * constraint.cc (build_parameter_mapping): Pass them.
2092 PR c++/33799 - destroy return value if local cleanup throws.
2093 * cp-tree.h (current_retval_sentinel): New macro.
2094 * decl.c (start_preparsed_function): Set up cleanup for retval.
2095 * typeck.c (check_return_expr): Set current_retval_sentinel.
2097 PR c++/93238 - short right-shift with enum.
2098 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
2100 2020-01-10 Jason Merrill <jason@redhat.com>
2102 * typeck.c (cp_build_binary_op): Restore short_shift code.
2104 PR c++/93143 - incorrect tree sharing with constexpr.
2105 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
2106 CONSTRUCTORs are already unshared.
2108 PR c++/93173 - incorrect tree sharing.
2110 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
2111 copy_if_shared after cp_genericize_tree.
2112 * typeck2.c (split_nonconstant_init): Don't unshare here.
2114 2020-01-08 Jason Merrill <jason@redhat.com>
2116 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
2117 TARGET_EXPR_DIRECT_INIT_P.
2118 * constexpr.c (cxx_eval_constant_expression): Likewise.
2120 2020-01-08 Jason Merrill <jason@redhat.com>
2122 PR c++/91369 - constexpr destructor and member initializer.
2123 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
2124 when not preevaluating.
2126 2020-01-08 Jason Merrill <jason@redhat.com>
2128 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
2131 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
2133 * init.c (build_new): Add location_t parameter and use it throughout.
2134 (build_raw_new_expr): Likewise.
2135 * parser.c (cp_parser_new_expression): Pass the combined_loc.
2136 * pt.c (tsubst_copy_and_build): Adjust call.
2137 * cp-tree.h: Update declarations.
2139 2020-01-07 Jason Merrill <jason@redhat.com>
2141 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
2142 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
2143 explicit class visibility for a template.
2145 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
2147 * mangle.c (mangle_type_attribute_p): New function, split out from...
2148 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
2149 that contain a space.
2151 2020-01-07 Jakub Jelinek <jakub@redhat.com>
2154 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
2155 member, initialize it to zero in ctor.
2156 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
2157 a heap object. Don't cache calls to functions which allocate some
2158 heap objects and don't deallocate them or deallocate some heap
2159 objects they didn't allocate.
2161 2020-01-06 Jason Merrill <jason@redhat.com>
2163 PR c++/92552 - ICE with inherited constrained default ctor.
2164 * pt.c (instantiate_class_template_1): Copy
2165 TYPE_HAS_USER_CONSTRUCTOR.
2166 * class.c (one_inherited_ctor): Don't set it here.
2168 2020-01-06 Andrew Sutton <asutton@lock3software.com>
2170 PR c++/92739 - parsing requires clause with attributes.
2171 * parser.c (cp_parser_constraint_requires_parens): Exclude
2172 attributes as postfix expressions.
2174 2020-01-05 Jakub Jelinek <jakub@redhat.com>
2177 * parser.c (cp_parser_check_class_key): Disable access checks for the
2179 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
2180 !warn_redundant_tags.
2182 2010-01-05 Jakub Jelinek <jakub@redhat.com>
2185 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
2186 TARGET_EXPR if it has been gimplified already.
2188 2020-01-03 Jason Merrill <jason@redhat.com>
2190 PR c++/93033 - incorrect tree node sharing with array init.
2191 * typeck2.c (split_nonconstant_init): Unshare non-decl.
2192 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
2194 2020-01-02 Jason Merrill <jason@redhat.com>
2196 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
2199 2020-01-02 Jakub Jelinek <jakub@redhat.com>
2202 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
2203 has not been found, rather than error_mark_node.
2205 2020-01-01 Jakub Jelinek <jakub@redhat.com>
2207 Update copyright years.
2209 Copyright (C) 2020 Free Software Foundation, Inc.
2211 Copying and distribution of this file, with or without modification,
2212 are permitted in any medium without royalty provided the copyright
2213 notice and this notice are preserved.