1 2020-04-16 Patrick Palka <ppalka@redhat.com>
4 * cvt.c (ocp_convert): If the result of scalar_constant_value is
5 erroneous, ignore it and use the original expression.
7 2020-04-16 Jakub Jelinek <jakub@redhat.com>
10 * parser.c (cp_parser_simple_declaration): Fix up a pasto in
13 2020-04-15 Jakub Jelinek <jakub@redhat.com>
16 * parser.c (cp_parser_pragma) <case PRAGMA_OMP_REQUIRES>: Reject
17 requires directive when not at file or namespace scope.
19 2020-04-14 Iain Sandoe <iain@sandoe.co.uk>
22 * coroutines.cc (build_actor_fn): Check that the target can
23 support the resume tailcall before mandating it.
25 2020-04-14 Patrick Palka <ppalka@redhat.com>
28 * cxx-pretty-print.c (cxx_pretty_printer:simple_type_specifier)
29 <case DECLTYPE_TYPE>: Handle DECLTYPE_TYPE here instead of ...
30 (pp_cxx_type_specifier_seq) <case DECLTYPE_TYPE>: ... here.
31 (cxx_pretty_printer::direct_abstract_declarator) <case DECLTYPE_TYPE>:
35 * constexpr.c (replace_result_decl_data): New struct.
36 (replace_result_decl_data_r): New function.
37 (replace_result_decl): New function.
38 (cxx_eval_call_expression): Use it.
39 * tree.c (build_aggr_init_expr): Set the location of the AGGR_INIT_EXPR
40 to that of its initializer.
42 2020-04-13 Marek Polacek <polacek@redhat.com>
45 * name-lookup.c (check_local_shadow): Add an inform call.
47 2020-04-13 Patrick Palka <ppalka@redhat.com>
50 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
51 dump_function_decl when printing a function template instantiation as a
55 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
57 (cxx_eval_bare_aggregate): Use get_or_insert_ctor_field instead of
58 assuming the the next index belongs at the end of the new CONSTRUCTOR.
59 (cxx_eval_store_expression): Revert PR c++/78572 fix.
61 2020-04-13 Nathan Sidwell <nathan@acm.org>
63 PR c++/94426 lambdas with internal linkage are different to no-linkage
64 * decl2.c (determine_visibility): A lambda's visibility is
65 affected by its extra scope.
66 * pt.c (instantiate_decl): Determine var's visibility before
67 instantiating its initializer.
68 * tree.c (no_linkage_check): Revert code looking at visibility of
71 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
74 * coroutines.cc (co_await_expander): Remove.
75 (expand_one_await_expression): New.
76 (process_one_statement): New.
77 (await_statement_expander): New.
78 (build_actor_fn): Revise to use per-statement expander.
79 (struct susp_frame_data): Reorder and comment.
80 (register_awaits): Factor code.
81 (replace_statement_captures): New, factored from...
82 (maybe_promote_captured_temps):.. here.
83 (await_statement_walker): Revise to process per statement.
84 (morph_fn_to_coro): Use revised susp_frame_data layout.
86 2020-04-10 Marek Polacek <polacek@redhat.com>
89 * method.c (constructible_expr): In C++20, try using parenthesized
90 initialization of aggregates to determine the result of
93 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
95 * coroutines.cc (co_await_expander): Simplify.
97 2020-04-09 Jason Merrill <jason@redhat.com>
100 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
101 ctx->object and ctx->global->values first.
103 2020-04-09 Marek Polacek <polacek@redhat.com>
106 * call.c (initialize_reference): If the reference binding failed, maybe
107 try initializing from { }.
108 * decl.c (grok_reference_init): For T& t(e), set
109 LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet.
111 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
112 Jun Ma <JunMa@linux.alibaba.com>
114 * coroutines.cc (maybe_promote_captured_temps): Add a cleanup
115 expression, if needed, to any call from which we promoted
116 temporaries captured by reference.
118 2020-04-08 Marek Polacek <polacek@redhat.com>
120 PR c++/94507 - ICE-on-invalid with lambda template.
121 * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
122 tsubst_function_decl returns error_mark_node.
124 2020-04-08 Martin Liska <mliska@suse.cz>
127 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
128 (cxx_init_decl_processing): Mark replaceable all implicitly defined
131 2020-04-08 Patrick Palka <ppalka@redhat.com>
133 Core issues 1001 and 1322
135 * pt.c (rebuild_function_or_method_type): Split function out from ...
136 (tsubst_function_type): ... here.
137 (maybe_rebuild_function_decl_type): New function.
138 (tsubst_function_decl): Use it.
140 2020-04-08 Jakub Jelinek <jakub@redhat.com>
143 * decl.c (begin_destructor_body): For CLASSTYPE_VBASECLASSES class
144 dtors, if CLASSTYPE_PRIMARY_BINFO is non-NULL, but not BINFO_VIRTUAL_P,
145 look at CLASSTYPE_PRIMARY_BINFO of its BINFO_TYPE if it is not
146 BINFO_VIRTUAL_P, and so on.
148 2020-04-08 Marek Polacek <polacek@redhat.com>
150 PR c++/94478 - ICE with defaulted comparison operator
151 * method.c (early_check_defaulted_comparison): Give an error when the
154 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
157 * paser.c (cp_parser_oacc_declare): Add check that variables
158 are declared in the same scope as the directive.
160 2020-04-07 Jason Merrill <jason@redhat.com>
163 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
166 * parser.c (cp_parser_placeholder_type_specifier): Use
169 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
171 * coroutines.cc (maybe_promote_captured_temps): Ensure that
172 reference capture placeholder vars are properly declared.
174 2020-04-07 Patrick Palka <ppalka@redhat.com>
177 * tree.c (replace_placeholders): Look through all handled components,
178 not just COMPONENT_REFs.
179 * typeck2.c (process_init_constructor_array): Propagate
180 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
181 the array initializer.
183 2020-04-07 Jakub Jelinek <jakub@redhat.com>
186 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
187 if cp_parser_omp_master succeeded.
189 2020-04-06 Jason Merrill <jason@redhat.com>
192 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
194 2020-04-04 Marek Polacek <polacek@redhat.com>
195 Jason Merrill <jason@redhat.com>
197 PR c++/94155 - crash in gimplifier with paren init of aggregates.
198 * init.c (build_vec_init): Fill in indexes.
200 2020-04-04 Jason Merrill <jason@redhat.com>
203 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
205 2020-04-04 Patrick Palka <ppalka@redhat.com>
209 * constexpr.c (struct constexpr_ctx): New field 'parent'.
210 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
211 flag from the original constructor to the reduced constructor.
212 (lookup_placeholder): Prefer to return the outermost matching object
213 by recursively calling lookup_placeholder on the 'parent' context,
214 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
215 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
216 context via 'new_ctx.parent' when being expanded without an explicit
217 target. Don't call replace_placeholders.
218 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
222 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
223 support for VECTOR_TYPEs, and optimizations for the common case)
225 (cxx_eval_store_expression): ... here. Rename local variable
226 'changed_active_union_member_p' to 'activated_union_member_p'. Record
227 the sequence of indexes into 'indexes' that yields the subobject we're
228 assigning to. Record the integer offsets of the constructor indexes
229 we're assigning through into 'index_pos_hints'. After evaluating the
230 initializer of the store expression, recompute 'valp' using 'indexes'
231 and using 'index_pos_hints' as hints.
232 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
233 to recompute the constructor_elt pointer we're assigning through after
234 evaluating each initializer.
236 2020-04-04 Jason Merrill <jason@redhat.com>
239 * constraint.cc (tsubst_valid_expression_requirement): Call
242 2020-04-04 Jason Merrill <jason@redhat.com>
245 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
246 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
249 2020-04-04 Jakub Jelinek <jakub@redhat.com>
252 * parser.c (cp_parser_omp_for_loop): Use
253 protected_set_expr_location_if_unset.
254 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
257 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
258 omp_parallel_combined_clauses.
260 2020-04-03 Jason Merrill <jason@redhat.com>
263 * pt.c (complex_pack_expansion_r): New.
264 (complex_alias_template_p): Use it.
266 2020-03-31 Jason Merrill <jason@redhat.com>
269 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
270 replace_placeholders.
271 * typeck2.c (store_init_value): Fix arguments to
272 fold_non_dependent_expr.
274 2020-03-31 Jason Merrill <jason@redhat.com>
276 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
279 2020-03-30 Jason Merrill <jason@redhat.com>
282 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
283 (called_fns_equal): Check DECL_CONTEXT.
285 2020-03-30 Jakub Jelinek <jakub@redhat.com>
288 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
289 STATEMENT_CODE_P code.
291 2020-03-28 Patrick Palka <ppalka@redhat.com>
294 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
295 "requires {" when "requires requires {" was probably intended.
298 * constraint.cc (tsubst_compound_requirement): Always suppress errors
299 from type_deducible_p and expression_convertible_p, as they're not
301 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
302 that we diagnose INTEGER_CST expressions of non-bool type via the
304 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
305 * parser.c (cp_parser_requires_expression): Always parse the requirement
306 body as if we're processing a template, by temporarily incrementing
307 processing_template_decl. Afterwards, if we're not actually in a
308 template context, perform semantic processing to diagnose any invalid
309 types and expressions.
310 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
311 * semantics.c (finish_static_assert): Explain an assertion failure
312 when the condition is a REQUIRES_EXPR like we do when it is a concept
315 * constraint.cc (diagnose_compound_requirement): When diagnosing a
316 compound requirement, maybe replay the satisfaction failure, subject to
317 the current diagnosis depth.
319 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
320 as well as its range, because build_x_binary_op doesn't always do so.
321 (current_constraint_diagnosis_depth): New.
322 (concepts_diagnostics_max_depth_exceeded_p): New.
323 (collect_operands_of_disjunction): New.
324 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
325 replay each branch of the disjunction, subject to the current diagnosis
327 (diagnose_valid_expression): When diagnosing a satisfaction failure,
328 maybe replay the substitution error, subject to the current diagnosis
330 (diagnose_valid_type): Likewise.
331 (diagnose_nested_requiremnet): Likewise.
332 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
333 current_constraint_diagnosis_depth when diagnosing.
334 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
335 current_constraint_diagnosis_depth when diagnosing.
336 (diagnosing_failed_constraint::replay_errors_p): New static member
338 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
339 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
340 the limit was exceeded.
341 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
343 2020-03-27 Nathan Sidwell <nathan@acm.org>
346 * name-lookup.c (do_pushdecl): Look through cleanp levels.
348 2020-03-27 Martin Sebor <msebor@redhat.com>
353 * cp-tree.h (most_specialized_partial_spec): Declare.
354 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
356 (specialization_of): New function.
357 (cp_parser_check_class_key): Move code...
358 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
359 -Wredundant-tags on first-time declarations in other declarators.
360 Correct handling of template specializations.
361 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
362 when -Wredundant-tags is enabled. Use primary template or partial
363 specialization as the guide for uses of implicit instantiations.
364 * pt.c (most_specialized_partial_spec): Declare extern.
366 2020-03-27 Nathan Sidwell <nathan@acm.org>
369 * name-lookup.c (push_namespace): Triage ambiguous lookups that
372 2020-03-27 Jakub Jelinek <jakub@redhat.com>
375 * call.c (set_flags_from_callee): Don't update
376 cp_function_chain->can_throw or current_function_returns_abnormally
377 if cp_unevaluated_operand.
380 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
381 operand and creating a new COMPOUND_EXPR if anything changed.
383 2020-03-26 Marek Polacek <polacek@redhat.com>
385 PR c++/94336 - template keyword accepted before destructor names.
386 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
387 is followed by a destructor name.
389 2020-03-27 Patrick Palka <ppalka@redhat.com>
391 * decl.c (compute_array_index_type_loc): Remove redundant
392 type_dependent_expression_p check that is subsumed by
393 value_dependent_expression_p.
394 * decl2.c (is_late_template_attribute): Likewise.
395 * pt.c (uses_template_parms): Likewise.
396 (dependent_template_arg_p): Likewise.
398 2020-03-26 Marek Polacek <polacek@redhat.com>
401 PR c++/94057 - template keyword in a typename-specifier.
402 * parser.c (check_template_keyword_in_nested_name_spec): New.
403 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
404 'template'. Call check_template_keyword_in_nested_name_spec.
405 (cp_parser_simple_type_specifier): Assume that a <
406 following a qualified-id in a typename-specifier begins
407 a template argument list.
409 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
411 * coroutines.cc (coro_init_identifiers): Initialize an identifier
412 for the cororoutine handle 'address' method name.
413 (struct coro_aw_data): Add fields to cover the continuations.
414 (co_await_expander): Determine the kind of await_suspend in use.
415 If we have the case that returns a continuation handle, then save
416 this and make the target for 'scope exit without cleanup' be the
417 continuation resume label.
418 (expand_co_awaits): Remove.
419 (struct suspend_point_info): Remove fields that kept the returned
420 await_suspend handle type.
421 (transform_await_expr): Remove code tracking continuation handles.
422 (build_actor_fn): Add the continuation handle as an actor-function
423 scope var. Build the symmetric transfer continuation point. Call
424 the tree walk for co_await expansion directly, rather than via a
425 trivial shim function.
426 (register_await_info): Remove fields tracking continuation handles.
427 (get_await_suspend_return_type): Remove.
428 (register_awaits): Remove code tracking continuation handles.
429 (morph_fn_to_coro): Remove code tracking continuation handles.
431 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
433 * coroutines.cc (co_await_expander): If we are expanding the
434 initial await expression, set a boolean flag to show that we
435 have now reached the initial await_resume() method call.
436 (expand_co_awaits): Handle the 'initial await resume called' flag.
437 (build_actor_fn): Insert the initial await expression into the
438 start of the user-authored function-body. Handle the 'initial await
440 (morph_fn_to_coro): Initialise the 'initial await resume called'
441 flag. Modify the unhandled exception catch clause to recognise
442 exceptions that occur before the initial await_resume() and re-
445 2020-03-26 Jakub Jelinek <jakub@redhat.com>
448 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
449 true for all TEMPLATE_DECLs.
452 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
454 2020-03-25 Patrick Palka <ppalka@redhat.com>
457 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
458 current condition chain when the if-statement has a non-empty
461 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
464 * coroutines.cc (captures_temporary): Fix a missing dereference.
466 2020-03-24 Marek Polacek <polacek@redhat.com>
468 PR c++/94190 - wrong no post-decrement operator error in template.
469 * call.c (convert_like_real): Use convert_from_reference on the result.
471 2020-03-24 Jason Merrill <jason@redhat.com>
474 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
476 (tsubst_nested_requirement): Likewise.
477 (get_constraint_error_location): Allow missing context.
478 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
479 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
481 2020-03-24 Jason Merrill <jason@redhat.com>
483 * pt.c (any_template_parm_r): Look into the type of a non-type
486 2020-03-24 Jason Merrill <jason@redhat.com>
488 * cp-tree.h (cp_expr): When constructing from an expr and a
489 location, call protected_set_expr_location.
491 2020-03-23 Patrick Palka <ppalka@redhat.com>
494 * except.c (maybe_noexcept_warning): Add TODO.
495 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
497 2020-03-23 nathans <nathan@acm.org>
500 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
503 2020-03-21 Patrick Palka <ppalka@redhat.com>
506 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
507 handle unions without an initializer.
508 (cxx_eval_component_reference): Emit a different diagnostic when the
509 constructor element corresponding to a union member is NULL.
510 (cxx_eval_bare_aggregate): When constructing a union, always set the
511 active union member before evaluating the initializer. Relax assertion
512 that verifies the index of the constructor element we're initializing
514 (cxx_eval_store_expression): Diagnose changing the active union member
515 while the union is in the process of being initialized. After setting
516 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
518 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
519 CONSTRUCTOR returned by lookup_placeholder.
521 2020-03-20 Patrick Palka <ppalka@redhat.com>
523 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
524 the "[with ]" bits to here from ...
525 (pp_cxx_atomic_constraint): ... here.
526 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
527 * error.c (rebuild_concept_check): Delete.
528 (print_concept_check_info): Print the dependent form of the constraint and the
529 preferably substituted parameter mapping alongside it.
531 2020-03-19 Jason Merrill <jason@redhat.com>
534 * cp-gimplify.c (simple_empty_class_p): Look through
535 SIMPLE_TARGET_EXPR_P.
536 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
537 [RETURN_EXPR]: Avoid producing 'return *retval;'.
538 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
539 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
542 2020-03-19 Jakub Jelinek <jakub@redhat.com>
545 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
546 on outer_automatic_var_p decls.
547 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
550 2020-03-18 Nathan Sidwell <nathan@acm.org>
552 PR c++/94147 - mangling of lambdas assigned to globals
553 * parser.c (cp_parser_init_declarator): Namespace-scope variables
554 provide a lambda scope.
555 * tree.c (no_linkage_check): Lambdas with a variable for extra
556 scope have a linkage from the variable.
558 2020-03-18 Jakub Jelinek <jakub@redhat.com>
560 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
561 strictly_subsumes): Fix up duplicated word issue in a comment.
562 * coroutines.cc (build_init_or_final_await, captures_temporary):
564 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
565 * pt.c (append_type_to_template_for_access_check): Likewise.
568 * decl.c (grokfndecl): Restore old diagnostics about deduction
569 guide declared in different scope if in_namespace is NULL_TREE.
571 2020-03-17 Jakub Jelinek <jakub@redhat.com>
574 * parser.c (cp_parser_enum_specifier): Use temp_override for
575 parser->colon_corrects_to_scope_p, replace goto out with return.
576 If scoped enum or enum with underlying type is not followed by
577 { or ;, call cp_parser_commit_to_tentative_parse before calling
578 cp_parser_error and make sure to return error_mark_node instead of
579 NULL_TREE. Formatting fixes.
581 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
584 * method.c (assignable_expr): Use cp_unevaluated.
585 (is_xible_helper): Push a non-deferred access check for
586 the stub objects created by assignable_expr and constructible_expr.
588 2020-03-17 Jakub Jelinek <jakub@redhat.com>
590 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
591 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
593 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
594 cp_parser_placeholder_type_specifier,
595 cp_parser_constraint_requires_parens): Likewise.
596 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
598 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
600 * coroutines.cc (co_await_expander): Fix indentation.
602 2020-03-14 Jason Merrill <jason@redhat.com>
605 * pt.c (process_partial_specialization): Error rather than crash on
606 extra pack expansion.
608 2020-03-14 Jason Merrill <jason@redhat.com>
611 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
612 DECL_ORIGINAL_TYPE of a typedef.
614 2020-03-14 Jason Merrill <jason@redhat.com>
617 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
618 substituting DECL_ARGUMENTS.
620 2020-03-14 Jakub Jelinek <jakub@redhat.com>
622 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
623 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
626 2020-03-13 Patrick Palka <ppalka@redhat.com>
629 * call.c (build_over_call): Use a warning_sentinel to disable
630 warn_deprecated_decl before calling build_addr_func.
632 2020-03-12 Jakub Jelinek <jakub@redhat.com>
635 * decl.c (reshape_init_array_1): Don't unshare constructor if there
636 aren't any trailing zero elts, otherwise only unshare the first
639 2020-03-11 Jason Merrill <jason@redhat.com>
642 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
645 2020-03-11 Marek Polacek <polacek@redhat.com>
646 Jason Merrill <jason@redhat.com>
648 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
649 * constexpr.c (cref_has_const_field): New function.
650 (modifying_const_object_p): Consider a COMPONENT_REF
651 const only if any of its fields are const.
652 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
653 as readonly after its initialization has been done.
655 2020-03-10 Marek Polacek <polacek@redhat.com>
657 PR c++/94124 - wrong conversion error with non-viable overload.
658 * decl.c (reshape_init_array_1): Unshare a constructor if we
659 stripped trailing zero-initializers.
661 2020-03-10 Jason Merrill <jason@redhat.com>
664 * pt.c (maybe_instantiate_noexcept): Always update clones.
666 2020-03-10 Jason Merrill <jason@redhat.com>
669 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
671 2020-03-10 Jason Merrill <jason@redhat.com>
677 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
678 66139: Don't split_nonconstant_init. Remove pre_p parameter.
680 2020-03-09 Marek Polacek <polacek@redhat.com>
682 PR c++/92031 - bogus taking address of rvalue error.
683 PR c++/91465 - ICE with template codes in check_narrowing.
684 PR c++/93870 - wrong error when converting template non-type arg.
685 PR c++/94068 - ICE with template codes in check_narrowing.
686 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
687 in a template when not ck_identity and we're dealing with a class.
688 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
689 in a template if we need a temporary.
690 * decl.c (compute_array_index_type_loc): Remove
691 instantiate_non_dependent_expr_sfinae call. Call
692 fold_non_dependent_expr instead of maybe_constant_value.
693 (build_explicit_specifier): Don't instantiate or create a sentinel
694 before converting the expression.
695 * except.c (build_noexcept_spec): Likewise.
696 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
697 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
698 build_converted_constant_expr returned.
699 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
700 of maybe_constant_value.
702 2020-03-09 Jakub Jelinek <jakub@redhat.com>
706 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
708 * constexpr.c (cxx_eval_constant_expression): Do not handle
709 RROTATE_EXPR and LROTATE_EXPR.
711 2020-03-09 Marek Polacek <polacek@redhat.com>
713 PR c++/94050 - ABI issue with alignas on armv7hl.
714 * class.c (layout_class_type): Don't replace a class's
715 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
717 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
719 * coroutines.cc (build_actor_fn): Factor out code inserting the
720 default return_void call to...
721 (morph_fn_to_coro): ...here, also hoist local var declarations.
723 2020-03-08 Patrick Palka <ppalka@redhat.com>
726 * call.c (convert_like_real): Check complain before emitting an error
727 about binding a bit-field to a reference.
729 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
730 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
733 2020-03-06 Nathan Sidwell <nathan@acm.org>
736 * mangle.c (find_substitution): Don't call same_type_p on template
737 args that cannot match.
739 2020-03-04 Martin Sebor <msebor@redhat.com>
742 * tree.c (type_initializer_zero_p): Fail for structs initialized
745 2020-03-04 Jason Merrill <jason@redhat.com>
748 * init.c (perform_member_init): Don't do aggregate initialization of
750 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
751 initialization of empty field.
753 2020-03-04 Martin Liska <mliska@suse.cz>
755 * method.c: Wrap array in ctor with braces in order
756 to silent clang warnings.
758 2020-03-03 Jason Merrill <jason@redhat.com>
759 Marek Polacek <polacek@redhat.com>
761 PR c++/90505 - mismatch in template argument deduction.
762 * pt.c (tsubst): Don't reduce the template level of template
763 parameters when tf_partial.
765 2020-03-03 Jakub Jelinek <jakub@redhat.com>
768 * constexpr.c (cxx_eval_constant_expression)
769 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
770 *non_constant_p is true.
772 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
774 * coroutines.cc (captures_temporary): Strip component_ref
777 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
779 * coroutines.cc (finish_co_await_expr): Build co_await_expr
780 with unknown_type_node.
781 (finish_co_yield_expr): Ditto.
782 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
783 with unknown type as dependent.
785 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
787 * coroutines.cc (struct local_var_info): Adjust to remove the
788 reference to the captured var, and just to note that this is a
789 lambda capture proxy.
790 (transform_local_var_uses): Handle lambda captures specially.
791 (struct param_frame_data): Add a visited set.
792 (register_param_uses): Also check for param uses in lambda
794 (struct local_vars_frame_data): Remove captures list.
795 (register_local_var_uses): Handle lambda capture proxies by
796 noting and bypassing them.
797 (morph_fn_to_coro): Update to remove lifetime extension of
798 lambda capture-by-copy vars.
800 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
802 * coroutines.cc (build_co_await): Do not build frame
803 awaitable proxy vars when the co_await expression is
804 a function parameter or local var.
805 (co_await_expander): Do not initialise a frame var with
807 (transform_await_expr): Only substitute the awaitable
808 frame var if it's needed.
809 (register_awaits): Do not make frame copies for param
810 or local vars that are awaitables.
812 2020-02-28 Jason Merrill <jason@redhat.com>
814 Implement P2092R0, Disambiguating Nested-Requirements
815 * parser.c (cp_parser_requirement_parameter_list): Pass
816 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
818 * call.c (build_user_type_conversion_1): Don't look at the second
819 conversion of a non-viable candidate.
821 2020-02-28 Jakub Jelinek <jakub@redhat.com>
823 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
824 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
825 functions in unevaluated contexts.
827 2020-02-27 Nathan Sidwell <nathan@acm.org>
830 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
832 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
833 * typeck.c (comptypes): Assert we don't get any argument packs.
835 * class.c (adjust_clone_args): Correct arg-checking assert.
836 * typeck.c (comptypes): Assert not nulls.
838 2020-02-26 Marek Polacek <polacek@redhat.com>
840 PR c++/93789 - ICE with invalid array bounds.
841 * decl.c (compute_array_index_type_loc): Don't use the folded
842 size when folding cleared TREE_CONSTANT.
844 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
846 * class.c (classtype_has_non_deleted_copy_ctor): New.
847 * coroutines.cc (struct param_info): Keep track of params
848 that are references, and cache the original type and whether
850 (build_actor_fn): Handle param copies always, and adjust the
851 handling for references.
852 (register_param_uses): Only handle uses here.
853 (classtype_has_non_deleted_copy_ctor): New.
854 (morph_fn_to_coro): Adjust param copy handling to match n4849
855 by reordering ahead of the promise CTOR and always making a
856 frame copy, even if the param is unused in the coroutine body.
857 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
859 2020-02-26 Patrick Palka <ppalka@redhat.com>
861 * constraint.cc (finish_constraint_binary_op): Set expr's location range
862 to the range of its operands.
863 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
864 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
865 instead of the corresponding template arguments ARGS and adjust body
867 (diagnose_requires_expr): Likewise.
868 (diagnose_atomic_constraint): Likewise. When printing an atomic
869 constraint expression, print the instantiated parameter mapping
871 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
872 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
873 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
875 2020-02-26 Marek Polacek <polacek@redhat.com>
877 PR c++/93676 - value-init crash in template.
878 * init.c (build_new_1): Don't call build_vec_init in a template.
880 2020-02-26 Marek Polacek <polacek@redhat.com>
882 PR c++/93862 - ICE with static_cast when converting from int[].
883 * call.c (reference_compatible_p): No longer static.
884 * cp-tree.h (reference_compatible_p): Declare.
885 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
886 of reference_related_p.
888 2020-02-26 Marek Polacek <polacek@redhat.com>
890 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
891 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
894 2020-02-24 Martin Sebor <msebor@redhat.com>
897 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
898 in shared C/C++ code in headers.
899 Remove a duplicate hunk of code.
901 2020-02-24 Marek Polacek <polacek@redhat.com>
903 PR c++/93869 - ICE with -Wmismatched-tags.
904 * parser.c (cp_parser_check_class_key): Check class_key earlier.
906 2020-02-24 Marek Polacek <polacek@redhat.com>
908 PR c++/93712 - ICE with ill-formed array list-initialization.
909 * call.c (next_conversion): Return NULL for ck_aggr.
910 (build_aggr_conv): Set u.expr instead of u.next.
911 (build_array_conv): Likewise.
912 (build_complex_conv): Likewise.
913 (conv_get_original_expr): Handle ck_aggr.
915 2020-02-24 Jakub Jelinek <jakub@redhat.com>
917 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
918 * call.c (build_over_call): Don't evaluate immediate functions in
919 unevaluated operands.
921 2020-02-24 Jason Merrill <jason@redhat.com>
923 P0780R2: Resolve lambda init-capture pack grammar.
924 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
927 2020-02-22 Marek Polacek <polacek@redhat.com>
930 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
932 2020-02-21 Martin Sebor <msebor@redhat.com>
934 PR gcov-profile/93753
935 * class.c (check_flexarrays): Tighten up a test for potential members
936 of anonymous structs or unions.
938 2020-02-20 Martin Sebor <msebor@redhat.com>
941 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
943 2020-02-20 Martin Liska <mliska@suse.cz>
946 * config/or1k/or1k.opt: Remove superfluous word.
947 * doc/invoke.texi: Likewise.
949 2020-02-20 Martin Liska <mliska@suse.cz>
952 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
954 2020-02-19 Marek Polacek <polacek@redhat.com>
956 PR c++/93169 - wrong-code with a non-constexpr constructor.
957 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
958 on constant CONSTRUCTORs.
960 2020-02-15 Marek Polacek <polacek@redhat.com>
962 PR c++/93710 - poor diagnostic for array initializer.
963 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
966 2020-02-15 Jason Merrill <jason@redhat.com>
969 * pt.c (any_template_parm_r): Look into lambda body.
972 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
974 2020-02-14 Jakub Jelinek <jakub@redhat.com>
977 * class.c (enum_min_precision): Change prec type from int to int &.
980 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
981 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
982 (fallback_dfloat32_type, fallback_dfloat64_type,
983 fallback_dfloat128_type): Define.
984 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
986 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
987 is disabled for compatibility.
989 2020-02-13 Jason Merrill <jason@redhat.com>
992 * name-lookup.c (matching_fn_p): A function does not match a
997 * tree.c (decl_linkage): Always lk_none for locals.
999 2020-02-12 Jason Merrill <jason@redhat.com>
1003 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
1004 * pt.c (find_parameter_packs_r): Not here.
1006 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
1008 * coroutines.cc (build_actor_fn): Implement deallocation function
1009 selection per n4849, dcl.fct.def.coroutine bullet 12.
1010 (morph_fn_to_coro): Implement allocation function selection per
1011 n4849, dcl.fct.def.coroutine bullets 9 and 10.
1013 2020-02-12 Marek Polacek <polacek@redhat.com>
1015 PR c++/93684 - ICE-on-invalid with broken attribute.
1016 * parser.c (cp_parser_std_attribute): Peek a token first before
1019 2020-02-11 Jason Merrill <jason@redhat.com>
1022 * class.c (add_implicitly_declared_members): Use do_friend.
1023 * method.c (implicitly_declare_fn): Fix friend handling.
1024 (decl_remember_implicit_trigger_p): New.
1025 (synthesize_method): Use it.
1026 * decl2.c (mark_used): Use it.
1028 2020-02-11 Jason Merrill <jason@redhat.com>
1032 * constexpr.c (maybe_constant_value): Correct earlier change.
1033 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
1034 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
1036 2020-02-12 Patrick Palka <ppalka@redhat.com>
1040 * type-utils.h (find_type_usage): Refactor to take a tree * and to
1041 return a tree *, and update documentation accordingly.
1042 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
1043 decltype(auto) node.
1044 (make_constrained_decltype_auto): No need to explicitly set
1045 AUTO_IS_DECLTYPE anymore.
1046 (splice_late_return_type): Use find_type_usage to find and
1047 replace a possibly nested auto node instead of using is_auto.
1048 Check test for is_auto into an assert when deciding whether
1049 to late_return_type.
1050 (type_uses_auto): Adjust the call to find_type_usage.
1051 * parser.c (cp_parser_decltype): No need to explicitly set
1052 AUTO_IS_DECLTYPE anymore.
1054 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
1055 (dump_simple_decl): Handle standard concept definitions as well as
1056 variable concept definitions.
1058 2020-02-10 Jakub Jelinek <jakub@redhat.com>
1061 * error.c (dump_decl_name): Fix up last argument to strncmp.
1063 2020-02-10 Jason Merrill <jason@redhat.com>
1066 * tree.c (array_of_unknown_bound_p): New.
1067 * init.c (perform_member_init): Do nothing for flexible arrays.
1069 2020-02-09 Jakub Jelinek <jakub@redhat.com>
1072 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
1073 ARRAY_TYPE, use the element type. Punt if objtype after that is not
1076 2020-02-08 Jason Merrill <jason@redhat.com>
1079 * expr.c (fold_for_warn): Call maybe_constant_value.
1080 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
1081 (maybe_constant_value): Add uid_sensitive parm.
1082 (get_fundef_copy): Don't copy if it's true.
1083 (cxx_eval_call_expression): Don't instantiate if it's true.
1084 (cxx_eval_outermost_constant_expr): Likewise.
1087 * constexpr.c (maybe_constant_value): Don't unshare if the cached
1088 value is the same as the argument.
1090 * typeck.c (maybe_warn_about_returning_address_of_local): Add
1093 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
1096 2020-02-08 Jakub Jelinek <jakub@redhat.com>
1099 * constexpr.c (find_array_ctor_elt): If last element has no index,
1100 for flag_checking verify all elts have no index. If i is within the
1101 elts, return it directly, if it is right after the last elt, append
1102 if NULL index, otherwise force indexes on all elts.
1103 (cxx_eval_store_expression): Allow cep->index to be NULL.
1105 2020-02-07 Marek Polacek <polacek@redhat.com>
1107 PR c++/92947 - Paren init of aggregates in unevaluated context.
1108 * call.c (build_new_method_call_1): Don't check
1109 cp_unevaluated_operand. Check the return value of digest_init.
1111 2020-02-06 Jason Merrill <jason@redhat.com>
1114 * tree.c (cp_walk_subtrees): Walk into type template arguments.
1115 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
1116 instead of TYPE_ALIAS_P.
1117 * pt.c (push_template_decl_real): Likewise.
1118 (find_parameter_packs_r): Likewise. Remove dead code.
1119 * error.c (find_typenames_r): Remove dead code.
1121 2020-02-06 Jason Merrill <jason@redhat.com>
1124 * parser.c (cp_parser_constraint_primary_expression): Do the main
1125 parse non-tentatively.
1127 2020-02-06 Marek Polacek <polacek@redhat.com>
1129 PR c++/93597 - ICE with lambda in operator function.
1130 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
1132 2020-02-05 Jason Merrill <jason@redhat.com>
1135 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
1136 handling of TREE_CHAIN for empty pack.
1138 2020-02-05 Jakub Jelinek <jakub@redhat.com>
1141 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
1142 prior to passing it to c_build_vec_convert.
1144 2020-02-05 Marek Polacek <polacek@redhat.com>
1146 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
1147 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
1150 2020-02-05 Jason Merrill <jason@redhat.com>
1153 * decl.c (grokdeclarator): Reject field of current class type even
1156 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
1158 * coroutines.cc (maybe_promote_captured_temps): Increase the index
1159 number for temporary variables' name.
1161 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
1163 * coroutines.cc (build_co_await): Call convert_from_reference
1164 to wrap co_await_expr with indirect_ref which avoid
1165 reference/non-reference type confusion.
1167 (co_await_expander): Sink to call_expr if await_resume
1168 is wrapped by indirect_ref.
1170 2020-02-04 Jason Merrill <jason@redhat.com>
1173 * constraint.cc (satisfy_declaration_constraints): Check return
1174 value of push_tinst_level.
1177 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
1178 elements instead of value-initializing them.
1181 * init.c (perform_member_init): Simplify.
1182 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
1184 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
1186 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
1188 * coroutines.cc (find_promise_type): Delete unused forward
1190 (struct coroutine_info): Add a bool for no promise type error.
1191 (coro_promise_type_found_p): Only emit the error for a missing
1192 promise once in each affected coroutine.
1194 2020-02-03 Jason Merrill <jason@redhat.com>
1197 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
1198 defer loading the value of a reference.
1200 2020-02-03 Jason Merrill <jason@redhat.com>
1203 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
1205 [COMPONENT_REF]: A member function reference doesn't use the object
1208 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
1211 * coroutines.cc (struct coroutine_info): Add a bool flag to note
1212 that we emitted an error for a bad function return type.
1213 (get_coroutine_info): Tolerate an unset info table in case of
1215 (find_coro_traits_template_decl): In case of error or if we didn't
1216 find a type template, note we emitted the error and suppress
1218 (find_coro_handle_template_decl): Likewise.
1219 (instantiate_coro_traits): Only check for error_mark_node in the
1220 return from lookup_qualified_name.
1221 (coro_promise_type_found_p): Reorder initialization so that we check
1222 for the traits and their usability before allocation of the info
1223 table. Check for a suitable return type and emit a diagnostic for
1224 here instead of relying on the lookup machinery. This allows the
1225 error to have a better location, and means we can suppress multiple
1227 (coro_function_valid_p): Re-check for a valid promise (and thus the
1228 traits) before proceeding. Tolerate missing info as a fatal error.
1230 2020-02-03 Jason Merrill <jason@redhat.com>
1233 * cp-gimplify.c (predeclare_vla): New.
1234 (cp_genericize_r) [NOP_EXPR]: Call it.
1236 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
1238 * coroutines.cc (transform_await_wrapper): Set actor funcion as
1239 new context of label_decl.
1240 (build_actor_fn): Fill new field of await_xform_data.
1242 2020-02-02 Marek Polacek <polacek@redhat.com>
1244 PR c++/93530 - ICE on invalid alignas in a template.
1245 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
1248 2020-01-31 Jason Merrill <jason@redhat.com>
1251 * semantics.c (process_outer_var_ref): Capture VLAs even in
1252 unevaluated context.
1255 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
1256 non-aggregate elements.
1257 (reshape_init_array): Add first_initializer_p parm.
1258 (reshape_init_r): Change first_initializer_p from bool to tree.
1259 (reshape_init): Pass init to it.
1262 * parser.c (cp_parser_initializer_list): Suppress location wrappers
1265 2020-01-29 Jason Merrill <jason@redhat.com>
1268 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
1269 the expression was dependent before substitution.
1271 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
1273 * coroutines.cc (act_des_fn): New.
1274 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
1275 Access promise via actor function's frame pointer argument.
1276 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
1278 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
1280 * coroutines.cc (co_await_expander): Handle type conversion case.
1282 2020-01-29 Jason Merrill <jason@redhat.com>
1287 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
1288 a trailing return type.
1289 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
1292 2020-01-29 Marek Polacek <polacek@redhat.com>
1294 PR c++/91754 - Fix template arguments comparison with class NTTP.
1295 * pt.c (class_nttp_const_wrapper_p): New.
1296 (template_args_equal): See through class_nttp_const_wrapper_p
1299 2020-01-29 Marek Polacek <polacek@redhat.com>
1301 PR c++/92948 - Fix class NTTP with template arguments.
1302 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
1303 converting a value-dependent expression to a class type.
1304 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
1305 as the result of the tsubst_copy call.
1307 2020-01-29 Jakub Jelinek <jakub@redhat.com>
1310 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
1311 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
1313 2020-01-28 Jason Merrill <jason@redhat.com>
1316 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
1320 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
1323 * call.c (build_user_type_conversion_1): Allow a template conversion
1324 returning an rvalue reference to bind directly to an lvalue.
1327 * decl.c (grokdeclarator): Propagate eh spec from typedef.
1329 2020-01-28 Martin Liska <mliska@suse.cz>
1332 * pt.c (redeclare_class_template): Group couple of
1333 errors and inform messages with auto_diagnostic_group.
1335 2020-01-28 Martin Liska <mliska@suse.cz>
1338 * pt.c (redeclare_class_template): Use inform
1339 for the second location.
1341 2020-01-27 Jason Merrill <jason@redhat.com>
1344 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
1346 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
1349 * coroutines.cc (morph_fn_to_coro): Check the ramp return
1350 value when it is constructed from the 'get return object'.
1352 2020-01-27 Nathan Sidwell <nathan@acm.org>
1355 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
1357 2020-01-26 Jason Merrill <jason@redhat.com>
1360 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
1361 temporarily enable -Wsystem-headers. Change second warning to
1365 * semantics.c (finish_call_expr): Don't call
1366 instantiate_non_dependent_expr before warn_for_memset.
1368 2020-01-25 Marek Polacek <polacek@redhat.com>
1370 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
1371 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
1372 dynamic_cast diagnostic.
1374 2020-01-24 Jason Merrill <jason@redhat.com>
1376 PR c++/93400 - ICE with constrained friend.
1377 * constraint.cc (maybe_substitute_reqs_for): New.
1378 * decl.c (function_requirements_equivalent_p): Call it.
1379 * pt.c (tsubst_friend_function): Only substitute
1380 TEMPLATE_PARMS_CONSTRAINTS.
1381 (tsubst_template_parms): Copy constraints.
1383 2020-01-24 Jason Merrill <jason@redhat.com>
1385 PR c++/93279 - ICE with lambda in member operator.
1386 * name-lookup.c (maybe_save_operator_binding): Don't remember
1387 class-scope bindings.
1389 2020-01-24 Jason Merrill <jason@redhat.com>
1391 PR c++/93377 - ICE with member alias in constraint.
1392 * pt.c (any_template_parm_r): Look at template arguments for all
1393 aliases, not only alias templates.
1395 2020-01-24 Marek Polacek <polacek@redhat.com>
1397 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
1398 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
1400 2020-01-24 Jason Merrill <jason@redhat.com>
1402 PR c++/92852 - ICE with generic lambda and reference var.
1403 * constexpr.c (maybe_constant_value): Likewise.
1405 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
1408 * parser.c (cp_parser_nested_name_specifier_opt): Properly
1409 diagnose concept-ids.
1411 2020-01-23 Jason Merrill <jason@redhat.com>
1413 PR c++/93331 - ICE with __builtin_strchr.
1414 * constexpr.c (cxx_eval_builtin_function_call): Use the original
1415 argument if we didn't manage to extract a STRING_CST.
1417 PR c++/93345 - ICE with defaulted dtor and template.
1419 * decl.c (cxx_maybe_build_cleanup): Don't try to set
1420 throwing_cleanup in a template.
1422 2020-01-22 Marek Polacek <polacek@redhat.com>
1424 PR c++/92907 - noexcept does not consider "const" in member functions.
1425 * g++.dg/cpp0x/noexcept56.C: New test.
1427 2020-01-22 Marek Polacek <polacek@redhat.com>
1429 PR c++/93324 - ICE with -Wall on constexpr if.
1430 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
1432 2020-01-22 Patrick Palka <ppalka@redhat.com>
1434 * constraint.cc (get_mapped_args): Avoid using auto_vec
1435 as a vector element. Release the vectors inside the lists
1437 * parser.c (cp_literal_operator_id): Free the buffer.
1439 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
1441 * coroutines.cc (finish_co_await_expr): Add error check on return
1442 value of build_co_await.
1443 (finish_co_yield_expr,): Ditto.
1445 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
1447 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
1448 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
1449 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
1451 2020-01-21 Jason Merrill <jason@redhat.com>
1453 PR c++/60855 - ICE with sizeof VLA capture.
1454 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
1456 PR c++/90732 - ICE with VLA capture and generic lambda.
1457 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
1459 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
1460 Bin Cheng <bin.cheng@linux.alibaba.com>
1462 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
1463 from complete_type_or_else.
1464 (register_param_uses): Likewise.
1465 (build_co_await): Do not try to use complete_type_or_else for void
1466 types, otherwise for incomplete types, check for NULL return from
1467 complete_type_or_else.
1469 2020-01-21 Jason Merrill <jason@redhat.com>
1471 PR c++/91476 - anon-namespace reference temp clash between TUs.
1472 * decl2.c (copy_linkage): Factor out of get_guard.
1473 * call.c (make_temporary_var_for_ref_to_temp): Use it.
1474 * decl.c (cp_finish_decomp): Use it.
1475 (cp_finish_decl): determine_visibility sooner.
1477 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
1479 * coroutines.cc (finish_co_await_expr): Set return value flag.
1480 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
1482 2020-01-19 Jason Merrill <jason@redhat.com>
1484 PR c++/33799 - destroy return value, take 2.
1485 * cp-tree.h (current_retval_sentinel): New macro.
1486 (struct language_function): Add throwing_cleanup bitfield.
1487 * decl.c (cxx_maybe_build_cleanup): Set it.
1488 * except.c (maybe_set_retval_sentinel)
1489 (maybe_splice_retval_cleanup): New functions.
1490 * parser.c (cp_parser_compound_statement): Call
1491 maybe_splice_retval_cleanup.
1492 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
1494 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
1496 2020-01-18 Jakub Jelinek <jakub@redhat.com>
1498 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
1499 but non-NO_DOLLAR_IN_LABEL case build.
1501 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
1503 * Make-lang.in: Add coroutines.o.
1504 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
1505 (DECL_COROUTINE_P): New.
1506 * lex.c (init_reswords): Enable keywords when the coroutine flag
1508 * operators.def (co_await): New operator.
1509 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
1510 (op_error): Likewise.
1511 (build_new_op_1): Likewise.
1512 (build_new_function_call): Validate coroutine builtin arguments.
1513 * constexpr.c (potential_constant_expression_1): Handle
1514 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
1515 * coroutines.cc: New file.
1516 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
1517 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
1518 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
1519 * cp-tree.h (coro_validate_builtin_call): New.
1520 * decl.c (emit_coro_helper): New.
1521 (finish_function): Handle the case when a function is found to
1522 be a coroutine, perform the outlining and emit the outlined
1523 functions. Set a bit to signal that this is a coroutine component.
1524 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
1525 (cp_parser_unary_expression): Handle co_await.
1526 (cp_parser_assignment_expression): Handle co_yield.
1527 (cp_parser_statement): Handle RID_CO_RETURN.
1528 (cp_parser_jump_statement): Handle co_return.
1529 (cp_parser_operator): Handle co_await operator.
1530 (cp_parser_yield_expression): New.
1531 (cp_parser_required_error): Handle RT_CO_YIELD.
1532 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
1533 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
1535 * tree.c (cp_walk_subtrees): Likewise.
1537 2020-01-17 Jason Merrill <jason@redhat.com>
1539 PR c++/92531 - ICE with noexcept(lambda).
1540 * pt.c (uses_template_parms): Don't try to enumerate all the
1543 2020-01-17 Jakub Jelinek <jakub@redhat.com>
1546 * parser.c (cp_parser_template_name): Look up deprecated attribute
1547 in DECL_TEMPLATE_RESULT or its type's attributes.
1549 2020-01-16 Jason Merrill <jason@redhat.com>
1551 PR c++/93286 - ICE with __is_constructible and variadic template.
1552 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
1553 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
1555 PR c++/93280 - ICE with aggregate assignment and DMI.
1556 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
1557 * typeck2.c (digest_nsdmi_init): Not here.
1559 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
1562 * cp-tree.h (is_constrained_auto): New.
1563 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
1564 handle concept-check expressions; take a cp_decl_specifier_seq*
1566 (cp_parser_condition): Update call.
1567 (cp_parser_simple_declaration): Likewise.
1568 (cp_parser_placeholder_type_specifier): Correctly handle
1569 concept-check expressions.
1571 2020-01-15 Jason Merrill <jason@redhat.com>
1574 PR c++/33799 - destroy return value if local cleanup throws.
1575 * cp-tree.h (current_retval_sentinel): New macro.
1576 * decl.c (start_preparsed_function): Set up cleanup for retval.
1577 * typeck.c (check_return_expr): Set current_retval_sentinel.
1579 PR c++/93257 - consteval void function.
1580 * constexpr.c (verify_constant): Allow void_node.
1582 PR c++/92871 - bad code with xvalue and GNU ?: extension.
1583 * call.c (prevent_lifetime_extension): New.
1584 (build_conditional_expr_1): Use it.
1586 2020-01-14 Nathan Sidwell <nathan@acm.org>
1589 * pt.c (retrieve_specialization): Use get_template_info, not open
1593 * pt.c (retrieve_specialization): Get the TI from the decl or the
1594 classtype as appropriate.
1596 2020-01-14 David Malcolm <dmalcolm@redhat.com>
1598 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
1599 New static constant.
1600 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
1601 (struct named_label_hash::empty_zero_p): Likewise.
1602 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
1604 2020-01-14 Jason Merrill <jason@redhat.com>
1606 PR c++/92590 - wrong handling of inherited default ctor.
1607 * class.c (add_method): A constrained inherited ctor doesn't hide an
1608 implicit derived ctor.
1610 PR c++/92552 - ICE with inherited constrained default ctor.
1611 * pt.c (instantiate_class_template_1): Copy
1612 TYPE_HAS_USER_CONSTRUCTOR.
1613 PR c++/91930 - ICE with constrained inherited default ctor.
1614 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
1615 for inherited constructor.
1616 PR c++/92594 - ICE with inherited trivial default ctor.
1617 * method.c (trivial_fn_p): Treat an inherited default constructor
1618 like a normal default constructor.
1620 PR c++/92594 - ICE with inherited trivial default ctor.
1621 * method.c (trivial_fn_p): Treat an inherited default constructor
1622 like a normal default constructor.
1624 PR c++/92009 - ICE with punning of typeid.
1625 * rtti.c (get_tinfo_desc): Call xref_basetypes.
1626 * constexpr.c (cxx_fold_indirect_ref): Don't strip
1629 2020-01-13 Jason Merrill <jason@redhat.com>
1631 PR c++/92746 - ICE with noexcept of function concept check.
1632 * except.c (check_noexcept_r): Handle concept-check.
1634 PR c++/92582 - ICE with member template as requirement.
1635 * pt.c (struct find_template_parameter_info): Add ctx_parms.
1636 (any_template_parm_r): Handle TEMPLATE_DECL.
1637 (find_template_parameters): Take parms instead of their depth.
1638 * constraint.cc (build_parameter_mapping): Pass them.
1640 PR c++/33799 - destroy return value if local cleanup throws.
1641 * cp-tree.h (current_retval_sentinel): New macro.
1642 * decl.c (start_preparsed_function): Set up cleanup for retval.
1643 * typeck.c (check_return_expr): Set current_retval_sentinel.
1645 PR c++/93238 - short right-shift with enum.
1646 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
1648 2020-01-10 Jason Merrill <jason@redhat.com>
1650 * typeck.c (cp_build_binary_op): Restore short_shift code.
1652 PR c++/93143 - incorrect tree sharing with constexpr.
1653 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
1654 CONSTRUCTORs are already unshared.
1656 PR c++/93173 - incorrect tree sharing.
1658 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
1659 copy_if_shared after cp_genericize_tree.
1660 * typeck2.c (split_nonconstant_init): Don't unshare here.
1662 2020-01-08 Jason Merrill <jason@redhat.com>
1664 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
1665 TARGET_EXPR_DIRECT_INIT_P.
1666 * constexpr.c (cxx_eval_constant_expression): Likewise.
1668 2020-01-08 Jason Merrill <jason@redhat.com>
1670 PR c++/91369 - constexpr destructor and member initializer.
1671 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
1672 when not preevaluating.
1674 2020-01-08 Jason Merrill <jason@redhat.com>
1676 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
1679 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
1681 * init.c (build_new): Add location_t parameter and use it throughout.
1682 (build_raw_new_expr): Likewise.
1683 * parser.c (cp_parser_new_expression): Pass the combined_loc.
1684 * pt.c (tsubst_copy_and_build): Adjust call.
1685 * cp-tree.h: Update declarations.
1687 2020-01-07 Jason Merrill <jason@redhat.com>
1689 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
1690 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
1691 explicit class visibility for a template.
1693 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
1695 * mangle.c (mangle_type_attribute_p): New function, split out from...
1696 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
1697 that contain a space.
1699 2020-01-07 Jakub Jelinek <jakub@redhat.com>
1702 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
1703 member, initialize it to zero in ctor.
1704 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
1705 a heap object. Don't cache calls to functions which allocate some
1706 heap objects and don't deallocate them or deallocate some heap
1707 objects they didn't allocate.
1709 2020-01-06 Jason Merrill <jason@redhat.com>
1711 PR c++/92552 - ICE with inherited constrained default ctor.
1712 * pt.c (instantiate_class_template_1): Copy
1713 TYPE_HAS_USER_CONSTRUCTOR.
1714 * class.c (one_inherited_ctor): Don't set it here.
1716 2020-01-06 Andrew Sutton <asutton@lock3software.com>
1718 PR c++/92739 - parsing requires clause with attributes.
1719 * parser.c (cp_parser_constraint_requires_parens): Exclude
1720 attributes as postfix expressions.
1722 2020-01-05 Jakub Jelinek <jakub@redhat.com>
1725 * parser.c (cp_parser_check_class_key): Disable access checks for the
1727 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
1728 !warn_redundant_tags.
1730 2010-01-05 Jakub Jelinek <jakub@redhat.com>
1733 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
1734 TARGET_EXPR if it has been gimplified already.
1736 2020-01-03 Jason Merrill <jason@redhat.com>
1738 PR c++/93033 - incorrect tree node sharing with array init.
1739 * typeck2.c (split_nonconstant_init): Unshare non-decl.
1740 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
1742 2020-01-02 Jason Merrill <jason@redhat.com>
1744 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
1747 2020-01-02 Jakub Jelinek <jakub@redhat.com>
1750 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
1751 has not been found, rather than error_mark_node.
1753 2020-01-01 Jakub Jelinek <jakub@redhat.com>
1755 Update copyright years.
1757 Copyright (C) 2020 Free Software Foundation, Inc.
1759 Copying and distribution of this file, with or without modification,
1760 are permitted in any medium without royalty provided the copyright
1761 notice and this notice are preserved.