1 2020-04-04 Patrick Palka <ppalka@redhat.com>
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.
18 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
19 support for VECTOR_TYPEs, and optimizations for the common case)
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.
32 2020-04-04 Jason Merrill <jason@redhat.com>
35 * constraint.cc (tsubst_valid_expression_requirement): Call
38 2020-04-04 Jason Merrill <jason@redhat.com>
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
45 2020-04-04 Jakub Jelinek <jakub@redhat.com>
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.
53 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
54 omp_parallel_combined_clauses.
56 2020-04-03 Jason Merrill <jason@redhat.com>
59 * pt.c (complex_pack_expansion_r): New.
60 (complex_alias_template_p): Use it.
62 2020-03-31 Jason Merrill <jason@redhat.com>
65 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
67 * typeck2.c (store_init_value): Fix arguments to
68 fold_non_dependent_expr.
70 2020-03-31 Jason Merrill <jason@redhat.com>
72 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
75 2020-03-30 Jason Merrill <jason@redhat.com>
78 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
79 (called_fns_equal): Check DECL_CONTEXT.
81 2020-03-30 Jakub Jelinek <jakub@redhat.com>
84 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
85 STATEMENT_CODE_P code.
87 2020-03-28 Patrick Palka <ppalka@redhat.com>
90 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
91 "requires {" when "requires requires {" was probably intended.
94 * constraint.cc (tsubst_compound_requirement): Always suppress errors
95 from type_deducible_p and expression_convertible_p, as they're not
97 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
98 that we diagnose INTEGER_CST expressions of non-bool type via the
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
111 * constraint.cc (diagnose_compound_requirement): When diagnosing a
112 compound requirement, maybe replay the satisfaction failure, subject to
113 the current diagnosis depth.
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
123 (diagnose_valid_expression): When diagnosing a satisfaction failure,
124 maybe replay the substitution error, subject to the current diagnosis
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
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.
139 2020-03-27 Nathan Sidwell <nathan@acm.org>
142 * name-lookup.c (do_pushdecl): Look through cleanp levels.
144 2020-03-27 Martin Sebor <msebor@redhat.com>
149 * cp-tree.h (most_specialized_partial_spec): Declare.
150 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
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.
162 2020-03-27 Nathan Sidwell <nathan@acm.org>
165 * name-lookup.c (push_namespace): Triage ambiguous lookups that
168 2020-03-27 Jakub Jelinek <jakub@redhat.com>
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.
176 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
177 operand and creating a new COMPOUND_EXPR if anything changed.
179 2020-03-26 Marek Polacek <polacek@redhat.com>
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.
185 2020-03-27 Patrick Palka <ppalka@redhat.com>
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.
194 2020-03-26 Marek Polacek <polacek@redhat.com>
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.
205 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
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.
227 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
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
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-
241 2020-03-26 Jakub Jelinek <jakub@redhat.com>
244 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
245 true for all TEMPLATE_DECLs.
248 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
250 2020-03-25 Patrick Palka <ppalka@redhat.com>
253 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
254 current condition chain when the if-statement has a non-empty
257 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
260 * coroutines.cc (captures_temporary): Fix a missing dereference.
262 2020-03-24 Marek Polacek <polacek@redhat.com>
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.
267 2020-03-24 Jason Merrill <jason@redhat.com>
270 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
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.
277 2020-03-24 Jason Merrill <jason@redhat.com>
279 * pt.c (any_template_parm_r): Look into the type of a non-type
282 2020-03-24 Jason Merrill <jason@redhat.com>
284 * cp-tree.h (cp_expr): When constructing from an expr and a
285 location, call protected_set_expr_location.
287 2020-03-23 Patrick Palka <ppalka@redhat.com>
290 * except.c (maybe_noexcept_warning): Add TODO.
291 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
293 2020-03-23 nathans <nathan@acm.org>
296 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
299 2020-03-21 Patrick Palka <ppalka@redhat.com>
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
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
314 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
315 CONSTRUCTOR returned by lookup_placeholder.
317 2020-03-20 Patrick Palka <ppalka@redhat.com>
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.
327 2020-03-19 Jason Merrill <jason@redhat.com>
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
338 2020-03-19 Jakub Jelinek <jakub@redhat.com>
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
346 2020-03-18 Nathan Sidwell <nathan@acm.org>
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.
354 2020-03-18 Jakub Jelinek <jakub@redhat.com>
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):
360 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
361 * pt.c (append_type_to_template_for_access_check): Likewise.
364 * decl.c (grokfndecl): Restore old diagnostics about deduction
365 guide declared in different scope if in_namespace is NULL_TREE.
367 2020-03-17 Jakub Jelinek <jakub@redhat.com>
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.
377 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
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.
384 2020-03-17 Jakub Jelinek <jakub@redhat.com>
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
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.
394 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
396 * coroutines.cc (co_await_expander): Fix indentation.
398 2020-03-14 Jason Merrill <jason@redhat.com>
401 * pt.c (process_partial_specialization): Error rather than crash on
402 extra pack expansion.
404 2020-03-14 Jason Merrill <jason@redhat.com>
407 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
408 DECL_ORIGINAL_TYPE of a typedef.
410 2020-03-14 Jason Merrill <jason@redhat.com>
413 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
414 substituting DECL_ARGUMENTS.
416 2020-03-14 Jakub Jelinek <jakub@redhat.com>
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
422 2020-03-13 Patrick Palka <ppalka@redhat.com>
425 * call.c (build_over_call): Use a warning_sentinel to disable
426 warn_deprecated_decl before calling build_addr_func.
428 2020-03-12 Jakub Jelinek <jakub@redhat.com>
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
435 2020-03-11 Jason Merrill <jason@redhat.com>
438 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
441 2020-03-11 Marek Polacek <polacek@redhat.com>
442 Jason Merrill <jason@redhat.com>
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.
451 2020-03-10 Marek Polacek <polacek@redhat.com>
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.
457 2020-03-10 Jason Merrill <jason@redhat.com>
460 * pt.c (maybe_instantiate_noexcept): Always update clones.
462 2020-03-10 Jason Merrill <jason@redhat.com>
465 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
467 2020-03-10 Jason Merrill <jason@redhat.com>
473 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
474 66139: Don't split_nonconstant_init. Remove pre_p parameter.
476 2020-03-09 Marek Polacek <polacek@redhat.com>
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.
498 2020-03-09 Jakub Jelinek <jakub@redhat.com>
502 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
504 * constexpr.c (cxx_eval_constant_expression): Do not handle
505 RROTATE_EXPR and LROTATE_EXPR.
507 2020-03-09 Marek Polacek <polacek@redhat.com>
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.
513 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
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.
519 2020-03-08 Patrick Palka <ppalka@redhat.com>
522 * call.c (convert_like_real): Check complain before emitting an error
523 about binding a bit-field to a reference.
525 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
526 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
529 2020-03-06 Nathan Sidwell <nathan@acm.org>
532 * mangle.c (find_substitution): Don't call same_type_p on template
533 args that cannot match.
535 2020-03-04 Martin Sebor <msebor@redhat.com>
538 * tree.c (type_initializer_zero_p): Fail for structs initialized
541 2020-03-04 Jason Merrill <jason@redhat.com>
544 * init.c (perform_member_init): Don't do aggregate initialization of
546 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
547 initialization of empty field.
549 2020-03-04 Martin Liska <mliska@suse.cz>
551 * method.c: Wrap array in ctor with braces in order
552 to silent clang warnings.
554 2020-03-03 Jason Merrill <jason@redhat.com>
555 Marek Polacek <polacek@redhat.com>
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.
561 2020-03-03 Jakub Jelinek <jakub@redhat.com>
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.
568 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
570 * coroutines.cc (captures_temporary): Strip component_ref
573 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
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.
581 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
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
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.
596 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
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
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.
608 2020-02-28 Jason Merrill <jason@redhat.com>
610 Implement P2092R0, Disambiguating Nested-Requirements
611 * parser.c (cp_parser_requirement_parameter_list): Pass
612 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
614 * call.c (build_user_type_conversion_1): Don't look at the second
615 conversion of a non-viable candidate.
617 2020-02-28 Jakub Jelinek <jakub@redhat.com>
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.
623 2020-02-27 Nathan Sidwell <nathan@acm.org>
626 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
628 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
629 * typeck.c (comptypes): Assert we don't get any argument packs.
631 * class.c (adjust_clone_args): Correct arg-checking assert.
632 * typeck.c (comptypes): Assert not nulls.
634 2020-02-26 Marek Polacek <polacek@redhat.com>
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.
640 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
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
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.
655 2020-02-26 Patrick Palka <ppalka@redhat.com>
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
663 (diagnose_requires_expr): Likewise.
664 (diagnose_atomic_constraint): Likewise. When printing an atomic
665 constraint expression, print the instantiated parameter mapping
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.
671 2020-02-26 Marek Polacek <polacek@redhat.com>
673 PR c++/93676 - value-init crash in template.
674 * init.c (build_new_1): Don't call build_vec_init in a template.
676 2020-02-26 Marek Polacek <polacek@redhat.com>
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.
684 2020-02-26 Marek Polacek <polacek@redhat.com>
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
690 2020-02-24 Martin Sebor <msebor@redhat.com>
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.
697 2020-02-24 Marek Polacek <polacek@redhat.com>
699 PR c++/93869 - ICE with -Wmismatched-tags.
700 * parser.c (cp_parser_check_class_key): Check class_key earlier.
702 2020-02-24 Marek Polacek <polacek@redhat.com>
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.
711 2020-02-24 Jakub Jelinek <jakub@redhat.com>
713 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
714 * call.c (build_over_call): Don't evaluate immediate functions in
715 unevaluated operands.
717 2020-02-24 Jason Merrill <jason@redhat.com>
719 P0780R2: Resolve lambda init-capture pack grammar.
720 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
723 2020-02-22 Marek Polacek <polacek@redhat.com>
726 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
728 2020-02-21 Martin Sebor <msebor@redhat.com>
730 PR gcov-profile/93753
731 * class.c (check_flexarrays): Tighten up a test for potential members
732 of anonymous structs or unions.
734 2020-02-20 Martin Sebor <msebor@redhat.com>
737 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
739 2020-02-20 Martin Liska <mliska@suse.cz>
742 * config/or1k/or1k.opt: Remove superfluous word.
743 * doc/invoke.texi: Likewise.
745 2020-02-20 Martin Liska <mliska@suse.cz>
748 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
750 2020-02-19 Marek Polacek <polacek@redhat.com>
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.
756 2020-02-15 Marek Polacek <polacek@redhat.com>
758 PR c++/93710 - poor diagnostic for array initializer.
759 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
762 2020-02-15 Jason Merrill <jason@redhat.com>
765 * pt.c (any_template_parm_r): Look into lambda body.
768 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
770 2020-02-14 Jakub Jelinek <jakub@redhat.com>
773 * class.c (enum_min_precision): Change prec type from int to int &.
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
782 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
783 is disabled for compatibility.
785 2020-02-13 Jason Merrill <jason@redhat.com>
788 * name-lookup.c (matching_fn_p): A function does not match a
793 * tree.c (decl_linkage): Always lk_none for locals.
795 2020-02-12 Jason Merrill <jason@redhat.com>
799 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
800 * pt.c (find_parameter_packs_r): Not here.
802 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
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.
809 2020-02-12 Marek Polacek <polacek@redhat.com>
811 PR c++/93684 - ICE-on-invalid with broken attribute.
812 * parser.c (cp_parser_std_attribute): Peek a token first before
815 2020-02-11 Jason Merrill <jason@redhat.com>
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.
824 2020-02-11 Jason Merrill <jason@redhat.com>
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.
832 2020-02-12 Patrick Palka <ppalka@redhat.com>
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
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
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.
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.
854 2020-02-10 Jakub Jelinek <jakub@redhat.com>
857 * error.c (dump_decl_name): Fix up last argument to strncmp.
859 2020-02-10 Jason Merrill <jason@redhat.com>
862 * tree.c (array_of_unknown_bound_p): New.
863 * init.c (perform_member_init): Do nothing for flexible arrays.
865 2020-02-09 Jakub Jelinek <jakub@redhat.com>
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
872 2020-02-08 Jason Merrill <jason@redhat.com>
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.
883 * constexpr.c (maybe_constant_value): Don't unshare if the cached
884 value is the same as the argument.
886 * typeck.c (maybe_warn_about_returning_address_of_local): Add
889 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
892 2020-02-08 Jakub Jelinek <jakub@redhat.com>
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.
901 2020-02-07 Marek Polacek <polacek@redhat.com>
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.
907 2020-02-06 Jason Merrill <jason@redhat.com>
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.
917 2020-02-06 Jason Merrill <jason@redhat.com>
920 * parser.c (cp_parser_constraint_primary_expression): Do the main
921 parse non-tentatively.
923 2020-02-06 Marek Polacek <polacek@redhat.com>
925 PR c++/93597 - ICE with lambda in operator function.
926 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
928 2020-02-05 Jason Merrill <jason@redhat.com>
931 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
932 handling of TREE_CHAIN for empty pack.
934 2020-02-05 Jakub Jelinek <jakub@redhat.com>
937 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
938 prior to passing it to c_build_vec_convert.
940 2020-02-05 Marek Polacek <polacek@redhat.com>
942 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
943 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
946 2020-02-05 Jason Merrill <jason@redhat.com>
949 * decl.c (grokdeclarator): Reject field of current class type even
952 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
954 * coroutines.cc (maybe_promote_captured_temps): Increase the index
955 number for temporary variables' name.
957 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
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.
963 (co_await_expander): Sink to call_expr if await_resume
964 is wrapped by indirect_ref.
966 2020-02-04 Jason Merrill <jason@redhat.com>
969 * constraint.cc (satisfy_declaration_constraints): Check return
970 value of push_tinst_level.
973 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
974 elements instead of value-initializing them.
977 * init.c (perform_member_init): Simplify.
978 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
980 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
982 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
984 * coroutines.cc (find_promise_type): Delete unused forward
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.
990 2020-02-03 Jason Merrill <jason@redhat.com>
993 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
994 defer loading the value of a reference.
996 2020-02-03 Jason Merrill <jason@redhat.com>
999 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
1001 [COMPONENT_REF]: A member function reference doesn't use the object
1004 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
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
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
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
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.
1026 2020-02-03 Jason Merrill <jason@redhat.com>
1029 * cp-gimplify.c (predeclare_vla): New.
1030 (cp_genericize_r) [NOP_EXPR]: Call it.
1032 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
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.
1038 2020-02-02 Marek Polacek <polacek@redhat.com>
1040 PR c++/93530 - ICE on invalid alignas in a template.
1041 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
1044 2020-01-31 Jason Merrill <jason@redhat.com>
1047 * semantics.c (process_outer_var_ref): Capture VLAs even in
1048 unevaluated context.
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.
1058 * parser.c (cp_parser_initializer_list): Suppress location wrappers
1061 2020-01-29 Jason Merrill <jason@redhat.com>
1064 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
1065 the expression was dependent before substitution.
1067 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
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.
1074 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
1076 * coroutines.cc (co_await_expander): Handle type conversion case.
1078 2020-01-29 Jason Merrill <jason@redhat.com>
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
1088 2020-01-29 Marek Polacek <polacek@redhat.com>
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
1095 2020-01-29 Marek Polacek <polacek@redhat.com>
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.
1103 2020-01-29 Jakub Jelinek <jakub@redhat.com>
1106 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
1107 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
1109 2020-01-28 Jason Merrill <jason@redhat.com>
1112 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
1116 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
1119 * call.c (build_user_type_conversion_1): Allow a template conversion
1120 returning an rvalue reference to bind directly to an lvalue.
1123 * decl.c (grokdeclarator): Propagate eh spec from typedef.
1125 2020-01-28 Martin Liska <mliska@suse.cz>
1128 * pt.c (redeclare_class_template): Group couple of
1129 errors and inform messages with auto_diagnostic_group.
1131 2020-01-28 Martin Liska <mliska@suse.cz>
1134 * pt.c (redeclare_class_template): Use inform
1135 for the second location.
1137 2020-01-27 Jason Merrill <jason@redhat.com>
1140 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
1142 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
1145 * coroutines.cc (morph_fn_to_coro): Check the ramp return
1146 value when it is constructed from the 'get return object'.
1148 2020-01-27 Nathan Sidwell <nathan@acm.org>
1151 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
1153 2020-01-26 Jason Merrill <jason@redhat.com>
1156 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
1157 temporarily enable -Wsystem-headers. Change second warning to
1161 * semantics.c (finish_call_expr): Don't call
1162 instantiate_non_dependent_expr before warn_for_memset.
1164 2020-01-25 Marek Polacek <polacek@redhat.com>
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.
1170 2020-01-24 Jason Merrill <jason@redhat.com>
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.
1179 2020-01-24 Jason Merrill <jason@redhat.com>
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.
1185 2020-01-24 Jason Merrill <jason@redhat.com>
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.
1191 2020-01-24 Marek Polacek <polacek@redhat.com>
1193 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
1194 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
1196 2020-01-24 Jason Merrill <jason@redhat.com>
1198 PR c++/92852 - ICE with generic lambda and reference var.
1199 * constexpr.c (maybe_constant_value): Likewise.
1201 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
1204 * parser.c (cp_parser_nested_name_specifier_opt): Properly
1205 diagnose concept-ids.
1207 2020-01-23 Jason Merrill <jason@redhat.com>
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.
1213 PR c++/93345 - ICE with defaulted dtor and template.
1215 * decl.c (cxx_maybe_build_cleanup): Don't try to set
1216 throwing_cleanup in a template.
1218 2020-01-22 Marek Polacek <polacek@redhat.com>
1220 PR c++/92907 - noexcept does not consider "const" in member functions.
1221 * g++.dg/cpp0x/noexcept56.C: New test.
1223 2020-01-22 Marek Polacek <polacek@redhat.com>
1225 PR c++/93324 - ICE with -Wall on constexpr if.
1226 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
1228 2020-01-22 Patrick Palka <ppalka@redhat.com>
1230 * constraint.cc (get_mapped_args): Avoid using auto_vec
1231 as a vector element. Release the vectors inside the lists
1233 * parser.c (cp_literal_operator_id): Free the buffer.
1235 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
1237 * coroutines.cc (finish_co_await_expr): Add error check on return
1238 value of build_co_await.
1239 (finish_co_yield_expr,): Ditto.
1241 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
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.
1247 2020-01-21 Jason Merrill <jason@redhat.com>
1249 PR c++/60855 - ICE with sizeof VLA capture.
1250 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
1252 PR c++/90732 - ICE with VLA capture and generic lambda.
1253 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
1255 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
1256 Bin Cheng <bin.cheng@linux.alibaba.com>
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.
1265 2020-01-21 Jason Merrill <jason@redhat.com>
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.
1273 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
1275 * coroutines.cc (finish_co_await_expr): Set return value flag.
1276 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
1278 2020-01-19 Jason Merrill <jason@redhat.com>
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.
1290 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
1292 2020-01-18 Jakub Jelinek <jakub@redhat.com>
1294 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
1295 but non-NO_DOLLAR_IN_LABEL case build.
1297 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
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
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
1331 * tree.c (cp_walk_subtrees): Likewise.
1333 2020-01-17 Jason Merrill <jason@redhat.com>
1335 PR c++/92531 - ICE with noexcept(lambda).
1336 * pt.c (uses_template_parms): Don't try to enumerate all the
1339 2020-01-17 Jakub Jelinek <jakub@redhat.com>
1342 * parser.c (cp_parser_template_name): Look up deprecated attribute
1343 in DECL_TEMPLATE_RESULT or its type's attributes.
1345 2020-01-16 Jason Merrill <jason@redhat.com>
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.
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.
1355 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
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*
1362 (cp_parser_condition): Update call.
1363 (cp_parser_simple_declaration): Likewise.
1364 (cp_parser_placeholder_type_specifier): Correctly handle
1365 concept-check expressions.
1367 2020-01-15 Jason Merrill <jason@redhat.com>
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.
1375 PR c++/93257 - consteval void function.
1376 * constexpr.c (verify_constant): Allow void_node.
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.
1382 2020-01-14 Nathan Sidwell <nathan@acm.org>
1385 * pt.c (retrieve_specialization): Use get_template_info, not open
1389 * pt.c (retrieve_specialization): Get the TI from the decl or the
1390 classtype as appropriate.
1392 2020-01-14 David Malcolm <dmalcolm@redhat.com>
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.
1400 2020-01-14 Jason Merrill <jason@redhat.com>
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.
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.
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.
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
1425 2020-01-13 Jason Merrill <jason@redhat.com>
1427 PR c++/92746 - ICE with noexcept of function concept check.
1428 * except.c (check_noexcept_r): Handle concept-check.
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.
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.
1441 PR c++/93238 - short right-shift with enum.
1442 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
1444 2020-01-10 Jason Merrill <jason@redhat.com>
1446 * typeck.c (cp_build_binary_op): Restore short_shift code.
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.
1452 PR c++/93173 - incorrect tree sharing.
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.
1458 2020-01-08 Jason Merrill <jason@redhat.com>
1460 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
1461 TARGET_EXPR_DIRECT_INIT_P.
1462 * constexpr.c (cxx_eval_constant_expression): Likewise.
1464 2020-01-08 Jason Merrill <jason@redhat.com>
1466 PR c++/91369 - constexpr destructor and member initializer.
1467 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
1468 when not preevaluating.
1470 2020-01-08 Jason Merrill <jason@redhat.com>
1472 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
1475 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
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.
1483 2020-01-07 Jason Merrill <jason@redhat.com>
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.
1489 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
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.
1495 2020-01-07 Jakub Jelinek <jakub@redhat.com>
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.
1505 2020-01-06 Jason Merrill <jason@redhat.com>
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.
1512 2020-01-06 Andrew Sutton <asutton@lock3software.com>
1514 PR c++/92739 - parsing requires clause with attributes.
1515 * parser.c (cp_parser_constraint_requires_parens): Exclude
1516 attributes as postfix expressions.
1518 2020-01-05 Jakub Jelinek <jakub@redhat.com>
1521 * parser.c (cp_parser_check_class_key): Disable access checks for the
1523 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
1524 !warn_redundant_tags.
1526 2010-01-05 Jakub Jelinek <jakub@redhat.com>
1529 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
1530 TARGET_EXPR if it has been gimplified already.
1532 2020-01-03 Jason Merrill <jason@redhat.com>
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.
1538 2020-01-02 Jason Merrill <jason@redhat.com>
1540 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
1543 2020-01-02 Jakub Jelinek <jakub@redhat.com>
1546 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
1547 has not been found, rather than error_mark_node.
1549 2020-01-01 Jakub Jelinek <jakub@redhat.com>
1551 Update copyright years.
1553 Copyright (C) 2020 Free Software Foundation, Inc.
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.