1 2020-04-13 Patrick Palka <ppalka@redhat.com>
4 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
5 dump_function_decl when printing a function template instantiation as a
9 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
11 (cxx_eval_bare_aggregate): Use get_or_insert_ctor_field instead of
12 assuming the the next index belongs at the end of the new CONSTRUCTOR.
13 (cxx_eval_store_expression): Revert PR c++/78572 fix.
15 2020-04-13 Nathan Sidwell <nathan@acm.org>
17 PR c++/94426 lambdas with internal linkage are different to no-linkage
18 * decl2.c (determine_visibility): A lambda's visibility is
19 affected by its extra scope.
20 * pt.c (instantiate_decl): Determine var's visibility before
21 instantiating its initializer.
22 * tree.c (no_linkage_check): Revert code looking at visibility of
25 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
28 * coroutines.cc (co_await_expander): Remove.
29 (expand_one_await_expression): New.
30 (process_one_statement): New.
31 (await_statement_expander): New.
32 (build_actor_fn): Revise to use per-statement expander.
33 (struct susp_frame_data): Reorder and comment.
34 (register_awaits): Factor code.
35 (replace_statement_captures): New, factored from...
36 (maybe_promote_captured_temps):.. here.
37 (await_statement_walker): Revise to process per statement.
38 (morph_fn_to_coro): Use revised susp_frame_data layout.
40 2020-04-10 Marek Polacek <polacek@redhat.com>
43 * method.c (constructible_expr): In C++20, try using parenthesized
44 initialization of aggregates to determine the result of
47 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
49 * coroutines.cc (co_await_expander): Simplify.
51 2020-04-09 Jason Merrill <jason@redhat.com>
54 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
55 ctx->object and ctx->global->values first.
57 2020-04-09 Marek Polacek <polacek@redhat.com>
60 * call.c (initialize_reference): If the reference binding failed, maybe
61 try initializing from { }.
62 * decl.c (grok_reference_init): For T& t(e), set
63 LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet.
65 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
66 Jun Ma <JunMa@linux.alibaba.com>
68 * coroutines.cc (maybe_promote_captured_temps): Add a cleanup
69 expression, if needed, to any call from which we promoted
70 temporaries captured by reference.
72 2020-04-08 Marek Polacek <polacek@redhat.com>
74 PR c++/94507 - ICE-on-invalid with lambda template.
75 * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
76 tsubst_function_decl returns error_mark_node.
78 2020-04-08 Martin Liska <mliska@suse.cz>
81 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
82 (cxx_init_decl_processing): Mark replaceable all implicitly defined
85 2020-04-08 Patrick Palka <ppalka@redhat.com>
87 Core issues 1001 and 1322
89 * pt.c (rebuild_function_or_method_type): Split function out from ...
90 (tsubst_function_type): ... here.
91 (maybe_rebuild_function_decl_type): New function.
92 (tsubst_function_decl): Use it.
94 2020-04-08 Jakub Jelinek <jakub@redhat.com>
97 * decl.c (begin_destructor_body): For CLASSTYPE_VBASECLASSES class
98 dtors, if CLASSTYPE_PRIMARY_BINFO is non-NULL, but not BINFO_VIRTUAL_P,
99 look at CLASSTYPE_PRIMARY_BINFO of its BINFO_TYPE if it is not
100 BINFO_VIRTUAL_P, and so on.
102 2020-04-08 Marek Polacek <polacek@redhat.com>
104 PR c++/94478 - ICE with defaulted comparison operator
105 * method.c (early_check_defaulted_comparison): Give an error when the
108 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
111 * paser.c (cp_parser_oacc_declare): Add check that variables
112 are declared in the same scope as the directive.
114 2020-04-07 Jason Merrill <jason@redhat.com>
117 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
120 * parser.c (cp_parser_placeholder_type_specifier): Use
123 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
125 * coroutines.cc (maybe_promote_captured_temps): Ensure that
126 reference capture placeholder vars are properly declared.
128 2020-04-07 Patrick Palka <ppalka@redhat.com>
131 * tree.c (replace_placeholders): Look through all handled components,
132 not just COMPONENT_REFs.
133 * typeck2.c (process_init_constructor_array): Propagate
134 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
135 the array initializer.
137 2020-04-07 Jakub Jelinek <jakub@redhat.com>
140 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
141 if cp_parser_omp_master succeeded.
143 2020-04-06 Jason Merrill <jason@redhat.com>
146 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
148 2020-04-04 Marek Polacek <polacek@redhat.com>
149 Jason Merrill <jason@redhat.com>
151 PR c++/94155 - crash in gimplifier with paren init of aggregates.
152 * init.c (build_vec_init): Fill in indexes.
154 2020-04-04 Jason Merrill <jason@redhat.com>
157 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
159 2020-04-04 Patrick Palka <ppalka@redhat.com>
163 * constexpr.c (struct constexpr_ctx): New field 'parent'.
164 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
165 flag from the original constructor to the reduced constructor.
166 (lookup_placeholder): Prefer to return the outermost matching object
167 by recursively calling lookup_placeholder on the 'parent' context,
168 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
169 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
170 context via 'new_ctx.parent' when being expanded without an explicit
171 target. Don't call replace_placeholders.
172 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
176 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
177 support for VECTOR_TYPEs, and optimizations for the common case)
179 (cxx_eval_store_expression): ... here. Rename local variable
180 'changed_active_union_member_p' to 'activated_union_member_p'. Record
181 the sequence of indexes into 'indexes' that yields the subobject we're
182 assigning to. Record the integer offsets of the constructor indexes
183 we're assigning through into 'index_pos_hints'. After evaluating the
184 initializer of the store expression, recompute 'valp' using 'indexes'
185 and using 'index_pos_hints' as hints.
186 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
187 to recompute the constructor_elt pointer we're assigning through after
188 evaluating each initializer.
190 2020-04-04 Jason Merrill <jason@redhat.com>
193 * constraint.cc (tsubst_valid_expression_requirement): Call
196 2020-04-04 Jason Merrill <jason@redhat.com>
199 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
200 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
203 2020-04-04 Jakub Jelinek <jakub@redhat.com>
206 * parser.c (cp_parser_omp_for_loop): Use
207 protected_set_expr_location_if_unset.
208 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
211 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
212 omp_parallel_combined_clauses.
214 2020-04-03 Jason Merrill <jason@redhat.com>
217 * pt.c (complex_pack_expansion_r): New.
218 (complex_alias_template_p): Use it.
220 2020-03-31 Jason Merrill <jason@redhat.com>
223 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
224 replace_placeholders.
225 * typeck2.c (store_init_value): Fix arguments to
226 fold_non_dependent_expr.
228 2020-03-31 Jason Merrill <jason@redhat.com>
230 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
233 2020-03-30 Jason Merrill <jason@redhat.com>
236 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
237 (called_fns_equal): Check DECL_CONTEXT.
239 2020-03-30 Jakub Jelinek <jakub@redhat.com>
242 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
243 STATEMENT_CODE_P code.
245 2020-03-28 Patrick Palka <ppalka@redhat.com>
248 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
249 "requires {" when "requires requires {" was probably intended.
252 * constraint.cc (tsubst_compound_requirement): Always suppress errors
253 from type_deducible_p and expression_convertible_p, as they're not
255 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
256 that we diagnose INTEGER_CST expressions of non-bool type via the
258 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
259 * parser.c (cp_parser_requires_expression): Always parse the requirement
260 body as if we're processing a template, by temporarily incrementing
261 processing_template_decl. Afterwards, if we're not actually in a
262 template context, perform semantic processing to diagnose any invalid
263 types and expressions.
264 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
265 * semantics.c (finish_static_assert): Explain an assertion failure
266 when the condition is a REQUIRES_EXPR like we do when it is a concept
269 * constraint.cc (diagnose_compound_requirement): When diagnosing a
270 compound requirement, maybe replay the satisfaction failure, subject to
271 the current diagnosis depth.
273 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
274 as well as its range, because build_x_binary_op doesn't always do so.
275 (current_constraint_diagnosis_depth): New.
276 (concepts_diagnostics_max_depth_exceeded_p): New.
277 (collect_operands_of_disjunction): New.
278 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
279 replay each branch of the disjunction, subject to the current diagnosis
281 (diagnose_valid_expression): When diagnosing a satisfaction failure,
282 maybe replay the substitution error, subject to the current diagnosis
284 (diagnose_valid_type): Likewise.
285 (diagnose_nested_requiremnet): Likewise.
286 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
287 current_constraint_diagnosis_depth when diagnosing.
288 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
289 current_constraint_diagnosis_depth when diagnosing.
290 (diagnosing_failed_constraint::replay_errors_p): New static member
292 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
293 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
294 the limit was exceeded.
295 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
297 2020-03-27 Nathan Sidwell <nathan@acm.org>
300 * name-lookup.c (do_pushdecl): Look through cleanp levels.
302 2020-03-27 Martin Sebor <msebor@redhat.com>
307 * cp-tree.h (most_specialized_partial_spec): Declare.
308 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
310 (specialization_of): New function.
311 (cp_parser_check_class_key): Move code...
312 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
313 -Wredundant-tags on first-time declarations in other declarators.
314 Correct handling of template specializations.
315 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
316 when -Wredundant-tags is enabled. Use primary template or partial
317 specialization as the guide for uses of implicit instantiations.
318 * pt.c (most_specialized_partial_spec): Declare extern.
320 2020-03-27 Nathan Sidwell <nathan@acm.org>
323 * name-lookup.c (push_namespace): Triage ambiguous lookups that
326 2020-03-27 Jakub Jelinek <jakub@redhat.com>
329 * call.c (set_flags_from_callee): Don't update
330 cp_function_chain->can_throw or current_function_returns_abnormally
331 if cp_unevaluated_operand.
334 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
335 operand and creating a new COMPOUND_EXPR if anything changed.
337 2020-03-26 Marek Polacek <polacek@redhat.com>
339 PR c++/94336 - template keyword accepted before destructor names.
340 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
341 is followed by a destructor name.
343 2020-03-27 Patrick Palka <ppalka@redhat.com>
345 * decl.c (compute_array_index_type_loc): Remove redundant
346 type_dependent_expression_p check that is subsumed by
347 value_dependent_expression_p.
348 * decl2.c (is_late_template_attribute): Likewise.
349 * pt.c (uses_template_parms): Likewise.
350 (dependent_template_arg_p): Likewise.
352 2020-03-26 Marek Polacek <polacek@redhat.com>
355 PR c++/94057 - template keyword in a typename-specifier.
356 * parser.c (check_template_keyword_in_nested_name_spec): New.
357 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
358 'template'. Call check_template_keyword_in_nested_name_spec.
359 (cp_parser_simple_type_specifier): Assume that a <
360 following a qualified-id in a typename-specifier begins
361 a template argument list.
363 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
365 * coroutines.cc (coro_init_identifiers): Initialize an identifier
366 for the cororoutine handle 'address' method name.
367 (struct coro_aw_data): Add fields to cover the continuations.
368 (co_await_expander): Determine the kind of await_suspend in use.
369 If we have the case that returns a continuation handle, then save
370 this and make the target for 'scope exit without cleanup' be the
371 continuation resume label.
372 (expand_co_awaits): Remove.
373 (struct suspend_point_info): Remove fields that kept the returned
374 await_suspend handle type.
375 (transform_await_expr): Remove code tracking continuation handles.
376 (build_actor_fn): Add the continuation handle as an actor-function
377 scope var. Build the symmetric transfer continuation point. Call
378 the tree walk for co_await expansion directly, rather than via a
379 trivial shim function.
380 (register_await_info): Remove fields tracking continuation handles.
381 (get_await_suspend_return_type): Remove.
382 (register_awaits): Remove code tracking continuation handles.
383 (morph_fn_to_coro): Remove code tracking continuation handles.
385 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
387 * coroutines.cc (co_await_expander): If we are expanding the
388 initial await expression, set a boolean flag to show that we
389 have now reached the initial await_resume() method call.
390 (expand_co_awaits): Handle the 'initial await resume called' flag.
391 (build_actor_fn): Insert the initial await expression into the
392 start of the user-authored function-body. Handle the 'initial await
394 (morph_fn_to_coro): Initialise the 'initial await resume called'
395 flag. Modify the unhandled exception catch clause to recognise
396 exceptions that occur before the initial await_resume() and re-
399 2020-03-26 Jakub Jelinek <jakub@redhat.com>
402 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
403 true for all TEMPLATE_DECLs.
406 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
408 2020-03-25 Patrick Palka <ppalka@redhat.com>
411 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
412 current condition chain when the if-statement has a non-empty
415 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
418 * coroutines.cc (captures_temporary): Fix a missing dereference.
420 2020-03-24 Marek Polacek <polacek@redhat.com>
422 PR c++/94190 - wrong no post-decrement operator error in template.
423 * call.c (convert_like_real): Use convert_from_reference on the result.
425 2020-03-24 Jason Merrill <jason@redhat.com>
428 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
430 (tsubst_nested_requirement): Likewise.
431 (get_constraint_error_location): Allow missing context.
432 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
433 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
435 2020-03-24 Jason Merrill <jason@redhat.com>
437 * pt.c (any_template_parm_r): Look into the type of a non-type
440 2020-03-24 Jason Merrill <jason@redhat.com>
442 * cp-tree.h (cp_expr): When constructing from an expr and a
443 location, call protected_set_expr_location.
445 2020-03-23 Patrick Palka <ppalka@redhat.com>
448 * except.c (maybe_noexcept_warning): Add TODO.
449 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
451 2020-03-23 nathans <nathan@acm.org>
454 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
457 2020-03-21 Patrick Palka <ppalka@redhat.com>
460 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
461 handle unions without an initializer.
462 (cxx_eval_component_reference): Emit a different diagnostic when the
463 constructor element corresponding to a union member is NULL.
464 (cxx_eval_bare_aggregate): When constructing a union, always set the
465 active union member before evaluating the initializer. Relax assertion
466 that verifies the index of the constructor element we're initializing
468 (cxx_eval_store_expression): Diagnose changing the active union member
469 while the union is in the process of being initialized. After setting
470 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
472 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
473 CONSTRUCTOR returned by lookup_placeholder.
475 2020-03-20 Patrick Palka <ppalka@redhat.com>
477 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
478 the "[with ]" bits to here from ...
479 (pp_cxx_atomic_constraint): ... here.
480 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
481 * error.c (rebuild_concept_check): Delete.
482 (print_concept_check_info): Print the dependent form of the constraint and the
483 preferably substituted parameter mapping alongside it.
485 2020-03-19 Jason Merrill <jason@redhat.com>
488 * cp-gimplify.c (simple_empty_class_p): Look through
489 SIMPLE_TARGET_EXPR_P.
490 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
491 [RETURN_EXPR]: Avoid producing 'return *retval;'.
492 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
493 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
496 2020-03-19 Jakub Jelinek <jakub@redhat.com>
499 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
500 on outer_automatic_var_p decls.
501 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
504 2020-03-18 Nathan Sidwell <nathan@acm.org>
506 PR c++/94147 - mangling of lambdas assigned to globals
507 * parser.c (cp_parser_init_declarator): Namespace-scope variables
508 provide a lambda scope.
509 * tree.c (no_linkage_check): Lambdas with a variable for extra
510 scope have a linkage from the variable.
512 2020-03-18 Jakub Jelinek <jakub@redhat.com>
514 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
515 strictly_subsumes): Fix up duplicated word issue in a comment.
516 * coroutines.cc (build_init_or_final_await, captures_temporary):
518 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
519 * pt.c (append_type_to_template_for_access_check): Likewise.
522 * decl.c (grokfndecl): Restore old diagnostics about deduction
523 guide declared in different scope if in_namespace is NULL_TREE.
525 2020-03-17 Jakub Jelinek <jakub@redhat.com>
528 * parser.c (cp_parser_enum_specifier): Use temp_override for
529 parser->colon_corrects_to_scope_p, replace goto out with return.
530 If scoped enum or enum with underlying type is not followed by
531 { or ;, call cp_parser_commit_to_tentative_parse before calling
532 cp_parser_error and make sure to return error_mark_node instead of
533 NULL_TREE. Formatting fixes.
535 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
538 * method.c (assignable_expr): Use cp_unevaluated.
539 (is_xible_helper): Push a non-deferred access check for
540 the stub objects created by assignable_expr and constructible_expr.
542 2020-03-17 Jakub Jelinek <jakub@redhat.com>
544 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
545 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
547 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
548 cp_parser_placeholder_type_specifier,
549 cp_parser_constraint_requires_parens): Likewise.
550 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
552 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
554 * coroutines.cc (co_await_expander): Fix indentation.
556 2020-03-14 Jason Merrill <jason@redhat.com>
559 * pt.c (process_partial_specialization): Error rather than crash on
560 extra pack expansion.
562 2020-03-14 Jason Merrill <jason@redhat.com>
565 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
566 DECL_ORIGINAL_TYPE of a typedef.
568 2020-03-14 Jason Merrill <jason@redhat.com>
571 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
572 substituting DECL_ARGUMENTS.
574 2020-03-14 Jakub Jelinek <jakub@redhat.com>
576 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
577 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
580 2020-03-13 Patrick Palka <ppalka@redhat.com>
583 * call.c (build_over_call): Use a warning_sentinel to disable
584 warn_deprecated_decl before calling build_addr_func.
586 2020-03-12 Jakub Jelinek <jakub@redhat.com>
589 * decl.c (reshape_init_array_1): Don't unshare constructor if there
590 aren't any trailing zero elts, otherwise only unshare the first
593 2020-03-11 Jason Merrill <jason@redhat.com>
596 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
599 2020-03-11 Marek Polacek <polacek@redhat.com>
600 Jason Merrill <jason@redhat.com>
602 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
603 * constexpr.c (cref_has_const_field): New function.
604 (modifying_const_object_p): Consider a COMPONENT_REF
605 const only if any of its fields are const.
606 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
607 as readonly after its initialization has been done.
609 2020-03-10 Marek Polacek <polacek@redhat.com>
611 PR c++/94124 - wrong conversion error with non-viable overload.
612 * decl.c (reshape_init_array_1): Unshare a constructor if we
613 stripped trailing zero-initializers.
615 2020-03-10 Jason Merrill <jason@redhat.com>
618 * pt.c (maybe_instantiate_noexcept): Always update clones.
620 2020-03-10 Jason Merrill <jason@redhat.com>
623 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
625 2020-03-10 Jason Merrill <jason@redhat.com>
631 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
632 66139: Don't split_nonconstant_init. Remove pre_p parameter.
634 2020-03-09 Marek Polacek <polacek@redhat.com>
636 PR c++/92031 - bogus taking address of rvalue error.
637 PR c++/91465 - ICE with template codes in check_narrowing.
638 PR c++/93870 - wrong error when converting template non-type arg.
639 PR c++/94068 - ICE with template codes in check_narrowing.
640 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
641 in a template when not ck_identity and we're dealing with a class.
642 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
643 in a template if we need a temporary.
644 * decl.c (compute_array_index_type_loc): Remove
645 instantiate_non_dependent_expr_sfinae call. Call
646 fold_non_dependent_expr instead of maybe_constant_value.
647 (build_explicit_specifier): Don't instantiate or create a sentinel
648 before converting the expression.
649 * except.c (build_noexcept_spec): Likewise.
650 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
651 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
652 build_converted_constant_expr returned.
653 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
654 of maybe_constant_value.
656 2020-03-09 Jakub Jelinek <jakub@redhat.com>
660 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
662 * constexpr.c (cxx_eval_constant_expression): Do not handle
663 RROTATE_EXPR and LROTATE_EXPR.
665 2020-03-09 Marek Polacek <polacek@redhat.com>
667 PR c++/94050 - ABI issue with alignas on armv7hl.
668 * class.c (layout_class_type): Don't replace a class's
669 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
671 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
673 * coroutines.cc (build_actor_fn): Factor out code inserting the
674 default return_void call to...
675 (morph_fn_to_coro): ...here, also hoist local var declarations.
677 2020-03-08 Patrick Palka <ppalka@redhat.com>
680 * call.c (convert_like_real): Check complain before emitting an error
681 about binding a bit-field to a reference.
683 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
684 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
687 2020-03-06 Nathan Sidwell <nathan@acm.org>
690 * mangle.c (find_substitution): Don't call same_type_p on template
691 args that cannot match.
693 2020-03-04 Martin Sebor <msebor@redhat.com>
696 * tree.c (type_initializer_zero_p): Fail for structs initialized
699 2020-03-04 Jason Merrill <jason@redhat.com>
702 * init.c (perform_member_init): Don't do aggregate initialization of
704 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
705 initialization of empty field.
707 2020-03-04 Martin Liska <mliska@suse.cz>
709 * method.c: Wrap array in ctor with braces in order
710 to silent clang warnings.
712 2020-03-03 Jason Merrill <jason@redhat.com>
713 Marek Polacek <polacek@redhat.com>
715 PR c++/90505 - mismatch in template argument deduction.
716 * pt.c (tsubst): Don't reduce the template level of template
717 parameters when tf_partial.
719 2020-03-03 Jakub Jelinek <jakub@redhat.com>
722 * constexpr.c (cxx_eval_constant_expression)
723 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
724 *non_constant_p is true.
726 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
728 * coroutines.cc (captures_temporary): Strip component_ref
731 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
733 * coroutines.cc (finish_co_await_expr): Build co_await_expr
734 with unknown_type_node.
735 (finish_co_yield_expr): Ditto.
736 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
737 with unknown type as dependent.
739 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
741 * coroutines.cc (struct local_var_info): Adjust to remove the
742 reference to the captured var, and just to note that this is a
743 lambda capture proxy.
744 (transform_local_var_uses): Handle lambda captures specially.
745 (struct param_frame_data): Add a visited set.
746 (register_param_uses): Also check for param uses in lambda
748 (struct local_vars_frame_data): Remove captures list.
749 (register_local_var_uses): Handle lambda capture proxies by
750 noting and bypassing them.
751 (morph_fn_to_coro): Update to remove lifetime extension of
752 lambda capture-by-copy vars.
754 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
756 * coroutines.cc (build_co_await): Do not build frame
757 awaitable proxy vars when the co_await expression is
758 a function parameter or local var.
759 (co_await_expander): Do not initialise a frame var with
761 (transform_await_expr): Only substitute the awaitable
762 frame var if it's needed.
763 (register_awaits): Do not make frame copies for param
764 or local vars that are awaitables.
766 2020-02-28 Jason Merrill <jason@redhat.com>
768 Implement P2092R0, Disambiguating Nested-Requirements
769 * parser.c (cp_parser_requirement_parameter_list): Pass
770 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
772 * call.c (build_user_type_conversion_1): Don't look at the second
773 conversion of a non-viable candidate.
775 2020-02-28 Jakub Jelinek <jakub@redhat.com>
777 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
778 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
779 functions in unevaluated contexts.
781 2020-02-27 Nathan Sidwell <nathan@acm.org>
784 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
786 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
787 * typeck.c (comptypes): Assert we don't get any argument packs.
789 * class.c (adjust_clone_args): Correct arg-checking assert.
790 * typeck.c (comptypes): Assert not nulls.
792 2020-02-26 Marek Polacek <polacek@redhat.com>
794 PR c++/93789 - ICE with invalid array bounds.
795 * decl.c (compute_array_index_type_loc): Don't use the folded
796 size when folding cleared TREE_CONSTANT.
798 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
800 * class.c (classtype_has_non_deleted_copy_ctor): New.
801 * coroutines.cc (struct param_info): Keep track of params
802 that are references, and cache the original type and whether
804 (build_actor_fn): Handle param copies always, and adjust the
805 handling for references.
806 (register_param_uses): Only handle uses here.
807 (classtype_has_non_deleted_copy_ctor): New.
808 (morph_fn_to_coro): Adjust param copy handling to match n4849
809 by reordering ahead of the promise CTOR and always making a
810 frame copy, even if the param is unused in the coroutine body.
811 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
813 2020-02-26 Patrick Palka <ppalka@redhat.com>
815 * constraint.cc (finish_constraint_binary_op): Set expr's location range
816 to the range of its operands.
817 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
818 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
819 instead of the corresponding template arguments ARGS and adjust body
821 (diagnose_requires_expr): Likewise.
822 (diagnose_atomic_constraint): Likewise. When printing an atomic
823 constraint expression, print the instantiated parameter mapping
825 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
826 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
827 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
829 2020-02-26 Marek Polacek <polacek@redhat.com>
831 PR c++/93676 - value-init crash in template.
832 * init.c (build_new_1): Don't call build_vec_init in a template.
834 2020-02-26 Marek Polacek <polacek@redhat.com>
836 PR c++/93862 - ICE with static_cast when converting from int[].
837 * call.c (reference_compatible_p): No longer static.
838 * cp-tree.h (reference_compatible_p): Declare.
839 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
840 of reference_related_p.
842 2020-02-26 Marek Polacek <polacek@redhat.com>
844 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
845 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
848 2020-02-24 Martin Sebor <msebor@redhat.com>
851 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
852 in shared C/C++ code in headers.
853 Remove a duplicate hunk of code.
855 2020-02-24 Marek Polacek <polacek@redhat.com>
857 PR c++/93869 - ICE with -Wmismatched-tags.
858 * parser.c (cp_parser_check_class_key): Check class_key earlier.
860 2020-02-24 Marek Polacek <polacek@redhat.com>
862 PR c++/93712 - ICE with ill-formed array list-initialization.
863 * call.c (next_conversion): Return NULL for ck_aggr.
864 (build_aggr_conv): Set u.expr instead of u.next.
865 (build_array_conv): Likewise.
866 (build_complex_conv): Likewise.
867 (conv_get_original_expr): Handle ck_aggr.
869 2020-02-24 Jakub Jelinek <jakub@redhat.com>
871 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
872 * call.c (build_over_call): Don't evaluate immediate functions in
873 unevaluated operands.
875 2020-02-24 Jason Merrill <jason@redhat.com>
877 P0780R2: Resolve lambda init-capture pack grammar.
878 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
881 2020-02-22 Marek Polacek <polacek@redhat.com>
884 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
886 2020-02-21 Martin Sebor <msebor@redhat.com>
888 PR gcov-profile/93753
889 * class.c (check_flexarrays): Tighten up a test for potential members
890 of anonymous structs or unions.
892 2020-02-20 Martin Sebor <msebor@redhat.com>
895 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
897 2020-02-20 Martin Liska <mliska@suse.cz>
900 * config/or1k/or1k.opt: Remove superfluous word.
901 * doc/invoke.texi: Likewise.
903 2020-02-20 Martin Liska <mliska@suse.cz>
906 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
908 2020-02-19 Marek Polacek <polacek@redhat.com>
910 PR c++/93169 - wrong-code with a non-constexpr constructor.
911 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
912 on constant CONSTRUCTORs.
914 2020-02-15 Marek Polacek <polacek@redhat.com>
916 PR c++/93710 - poor diagnostic for array initializer.
917 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
920 2020-02-15 Jason Merrill <jason@redhat.com>
923 * pt.c (any_template_parm_r): Look into lambda body.
926 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
928 2020-02-14 Jakub Jelinek <jakub@redhat.com>
931 * class.c (enum_min_precision): Change prec type from int to int &.
934 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
935 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
936 (fallback_dfloat32_type, fallback_dfloat64_type,
937 fallback_dfloat128_type): Define.
938 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
940 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
941 is disabled for compatibility.
943 2020-02-13 Jason Merrill <jason@redhat.com>
946 * name-lookup.c (matching_fn_p): A function does not match a
951 * tree.c (decl_linkage): Always lk_none for locals.
953 2020-02-12 Jason Merrill <jason@redhat.com>
957 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
958 * pt.c (find_parameter_packs_r): Not here.
960 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
962 * coroutines.cc (build_actor_fn): Implement deallocation function
963 selection per n4849, dcl.fct.def.coroutine bullet 12.
964 (morph_fn_to_coro): Implement allocation function selection per
965 n4849, dcl.fct.def.coroutine bullets 9 and 10.
967 2020-02-12 Marek Polacek <polacek@redhat.com>
969 PR c++/93684 - ICE-on-invalid with broken attribute.
970 * parser.c (cp_parser_std_attribute): Peek a token first before
973 2020-02-11 Jason Merrill <jason@redhat.com>
976 * class.c (add_implicitly_declared_members): Use do_friend.
977 * method.c (implicitly_declare_fn): Fix friend handling.
978 (decl_remember_implicit_trigger_p): New.
979 (synthesize_method): Use it.
980 * decl2.c (mark_used): Use it.
982 2020-02-11 Jason Merrill <jason@redhat.com>
986 * constexpr.c (maybe_constant_value): Correct earlier change.
987 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
988 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
990 2020-02-12 Patrick Palka <ppalka@redhat.com>
994 * type-utils.h (find_type_usage): Refactor to take a tree * and to
995 return a tree *, and update documentation accordingly.
996 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
998 (make_constrained_decltype_auto): No need to explicitly set
999 AUTO_IS_DECLTYPE anymore.
1000 (splice_late_return_type): Use find_type_usage to find and
1001 replace a possibly nested auto node instead of using is_auto.
1002 Check test for is_auto into an assert when deciding whether
1003 to late_return_type.
1004 (type_uses_auto): Adjust the call to find_type_usage.
1005 * parser.c (cp_parser_decltype): No need to explicitly set
1006 AUTO_IS_DECLTYPE anymore.
1008 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
1009 (dump_simple_decl): Handle standard concept definitions as well as
1010 variable concept definitions.
1012 2020-02-10 Jakub Jelinek <jakub@redhat.com>
1015 * error.c (dump_decl_name): Fix up last argument to strncmp.
1017 2020-02-10 Jason Merrill <jason@redhat.com>
1020 * tree.c (array_of_unknown_bound_p): New.
1021 * init.c (perform_member_init): Do nothing for flexible arrays.
1023 2020-02-09 Jakub Jelinek <jakub@redhat.com>
1026 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
1027 ARRAY_TYPE, use the element type. Punt if objtype after that is not
1030 2020-02-08 Jason Merrill <jason@redhat.com>
1033 * expr.c (fold_for_warn): Call maybe_constant_value.
1034 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
1035 (maybe_constant_value): Add uid_sensitive parm.
1036 (get_fundef_copy): Don't copy if it's true.
1037 (cxx_eval_call_expression): Don't instantiate if it's true.
1038 (cxx_eval_outermost_constant_expr): Likewise.
1041 * constexpr.c (maybe_constant_value): Don't unshare if the cached
1042 value is the same as the argument.
1044 * typeck.c (maybe_warn_about_returning_address_of_local): Add
1047 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
1050 2020-02-08 Jakub Jelinek <jakub@redhat.com>
1053 * constexpr.c (find_array_ctor_elt): If last element has no index,
1054 for flag_checking verify all elts have no index. If i is within the
1055 elts, return it directly, if it is right after the last elt, append
1056 if NULL index, otherwise force indexes on all elts.
1057 (cxx_eval_store_expression): Allow cep->index to be NULL.
1059 2020-02-07 Marek Polacek <polacek@redhat.com>
1061 PR c++/92947 - Paren init of aggregates in unevaluated context.
1062 * call.c (build_new_method_call_1): Don't check
1063 cp_unevaluated_operand. Check the return value of digest_init.
1065 2020-02-06 Jason Merrill <jason@redhat.com>
1068 * tree.c (cp_walk_subtrees): Walk into type template arguments.
1069 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
1070 instead of TYPE_ALIAS_P.
1071 * pt.c (push_template_decl_real): Likewise.
1072 (find_parameter_packs_r): Likewise. Remove dead code.
1073 * error.c (find_typenames_r): Remove dead code.
1075 2020-02-06 Jason Merrill <jason@redhat.com>
1078 * parser.c (cp_parser_constraint_primary_expression): Do the main
1079 parse non-tentatively.
1081 2020-02-06 Marek Polacek <polacek@redhat.com>
1083 PR c++/93597 - ICE with lambda in operator function.
1084 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
1086 2020-02-05 Jason Merrill <jason@redhat.com>
1089 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
1090 handling of TREE_CHAIN for empty pack.
1092 2020-02-05 Jakub Jelinek <jakub@redhat.com>
1095 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
1096 prior to passing it to c_build_vec_convert.
1098 2020-02-05 Marek Polacek <polacek@redhat.com>
1100 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
1101 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
1104 2020-02-05 Jason Merrill <jason@redhat.com>
1107 * decl.c (grokdeclarator): Reject field of current class type even
1110 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
1112 * coroutines.cc (maybe_promote_captured_temps): Increase the index
1113 number for temporary variables' name.
1115 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
1117 * coroutines.cc (build_co_await): Call convert_from_reference
1118 to wrap co_await_expr with indirect_ref which avoid
1119 reference/non-reference type confusion.
1121 (co_await_expander): Sink to call_expr if await_resume
1122 is wrapped by indirect_ref.
1124 2020-02-04 Jason Merrill <jason@redhat.com>
1127 * constraint.cc (satisfy_declaration_constraints): Check return
1128 value of push_tinst_level.
1131 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
1132 elements instead of value-initializing them.
1135 * init.c (perform_member_init): Simplify.
1136 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
1138 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
1140 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
1142 * coroutines.cc (find_promise_type): Delete unused forward
1144 (struct coroutine_info): Add a bool for no promise type error.
1145 (coro_promise_type_found_p): Only emit the error for a missing
1146 promise once in each affected coroutine.
1148 2020-02-03 Jason Merrill <jason@redhat.com>
1151 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
1152 defer loading the value of a reference.
1154 2020-02-03 Jason Merrill <jason@redhat.com>
1157 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
1159 [COMPONENT_REF]: A member function reference doesn't use the object
1162 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
1165 * coroutines.cc (struct coroutine_info): Add a bool flag to note
1166 that we emitted an error for a bad function return type.
1167 (get_coroutine_info): Tolerate an unset info table in case of
1169 (find_coro_traits_template_decl): In case of error or if we didn't
1170 find a type template, note we emitted the error and suppress
1172 (find_coro_handle_template_decl): Likewise.
1173 (instantiate_coro_traits): Only check for error_mark_node in the
1174 return from lookup_qualified_name.
1175 (coro_promise_type_found_p): Reorder initialization so that we check
1176 for the traits and their usability before allocation of the info
1177 table. Check for a suitable return type and emit a diagnostic for
1178 here instead of relying on the lookup machinery. This allows the
1179 error to have a better location, and means we can suppress multiple
1181 (coro_function_valid_p): Re-check for a valid promise (and thus the
1182 traits) before proceeding. Tolerate missing info as a fatal error.
1184 2020-02-03 Jason Merrill <jason@redhat.com>
1187 * cp-gimplify.c (predeclare_vla): New.
1188 (cp_genericize_r) [NOP_EXPR]: Call it.
1190 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
1192 * coroutines.cc (transform_await_wrapper): Set actor funcion as
1193 new context of label_decl.
1194 (build_actor_fn): Fill new field of await_xform_data.
1196 2020-02-02 Marek Polacek <polacek@redhat.com>
1198 PR c++/93530 - ICE on invalid alignas in a template.
1199 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
1202 2020-01-31 Jason Merrill <jason@redhat.com>
1205 * semantics.c (process_outer_var_ref): Capture VLAs even in
1206 unevaluated context.
1209 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
1210 non-aggregate elements.
1211 (reshape_init_array): Add first_initializer_p parm.
1212 (reshape_init_r): Change first_initializer_p from bool to tree.
1213 (reshape_init): Pass init to it.
1216 * parser.c (cp_parser_initializer_list): Suppress location wrappers
1219 2020-01-29 Jason Merrill <jason@redhat.com>
1222 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
1223 the expression was dependent before substitution.
1225 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
1227 * coroutines.cc (act_des_fn): New.
1228 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
1229 Access promise via actor function's frame pointer argument.
1230 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
1232 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
1234 * coroutines.cc (co_await_expander): Handle type conversion case.
1236 2020-01-29 Jason Merrill <jason@redhat.com>
1241 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
1242 a trailing return type.
1243 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
1246 2020-01-29 Marek Polacek <polacek@redhat.com>
1248 PR c++/91754 - Fix template arguments comparison with class NTTP.
1249 * pt.c (class_nttp_const_wrapper_p): New.
1250 (template_args_equal): See through class_nttp_const_wrapper_p
1253 2020-01-29 Marek Polacek <polacek@redhat.com>
1255 PR c++/92948 - Fix class NTTP with template arguments.
1256 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
1257 converting a value-dependent expression to a class type.
1258 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
1259 as the result of the tsubst_copy call.
1261 2020-01-29 Jakub Jelinek <jakub@redhat.com>
1264 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
1265 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
1267 2020-01-28 Jason Merrill <jason@redhat.com>
1270 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
1274 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
1277 * call.c (build_user_type_conversion_1): Allow a template conversion
1278 returning an rvalue reference to bind directly to an lvalue.
1281 * decl.c (grokdeclarator): Propagate eh spec from typedef.
1283 2020-01-28 Martin Liska <mliska@suse.cz>
1286 * pt.c (redeclare_class_template): Group couple of
1287 errors and inform messages with auto_diagnostic_group.
1289 2020-01-28 Martin Liska <mliska@suse.cz>
1292 * pt.c (redeclare_class_template): Use inform
1293 for the second location.
1295 2020-01-27 Jason Merrill <jason@redhat.com>
1298 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
1300 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
1303 * coroutines.cc (morph_fn_to_coro): Check the ramp return
1304 value when it is constructed from the 'get return object'.
1306 2020-01-27 Nathan Sidwell <nathan@acm.org>
1309 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
1311 2020-01-26 Jason Merrill <jason@redhat.com>
1314 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
1315 temporarily enable -Wsystem-headers. Change second warning to
1319 * semantics.c (finish_call_expr): Don't call
1320 instantiate_non_dependent_expr before warn_for_memset.
1322 2020-01-25 Marek Polacek <polacek@redhat.com>
1324 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
1325 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
1326 dynamic_cast diagnostic.
1328 2020-01-24 Jason Merrill <jason@redhat.com>
1330 PR c++/93400 - ICE with constrained friend.
1331 * constraint.cc (maybe_substitute_reqs_for): New.
1332 * decl.c (function_requirements_equivalent_p): Call it.
1333 * pt.c (tsubst_friend_function): Only substitute
1334 TEMPLATE_PARMS_CONSTRAINTS.
1335 (tsubst_template_parms): Copy constraints.
1337 2020-01-24 Jason Merrill <jason@redhat.com>
1339 PR c++/93279 - ICE with lambda in member operator.
1340 * name-lookup.c (maybe_save_operator_binding): Don't remember
1341 class-scope bindings.
1343 2020-01-24 Jason Merrill <jason@redhat.com>
1345 PR c++/93377 - ICE with member alias in constraint.
1346 * pt.c (any_template_parm_r): Look at template arguments for all
1347 aliases, not only alias templates.
1349 2020-01-24 Marek Polacek <polacek@redhat.com>
1351 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
1352 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
1354 2020-01-24 Jason Merrill <jason@redhat.com>
1356 PR c++/92852 - ICE with generic lambda and reference var.
1357 * constexpr.c (maybe_constant_value): Likewise.
1359 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
1362 * parser.c (cp_parser_nested_name_specifier_opt): Properly
1363 diagnose concept-ids.
1365 2020-01-23 Jason Merrill <jason@redhat.com>
1367 PR c++/93331 - ICE with __builtin_strchr.
1368 * constexpr.c (cxx_eval_builtin_function_call): Use the original
1369 argument if we didn't manage to extract a STRING_CST.
1371 PR c++/93345 - ICE with defaulted dtor and template.
1373 * decl.c (cxx_maybe_build_cleanup): Don't try to set
1374 throwing_cleanup in a template.
1376 2020-01-22 Marek Polacek <polacek@redhat.com>
1378 PR c++/92907 - noexcept does not consider "const" in member functions.
1379 * g++.dg/cpp0x/noexcept56.C: New test.
1381 2020-01-22 Marek Polacek <polacek@redhat.com>
1383 PR c++/93324 - ICE with -Wall on constexpr if.
1384 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
1386 2020-01-22 Patrick Palka <ppalka@redhat.com>
1388 * constraint.cc (get_mapped_args): Avoid using auto_vec
1389 as a vector element. Release the vectors inside the lists
1391 * parser.c (cp_literal_operator_id): Free the buffer.
1393 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
1395 * coroutines.cc (finish_co_await_expr): Add error check on return
1396 value of build_co_await.
1397 (finish_co_yield_expr,): Ditto.
1399 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
1401 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
1402 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
1403 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
1405 2020-01-21 Jason Merrill <jason@redhat.com>
1407 PR c++/60855 - ICE with sizeof VLA capture.
1408 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
1410 PR c++/90732 - ICE with VLA capture and generic lambda.
1411 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
1413 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
1414 Bin Cheng <bin.cheng@linux.alibaba.com>
1416 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
1417 from complete_type_or_else.
1418 (register_param_uses): Likewise.
1419 (build_co_await): Do not try to use complete_type_or_else for void
1420 types, otherwise for incomplete types, check for NULL return from
1421 complete_type_or_else.
1423 2020-01-21 Jason Merrill <jason@redhat.com>
1425 PR c++/91476 - anon-namespace reference temp clash between TUs.
1426 * decl2.c (copy_linkage): Factor out of get_guard.
1427 * call.c (make_temporary_var_for_ref_to_temp): Use it.
1428 * decl.c (cp_finish_decomp): Use it.
1429 (cp_finish_decl): determine_visibility sooner.
1431 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
1433 * coroutines.cc (finish_co_await_expr): Set return value flag.
1434 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
1436 2020-01-19 Jason Merrill <jason@redhat.com>
1438 PR c++/33799 - destroy return value, take 2.
1439 * cp-tree.h (current_retval_sentinel): New macro.
1440 (struct language_function): Add throwing_cleanup bitfield.
1441 * decl.c (cxx_maybe_build_cleanup): Set it.
1442 * except.c (maybe_set_retval_sentinel)
1443 (maybe_splice_retval_cleanup): New functions.
1444 * parser.c (cp_parser_compound_statement): Call
1445 maybe_splice_retval_cleanup.
1446 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
1448 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
1450 2020-01-18 Jakub Jelinek <jakub@redhat.com>
1452 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
1453 but non-NO_DOLLAR_IN_LABEL case build.
1455 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
1457 * Make-lang.in: Add coroutines.o.
1458 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
1459 (DECL_COROUTINE_P): New.
1460 * lex.c (init_reswords): Enable keywords when the coroutine flag
1462 * operators.def (co_await): New operator.
1463 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
1464 (op_error): Likewise.
1465 (build_new_op_1): Likewise.
1466 (build_new_function_call): Validate coroutine builtin arguments.
1467 * constexpr.c (potential_constant_expression_1): Handle
1468 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
1469 * coroutines.cc: New file.
1470 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
1471 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
1472 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
1473 * cp-tree.h (coro_validate_builtin_call): New.
1474 * decl.c (emit_coro_helper): New.
1475 (finish_function): Handle the case when a function is found to
1476 be a coroutine, perform the outlining and emit the outlined
1477 functions. Set a bit to signal that this is a coroutine component.
1478 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
1479 (cp_parser_unary_expression): Handle co_await.
1480 (cp_parser_assignment_expression): Handle co_yield.
1481 (cp_parser_statement): Handle RID_CO_RETURN.
1482 (cp_parser_jump_statement): Handle co_return.
1483 (cp_parser_operator): Handle co_await operator.
1484 (cp_parser_yield_expression): New.
1485 (cp_parser_required_error): Handle RT_CO_YIELD.
1486 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
1487 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
1489 * tree.c (cp_walk_subtrees): Likewise.
1491 2020-01-17 Jason Merrill <jason@redhat.com>
1493 PR c++/92531 - ICE with noexcept(lambda).
1494 * pt.c (uses_template_parms): Don't try to enumerate all the
1497 2020-01-17 Jakub Jelinek <jakub@redhat.com>
1500 * parser.c (cp_parser_template_name): Look up deprecated attribute
1501 in DECL_TEMPLATE_RESULT or its type's attributes.
1503 2020-01-16 Jason Merrill <jason@redhat.com>
1505 PR c++/93286 - ICE with __is_constructible and variadic template.
1506 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
1507 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
1509 PR c++/93280 - ICE with aggregate assignment and DMI.
1510 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
1511 * typeck2.c (digest_nsdmi_init): Not here.
1513 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
1516 * cp-tree.h (is_constrained_auto): New.
1517 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
1518 handle concept-check expressions; take a cp_decl_specifier_seq*
1520 (cp_parser_condition): Update call.
1521 (cp_parser_simple_declaration): Likewise.
1522 (cp_parser_placeholder_type_specifier): Correctly handle
1523 concept-check expressions.
1525 2020-01-15 Jason Merrill <jason@redhat.com>
1528 PR c++/33799 - destroy return value if local cleanup throws.
1529 * cp-tree.h (current_retval_sentinel): New macro.
1530 * decl.c (start_preparsed_function): Set up cleanup for retval.
1531 * typeck.c (check_return_expr): Set current_retval_sentinel.
1533 PR c++/93257 - consteval void function.
1534 * constexpr.c (verify_constant): Allow void_node.
1536 PR c++/92871 - bad code with xvalue and GNU ?: extension.
1537 * call.c (prevent_lifetime_extension): New.
1538 (build_conditional_expr_1): Use it.
1540 2020-01-14 Nathan Sidwell <nathan@acm.org>
1543 * pt.c (retrieve_specialization): Use get_template_info, not open
1547 * pt.c (retrieve_specialization): Get the TI from the decl or the
1548 classtype as appropriate.
1550 2020-01-14 David Malcolm <dmalcolm@redhat.com>
1552 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
1553 New static constant.
1554 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
1555 (struct named_label_hash::empty_zero_p): Likewise.
1556 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
1558 2020-01-14 Jason Merrill <jason@redhat.com>
1560 PR c++/92590 - wrong handling of inherited default ctor.
1561 * class.c (add_method): A constrained inherited ctor doesn't hide an
1562 implicit derived ctor.
1564 PR c++/92552 - ICE with inherited constrained default ctor.
1565 * pt.c (instantiate_class_template_1): Copy
1566 TYPE_HAS_USER_CONSTRUCTOR.
1567 PR c++/91930 - ICE with constrained inherited default ctor.
1568 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
1569 for inherited constructor.
1570 PR c++/92594 - ICE with inherited trivial default ctor.
1571 * method.c (trivial_fn_p): Treat an inherited default constructor
1572 like a normal default constructor.
1574 PR c++/92594 - ICE with inherited trivial default ctor.
1575 * method.c (trivial_fn_p): Treat an inherited default constructor
1576 like a normal default constructor.
1578 PR c++/92009 - ICE with punning of typeid.
1579 * rtti.c (get_tinfo_desc): Call xref_basetypes.
1580 * constexpr.c (cxx_fold_indirect_ref): Don't strip
1583 2020-01-13 Jason Merrill <jason@redhat.com>
1585 PR c++/92746 - ICE with noexcept of function concept check.
1586 * except.c (check_noexcept_r): Handle concept-check.
1588 PR c++/92582 - ICE with member template as requirement.
1589 * pt.c (struct find_template_parameter_info): Add ctx_parms.
1590 (any_template_parm_r): Handle TEMPLATE_DECL.
1591 (find_template_parameters): Take parms instead of their depth.
1592 * constraint.cc (build_parameter_mapping): Pass them.
1594 PR c++/33799 - destroy return value if local cleanup throws.
1595 * cp-tree.h (current_retval_sentinel): New macro.
1596 * decl.c (start_preparsed_function): Set up cleanup for retval.
1597 * typeck.c (check_return_expr): Set current_retval_sentinel.
1599 PR c++/93238 - short right-shift with enum.
1600 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
1602 2020-01-10 Jason Merrill <jason@redhat.com>
1604 * typeck.c (cp_build_binary_op): Restore short_shift code.
1606 PR c++/93143 - incorrect tree sharing with constexpr.
1607 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
1608 CONSTRUCTORs are already unshared.
1610 PR c++/93173 - incorrect tree sharing.
1612 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
1613 copy_if_shared after cp_genericize_tree.
1614 * typeck2.c (split_nonconstant_init): Don't unshare here.
1616 2020-01-08 Jason Merrill <jason@redhat.com>
1618 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
1619 TARGET_EXPR_DIRECT_INIT_P.
1620 * constexpr.c (cxx_eval_constant_expression): Likewise.
1622 2020-01-08 Jason Merrill <jason@redhat.com>
1624 PR c++/91369 - constexpr destructor and member initializer.
1625 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
1626 when not preevaluating.
1628 2020-01-08 Jason Merrill <jason@redhat.com>
1630 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
1633 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
1635 * init.c (build_new): Add location_t parameter and use it throughout.
1636 (build_raw_new_expr): Likewise.
1637 * parser.c (cp_parser_new_expression): Pass the combined_loc.
1638 * pt.c (tsubst_copy_and_build): Adjust call.
1639 * cp-tree.h: Update declarations.
1641 2020-01-07 Jason Merrill <jason@redhat.com>
1643 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
1644 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
1645 explicit class visibility for a template.
1647 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
1649 * mangle.c (mangle_type_attribute_p): New function, split out from...
1650 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
1651 that contain a space.
1653 2020-01-07 Jakub Jelinek <jakub@redhat.com>
1656 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
1657 member, initialize it to zero in ctor.
1658 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
1659 a heap object. Don't cache calls to functions which allocate some
1660 heap objects and don't deallocate them or deallocate some heap
1661 objects they didn't allocate.
1663 2020-01-06 Jason Merrill <jason@redhat.com>
1665 PR c++/92552 - ICE with inherited constrained default ctor.
1666 * pt.c (instantiate_class_template_1): Copy
1667 TYPE_HAS_USER_CONSTRUCTOR.
1668 * class.c (one_inherited_ctor): Don't set it here.
1670 2020-01-06 Andrew Sutton <asutton@lock3software.com>
1672 PR c++/92739 - parsing requires clause with attributes.
1673 * parser.c (cp_parser_constraint_requires_parens): Exclude
1674 attributes as postfix expressions.
1676 2020-01-05 Jakub Jelinek <jakub@redhat.com>
1679 * parser.c (cp_parser_check_class_key): Disable access checks for the
1681 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
1682 !warn_redundant_tags.
1684 2010-01-05 Jakub Jelinek <jakub@redhat.com>
1687 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
1688 TARGET_EXPR if it has been gimplified already.
1690 2020-01-03 Jason Merrill <jason@redhat.com>
1692 PR c++/93033 - incorrect tree node sharing with array init.
1693 * typeck2.c (split_nonconstant_init): Unshare non-decl.
1694 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
1696 2020-01-02 Jason Merrill <jason@redhat.com>
1698 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
1701 2020-01-02 Jakub Jelinek <jakub@redhat.com>
1704 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
1705 has not been found, rather than error_mark_node.
1707 2020-01-01 Jakub Jelinek <jakub@redhat.com>
1709 Update copyright years.
1711 Copyright (C) 2020 Free Software Foundation, Inc.
1713 Copying and distribution of this file, with or without modification,
1714 are permitted in any medium without royalty provided the copyright
1715 notice and this notice are preserved.