1 2020-07-31 Jakub Jelinek <jakub@redhat.com>
4 * decl.c (finish_function): In constexpr functions use for C++14 and
5 later error instead of warning if no return statement is present and
6 diagnose it regardless of warn_return_type. Move the warn_return_type
7 diagnostics earlier in the function.
9 2020-07-31 Martin Sebor <msebor@redhat.com>
12 * class.c (build_base_path): Set no-warning bit on the synthesized
13 conditional expression in static_cast.
15 2020-07-31 Richard Biener <rguenther@suse.de>
18 * cp-objcp-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
19 Define to c_common_finalize_early_debug.
21 2020-07-31 Patrick Palka <ppalka@redhat.com>
24 * constexpr.c (cxx_eval_constant_expression) <case CONST_DECL>:
25 Pass false to decl_constant_value and decl_really_constant_value
26 so that they don't unshare their result.
27 * cp-tree.h (decl_constant_value): New declaration with an added
29 (decl_really_constant_value): Add bool parameter defaulting to
30 true to existing declaration.
31 * init.c (constant_value_1): Add bool parameter which controls
32 whether to unshare the initializer before returning. Call
33 unshare_expr at most once.
34 (scalar_constant_value): Pass true to constant_value_1's new
36 (decl_really_constant_value): Add bool parameter and forward it
38 (decl_constant_value): Likewise, but instead define a new
39 overload with an added bool parameter.
41 2020-07-30 Patrick Palka <ppalka@redhat.com>
44 * pt.c (resolve_overloaded_unification): If the function
45 template specialization has a placeholder return type,
46 then instantiate it before attempting unification.
48 2020-07-30 Patrick Palka <ppalka@redhat.com>
51 * pt.c (alias_ctad_tweaks): Call remove_constraints before
52 calling set_constraints.
54 2020-07-30 Patrick Palka <ppalka@redhat.com>
57 * pt.c (reduce_template_parm_level): Propagate DECL_VIRTUAL_P
58 from the original TEMPLATE_PARM_DECL to the new lowered one.
60 2020-07-30 Patrick Palka <ppalka@redhat.com>
63 * constraint.cc (constraints_satisfied_p): Return true if
65 * pt.c (do_type_instantiation): Update a paragraph taken from
66 [temp.explicit] to reflect the latest specification. Don't
67 instantiate a member with unsatisfied constraints.
69 2020-07-29 Jason Merrill <jason@redhat.com>
72 * cp-tree.h (IMPLICIT_RVALUE_P): New.
73 (enum cp_lvalue_kind_flags): Add clk_implicit_rval.
74 (implicit_rvalue_p, set_implicit_rvalue_p): New.
75 * call.c (reference_binding): Check clk_implicit_rval.
76 (build_over_call): Adjust C++20 implicit move.
77 * coroutines.cc (finish_co_return_stmt): Simplify implicit move.
78 * except.c (build_throw): Adjust C++20 implicit move.
79 * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Propagate
81 * tree.c (lvalue_kind): Set clk_implicit_rval.
82 * typeck.c (treat_lvalue_as_rvalue_p): Overhaul.
83 (maybe_warn_pessimizing_move): Adjust.
84 (check_return_expr): Adjust C++20 implicit move.
86 2020-07-29 Jason Merrill <jason@redhat.com>
89 * call.c (build_over_call): Don't call a const ref
90 overload for implicit move.
92 2020-07-28 Nathan Sidwell <nathan@acm.org>
94 * cp-gimplify.c (cp_genericize_r): Set IMPORTED_DECL's context.
95 * cp-objcp-common.c (cp_pushdecl): Set decl's context.
96 * decl.c (grokfndecl): Make DECL_CONTEXT setting clearer.
98 2020-07-28 Nathan Sidwell <nathan@acm.org>
100 * class.c (fixup_type_variants): Copy TYPE_SIZE and
102 (finish_struct): Call it.
104 2020-07-28 Nathan Sidwell <nathan@acm.org>
106 * ptree.c (cxx_print_decl): Better indentation.
108 2020-07-28 Jakub Jelinek <jakub@redhat.com>
109 Mark Wielaard <mark@klomp.org>
112 * parser.c (cp_lexer_safe_previous_token): Don't call
113 cp_lexer_previous_token, instead inline it by hand and return NULL
114 instead of failing assertion if all previous tokens until the first
116 (cp_parser_error_1): Optimize - only call cp_lexer_safe_previous_token
117 if token->type is CPP_NAME. Use cp_lexer_safe_previous_token instead
118 of cp_lexer_previous_token for the missing_token_desc != RT_NONE
121 2020-07-27 Nathan Sidwell <nathan@acm.org>
123 * cp-tree.h (enum cp_tree_index): Add CPTI_AS_BASE_IDENTIFIER.
124 (as_base_identifier): Define.
125 * decl.c (initialize_predifined_identifiers): Initialize as_base
127 * class.c (layout_class_type): Name the as-base type. Zap
128 NSDMI its fields may have.
130 2020-07-22 Nathan Sidwell <nathan@acm.org>
132 * class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.
134 2020-07-22 Nathan Sidwell <nathan@acm.org>
136 * typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
138 [UNDERLYING_TYPE]: Use an if.
141 2020-07-22 Nathan Sidwell <nathan@acm.org>
143 * decl.c (decls_match): Move variables into scopes
145 (duplicate_decls): Use STRIP_TEMPLATE.
146 (build_typename_type): Move var decls to their assignments.
147 (begin_function_body): Likewise.
148 * decl2.c (get_guard): Likewise.
149 (mark_used): Use true for truthiness.
150 * error.c (dump_aggr_type): Hold the decl in a var called
153 2020-07-22 Nathan Sidwell <nathan@acm.org>
155 * cp-tree.h (struct tree_lambda_expr): Shrink
156 default_capture_mode & discriminator.
158 2020-07-22 Nathan Sidwell <nathan@acm.org>
160 * mangle.c (decl_is_template_id): Rename to ...
161 (maybe_template_info): ... here. Return the template info,
162 rather than use a pointer. Adjust all callers.
163 (find_substitution): Use template_args_equal, rather than
166 2020-07-22 Tobias Burnus <tobias@codesourcery.com>
168 * parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
169 (cp_parser_omp_critical): Permit hint(0) clause without named critical.
170 * pt.c (tsubst_expr): Re-check the latter for templates.
172 2020-07-21 Sunil K Pandey <skpgkp2@gmail.com>
175 * decl.c (cp_finish_decl): Call target hook
176 lower_local_decl_alignment to lower local decl alignment.
178 2020-07-21 Nathan Sidwell <nathan@acm.org>
180 * parser.c (cp_lexer_consume_token): Drop PRAGMA_EOL assert.
181 (cp_parser_skip_to_closing_parenthesis_1): Only pass start token
182 to pragma skipper if recovering.
183 (cp_parser_skip_to_pragma_eol): Only purge and change pragma
184 state when recovering.
186 2020-07-20 Jason Merrill <jason@redhat.com>
188 * pt.c (type_dependent_expression_p): A pseudo-dtor can be
190 * semantics.c (finish_call_expr): Use build_trivial_dtor_call for
192 (finish_pseudo_destructor_expr): Leave type NULL for dependent arg.
194 2020-07-20 Jason Merrill <jason@redhat.com>
196 * mangle.c (write_base_ref): New.
197 (write_expression): Use it for base field COMPONENT_REFs.
198 * pt.c (invalid_tparm_referent_p): Canonicalize the type
199 of array offsets. Allow subobjects.
201 2020-07-20 Jason Merrill <jason@redhat.com>
203 * pt.c (collect_ctor_idx_types): Add 'const' when deducing from
206 2020-07-17 Marek Polacek <polacek@redhat.com>
209 * decl.c (grokdeclarator): Detect cv-qual decltype(auto).
210 * pt.c (do_auto_deduction): Likewise.
212 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
219 * coroutines.cc (struct coro_ret_data): Delete.
220 (coro_maybe_expand_co_return): Delete.
221 (co_return_expander): Delete.
222 (expand_co_returns): Delete.
223 (co_await_find_in_subtree): Remove unused name.
224 (build_actor_fn): Remove unused parm, remove handling
225 for co_return expansion.
226 (register_await_info): Demote duplicate info message to a
228 (coro_make_frame_entry): Move closer to use site.
229 (struct susp_frame_data): Add fields for final suspend label
230 and a flag to indicate await expressions with initializers.
231 (captures_temporary): Delete.
232 (register_awaits): Remove unused code, update comments.
233 (find_any_await): New.
234 (tmp_target_expr_p): New.
235 (struct interesting): New.
236 (find_interesting_subtree): New.
237 (struct var_nest_node): New.
238 (flatten_await_stmt): New.
239 (handle_nested_conditionals): New.
240 (process_conditional): New.
241 (replace_statement_captures): Rename to...
242 (maybe_promote_temps): ... this.
243 (maybe_promote_captured_temps): Delete.
244 (analyze_expression_awaits): Check for await expressions with
245 initializers. Simplify handling for truth-and/or-if.
246 (expand_one_truth_if): Simplify (map cases that need expansion
248 (await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
249 handling for truth-and/or-if expressions.
250 (register_local_var_uses): Ensure that we create names in the
251 implementation namespace.
252 (morph_fn_to_coro): Add final suspend label to suspend frame
253 callback data and remove it from the build_actor_fn call.
255 2020-07-16 Marek Polacek <polacek@redhat.com>
257 * call.c (convert_like): Remove macro and introduce a new
259 (convert_like_with_context): Likewise.
260 (convert_like_real): Rename to convert_like.
261 (convert_like_real_1): Rename to convert_like_internal. Call
262 convert_like instead of convert_like_real therein.
263 (perform_direct_initialization_if_possible): Call convert_like
264 instead of convert_like_real.
266 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
268 * coroutines.cc: Correct some spelling errors
271 2020-07-15 Nathan Sidwell <nathan@acm.org>
273 * parser.c (cp_parser_declaration): Avoid copying tokens.
274 (cp_parser_block_declaration): RAII token pointer.
276 2020-07-15 Nathan Sidwell <nathan@acm.org>
278 * parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
279 meeting a deferred pragma.
280 (cp_parser_skip_to_end_of_statement): Likewise.
281 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
282 (cp_parser_skip_to_pragma_eol): We should never meet EOF.
283 (cp_parser_omp_declare_simd): Likewise.
284 (cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
285 (pragma_lex): Likewise.
287 2020-07-14 Marek Polacek <polacek@redhat.com>
292 * call.c (convert_like_real_1): Renamed from convert_like_real.
293 (convert_like_real): New wrapper for convert_like_real_1.
295 2020-07-14 Nathan Sidwell <nathan@acm.org>
297 * parser.c (cp_lexer_alloc): Do not deal with PCH here.
298 (cp_lexer_new_main): Deal with PCH here. Store the tokens directly
300 (cp_lexer_new_from_tokens): Assert last token isn't purged either.
301 (cp_lexer_get_preprocessor_token): Change first arg to flags, adjust.
302 (cp_parser_new): Pass the lexer in, don't create it here.
303 (cp_parser_translation_unit): Initialize access checks here.
304 (cp_parser_initial_pragma): First token is provided by caller,
305 don't deal with PCH stopping here. Adjust error message.
306 (c_parse_file): Adjust, change error message to avoid C++20 module
309 2020-07-14 Nathan Sidwell <nathan@acm.org>
311 * ptree.c (cxx_print_type): Add TYPEOF_TYPE and BASES.
313 2020-07-14 Nathan Sidwell <nathan@acm.org>
315 * class.c (build_base_field_1): Cache CLASSTYPE_AS_BASE.
316 (build_self_reference): Rename value -> decl.
317 (dump_class_hierarchy_1): Cache CLASSTYPE_AS_BASE.
319 2020-07-14 Marek Polacek <polacek@redhat.com>
322 * decl.c (grokdeclarator) <case cdk_function>: Check also
323 pointers/references/... to functions.
325 2020-07-14 Nathan Sidwell <nathan@acm.org>
327 * cp-tree.h: Correct some tree lang flag comments,
328 reformat some structure definitions. Note some structure
329 sizes. Clarify some comments.
330 (yyungetc): Delete. Not been a thing for some time.
331 * class.c (copy_fndecl_with_name): Comment.
332 (check_bases_and_members): Unnecessary {}.
333 (layout_class_type): Comment.
334 * cp-tree.def (UNBOUND_CLASS_TEMPLATE): Adjust comment.
335 * decl.c: Fix some formatting & whitespace issues.
336 (function_requirements_equivalent_p): Note why
337 substitutions are needed.
338 * decl2.c (no_linkage_error): Note that heroics about
339 'typedef struct { ... };' are no longer needed.
340 * method.c: Whitespace.
341 * name-lookup.c: Whitespace.
342 (add_decl_to_level): Reformat a line.
343 (print_binding_stack): Mark as DEBUG_FUNCTION.
344 (has_using_namespace_std_directive_p): Delete comment.
346 * ptree.c: Whitespace.
347 * rtti.c: Whitespace & comment.
349 * typeck.c (structural_comptypes): Add comment.
351 2020-07-13 Nathan Sidwell <nathan@acm.org>
353 * Make-lang.in (c++.disclean): Likewise.
355 2020-07-13 Marek Polacek <polacek@redhat.com>
358 * parser.c (cp_parser_enum_specifier): Commit to tentative parse
359 after we've seen an opening brace.
361 2020-07-10 Jason Merrill <jason@redhat.com>
363 * tree.c (structural_type_p): Allow unions.
364 * mangle.c (write_expression): Express unions with a designator.
366 2020-07-10 Jason Merrill <jason@redhat.com>
368 * pt.c (convert_nontype_argument): Handle REAL_TYPE.
369 (invalid_nontype_parm_type_p): Allow all structural types.
370 * tree.c (structural_type_p): Use SCALAR_TYPE_P.
372 2020-07-10 Jason Merrill <jason@redhat.com>
377 * class.c (check_field_decls): An array of empty classes is not an
379 (layout_empty_base_or_field): Handle explicit alignment.
382 2020-07-09 Julian Brown <julian@codesourcery.com>
383 Thomas Schwinge <thomas@codesourcery.com>
386 * semantics.c (finish_omp_clauses): Likewise.
388 2020-07-09 Patrick Palka <ppalka@redhat.com>
391 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
392 Restore dependent_type_p check that guarded the call to
393 is_really_empty_class.
395 2020-07-08 Patrick Palka <ppalka@redhat.com>
398 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
399 When processing_template_decl, check COMPLETE_TYPE_P before
400 calling is_really_empty_class. Don't check dependent_type_p.
402 2020-07-08 Marek Polacek <polacek@redhat.com>
405 * parser.c (cp_parser_decltype): Print error about using decltype(auto)
406 in C++11. Check that the token following "auto" is ")".
408 2020-07-07 Patrick Palka <ppalka@redhat.com>
411 * cxx-pretty-print.c (pp_cxx_unqualified_id): Check
412 PRIMARY_TEMPLATE_P before printing the innermost template
415 2020-07-07 Martin Sebor <msebor@redhat.com>
418 * parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
419 if warning_at returns nonzero.
421 2020-07-06 Martin Sebor <msebor@redhat.com>
424 * call.c (build_over_call): Check calls only when tf_warning is set.
426 2020-07-06 Nathan Sidwell <nathan@acm.org>
428 * decl.c (push_library_fn): Return the decl pushdecl_toplevel returns.
429 * except.c (verify_library_fn): Replace with ...
430 (declare_library_fn_1): ... this fn. Always push the fn.
431 (declare_library_fn): Call it.
432 (build_throw): Call declare_library_fn_1.
434 2020-07-06 Jonathan Wakely <jwakely@redhat.com>
437 * parser.c (cp_parser_toplevel_declaration): Only do pedwarn for
438 empty-declaration in C++98.
440 2020-07-02 Jason Merrill <jason@redhat.com>
441 Jakub Jelinek <jakub@redhat.com>
443 * decl.c (grokfndecl): Allow consteval virtual.
444 * search.c (check_final_overrider): Check consteval mismatch.
445 * constexpr.c (cxx_eval_thunk_call): New.
446 (cxx_eval_call_expression): Call it.
447 * cvt.c (cp_get_fndecl_from_callee): Handle FDESC_EXPR.
448 * decl2.c (mark_vtable_entries): Track vtables with consteval.
449 (maybe_emit_vtables): Pass consteval_vtables through.
450 (clear_consteval_vfns): Replace consteval with nullptr.
451 (c_parse_final_cleanups): Call it.
453 2020-07-01 Nathan Sidwell <nathan@acm.org>
455 * class.c (copy_fndecl_with_name): Add additional predicate args, do
456 not deduce them locally.
457 (copy_operator_fn): Adjust copy_fndecl_with_name call.
458 (build_clone): Add vtt and inherited predicate args. Pass through
459 to copy_fndecl_with_name call.
460 (build_cdtor_clones): Likewise, pass through to build_clone as
462 (build_cdtor): Determine vtt and inherited here.
463 * cp-tree.h (DECL_NEEDS_CTT_PARM_P): Delete.
465 2020-06-30 Nathan Sidwell <nathan@acm.org>
467 * cp-tree.h (copy_fndecl_with_name): Rename to ...
468 (copy_operatorn_fn): ... this. Change arg type.
469 (clone_function_decl): Rename to ...
470 (clone_cdtor): ... this.
471 * class.c (copy_fndecl_with_name): Make static.
472 (copy_operator_fn): New wrapper.
473 (build_clones): Rename to ...
474 (build_cdtor_clones): ... this.
475 (clone_function_decl): Rename to ...
476 (clone_cdtor): ... this. Adjust build_clones calls.
477 (clone_constructors_and_destructors): Adjust clone_function_decl
479 * method.c (implicitly_declare_fn): Adjust copy_fndecl_with_name
481 (lazily_declare_fn): Adjust clone_function_decl call.
482 * pt.c (tsubst_function_decl): Likewise.
483 (instantiate_template_1): Likewise.
485 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
487 * coroutines.cc (morph_fn_to_coro): Remove trailing
488 space in a diagnostic.
490 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
492 * coroutines.cc (expand_one_await_expression): Remove
493 code dealing with initial suspend.
494 (build_actor_fn): Remove code special-casing initial
495 and final suspend. Handle the final suspend and marking
496 of the coroutine as done.
497 (coro_rewrite_function_body): New.
498 (bind_expr_find_in_subtree): Remove.
499 (coro_body_contains_bind_expr_p): Remove.
500 (morph_fn_to_coro): Split the rewrite of the original
501 function into coro_rewrite_function_body and call it.
503 2020-06-29 Marek Polacek <polacek@redhat.com>
506 * decl.c (duplicate_decls): Make sure a concept or a variable
507 template is unique in its declarative region.
509 2020-06-29 Marek Polacek <polacek@redhat.com>
512 * pt.c (collect_ctor_idx_types): Use TREE_TYPE.
514 2020-06-28 Iain Sandoe <iain@sandoe.co.uk>
517 * coroutines.cc (register_local_var_uses): Skip past
520 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
523 * coroutines.cc (get_awaitable_var): New helper.
524 (build_co_await): Check more carefully before
525 copying an awaitable.
526 (expand_one_await_expression): No initializer
527 is required when the awaitable is not a temp.
528 (register_awaits): Remove handling that is now
529 completed when the await expression is built.
531 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
533 * coroutines.cc (morph_fn_to_coro): Diagnose unavailable
534 get_return_object_on_allocation_failure.
536 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
539 * coroutines.cc (struct coroutine_info):Add a field
540 to hold computed p.return_void expressions.
541 (coro_build_promise_expression): New.
542 (get_coroutine_return_void_expr): New.
543 (finish_co_yield_expr): Build the promise expression
544 using coro_build_promise_expression.
545 (finish_co_return_stmt): Likewise.
546 (build_init_or_final_await): Likewise.
547 (morph_fn_to_coro): Likewise, for several cases.
549 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
551 * coroutines.cc (morph_fn_to_coro): Handle error
552 returns in building g-r-o-o-a-f expressions.
554 2020-06-24 Nicholas Krause <xerofoify@gmail.com>
557 * typeck2.c (cxx_incomplete_type_diagnostic): Add missing
558 TYPE_EXPANSION_PACK check for diagnosing incomplete types in
559 cxx_incomplete_type_diagnostic.
561 2020-06-24 Iain Sandoe <iain@sandoe.co.uk>
565 * coroutines.cc (act_des_fn): Copy function
566 attributes onto the outlined coroutine helpers.
568 2020-06-24 Jason Merrill <jason@redhat.com>
570 * call.c (build_over_call): Only call build_base_path once.
572 2020-06-24 Jason Merrill <jason@redhat.com>
575 * call.c (build_over_call): Look up the overrider in base_binfo.
576 * class.c (lookup_vfn_in_binfo): Look through BINFO_PRIMARY_P.
578 2020-06-23 Jason Merrill <jason@redhat.com>
581 Implement C++20 P2082R1, Fixing CTAD for aggregates.
582 * cp-tree.h (TPARMS_PRIMARY_TEMPLATE): Split out from...
583 (DECL_PRIMARY_TEMPLATE): ...here.
584 (builtin_guide_p): Declare.
585 * decl.c (reshape_init_class): Handle bases of a template.
586 (reshape_init_r): An array with dependent bound takes a single
588 * pt.c (tsubst_default_argument): Shortcut {}.
589 (unify_pack_expansion): Allow omitted arguments to trailing pack.
590 (builtin_guide_p): New.
591 (collect_ctor_idx_types): Give a trailing pack a {} default
592 argument. Handle arrays better.
594 2020-06-23 Iain Sandoe <iain@sandoe.co.uk>
597 * coroutines.cc (morph_fn_to_coro): Apply a cleanup to
598 the get return object when the DTOR is non-trivial.
600 2020-06-20 Iain Sandoe <iain@sandoe.co.uk>
603 * coroutines.cc (morph_fn_to_coro): Update handling of
604 get-return-object-on-allocation-fail and diagnose missing
607 2020-06-20 Jason Merrill <jason@redhat.com>
609 * call.c (joust): Only compare constraints for non-template
610 candidates with matching parameters.
611 * pt.c (tsubst_pack_expansion): Fix getting a type parameter
613 (more_specialized_fn): Only compare constraints for candidates with
616 2020-06-19 Jason Merrill <jason@redhat.com>
618 * method.c (early_check_defaulted_comparison): Allow defaulting
619 comparison outside class. Complain if non-member operator isn't a
622 2020-06-18 Jason Merrill <jason@redhat.com>
624 * method.c (early_check_defaulted_comparison): Check for &&.
625 (build_comparison_op): Allow empty union. Diagnose non-category
627 (common_comparison_type): Remove handling for non-category type.
629 2020-06-18 Marek Polacek <polacek@redhat.com>
632 * pt.c (finish_template_variable): Return if
633 coerce_innermost_template_parms return error_mark_node.
635 2020-06-18 Marek Polacek <polacek@redhat.com>
638 * pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
639 if placement is erroneous.
641 2020-06-17 Jonathan Wakely <jwakely@redhat.com>
644 * parser.c (cp_parser_elaborated_type_specifier): Do not warn
645 unless in a declaration.
647 2020-06-17 Jason Merrill <jason@redhat.com>
649 * cp-tree.h (copy_fndecl_with_name): Declare.
650 * class.c (copy_fndecl_with_name): Split out from...
651 (build_clone): ...here.
652 (add_implicitly_declared_members): Add op== to TYPE_FIELDS.
653 * method.c (implicitly_declare_fn): Use copy_fndecl_with_name.
655 2020-06-17 Jason Merrill <jason@redhat.com>
657 * call.c (build_new_op_1): Don't look for a CALL_EXPR when
658 calling a consteval function.
660 2020-06-17 Jason Merrill <jason@redhat.com>
662 * decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED.
663 * decl.c (duplicate_decls): Reduce error for delete
664 after earlier declaration to pedwarn.
666 2020-06-17 Marek Polacek <polacek@redhat.com>
669 * constexpr.c (maybe_fold_non_dependent_expr): New.
670 * cp-tree.h (maybe_fold_non_dependent_expr): Declare.
671 * typeck.c (cp_build_array_ref): Call maybe_fold_non_dependent_expr
672 instead of maybe_constant_value.
674 2020-06-16 Marek Polacek <polacek@redhat.com>
677 * call.c (add_list_candidates): Return if a designated initializer
678 is used with a non-aggregate.
679 (implicit_conversion_error): Give an error for the case above.
681 2020-06-16 Marek Polacek <polacek@redhat.com>
684 * name-lookup.c (check_local_shadow): Check if types are
685 non-null before calling same_type_p.
687 2020-06-16 Jakub Jelinek <jakub@redhat.com>
689 * semantics.c (handle_omp_for_class_iterator): Adjust
690 c_omp_check_loop_iv_exprs caller.
691 (finish_omp_for): Likewise. Don't call fold_build_cleanup_point_expr
692 before calling c_finish_omp_for and c_omp_check_loop_iv, move it
694 * pt.c (tsubst_omp_for_iterator): Handle non-rectangular loops.
696 2020-06-16 Jakub Jelinek <jakub@redhat.com>
698 * parser.c (cp_parser_omp_clause_schedule): Reject modifier separated
699 from kind by comma rather than colon.
701 2020-06-16 Patrick Palka <ppalka@redhat.com>
703 * pt.c (perform_instantiation_time_access_checks): No need to
705 * semantics.c (enforce_access): Verify that decl is not
708 2020-06-16 Patrick Palka <ppalka@redhat.com>
712 * cp-tree.h (qualified_typedef_usage_s): Delete.
713 (qualified_typedef_usage_t): Delete.
714 (deferred_access_check): Move up in file.
715 (tree_template_info::typedefs_needing_access_checking): Delete.
716 (tree_template_info::deferred_access_checks): New field.
717 (TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Rename to ...
718 (TI_DEFERRED_ACCESS_CHECKS): ... this, and adjust accordingly.
719 * pt.c (perform_typedefs_access_check): Rename to ...
720 (perform_instantiation_time_access_checks): ... this, and adjust
721 accordingly. Remove unnecessary tree tests.
722 (instantiate_class_template_1): Adjust accordingly.
723 (instantiate_decl): Likewise.
724 * semantics.c (enforce_access): Likewise.
726 2020-06-16 Patrick Palka <ppalka@redhat.com>
730 * call.c (enforce_access): Move to semantics.c.
731 * cp-tree.h (enforce_access): Delete.
732 (get_types_needing_access_check): Delete.
733 (add_typedef_to_current_template_for_access_check): Delete.
734 * decl.c (make_typename_type): Adjust accordingly. Use
735 check_accessibility_of_qualified_id instead of directly using
736 perform_or_defer_access_check.
737 * parser.c (cp_parser_template_declaration_after_parameters):
738 Don't push a dk_no_check access state when parsing a template.
739 * pt.c (get_types_needing_access_check): Delete.
740 (append_type_to_template_for_access_check_1): Delete.
741 (perform_typedefs_access_check): Adjust. If type_decl is a
742 FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
743 tsubst_copy instead of tsubst to substitute into type_decl so
744 that we substitute into the DECL_CONTEXT of a FIELD_DECL.
745 (append_type_to_template_for_access_check): Delete.
746 * search.c (accessible_p): Remove the processing_template_decl
748 * semantics.c (enforce_access): Moved from call.c. If we're
749 parsing a template and the access check failed, add the check to
750 TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
751 (perform_or_defer_access_check): Adjust comment.
752 (add_typedef_to_current_template_for_access_check): Delete.
753 (check_accessibility_of_qualified_id): Adjust accordingly.
754 Exit early if the scope is dependent.
756 2020-06-11 Patrick Palka <ppalka@redhat.com>
759 * constraint.cc (associate_classtype_constraints): If there is a
760 discrepancy between the current template depth and the template
761 depth of the original declaration, then adjust the template
762 parameter depth within the current constraints appropriately.
763 * pt.c (tsubst_friend_class): Substitute into and set the
764 constraints on the injected declaration.
766 2020-06-11 Iain Sandoe <iain@sandoe.co.uk>
768 * coroutines.cc (instantiate_coro_traits): Pass a reference
769 to lambda closure objects to traits instantiation.
770 (morph_fn_to_coro): Likewise for promise parameter
771 preview and allocator lookup.
773 2020-06-10 Iain Sandoe <iain@sandoe.co.uk>
776 * call.c (add_candidates): Use vec_safe_length() for
777 testing the arguments list.
778 (build_new_method_call_1): Use vec_safe_is_empty() when
779 checking for an empty args list.
781 2020-06-10 Marek Polacek <polacek@redhat.com>
784 * parser.c (cp_parser_direct_declarator): Clear
785 CP_PARSER_FLAGS_DELAY_NOEXCEPT if the declarator kind is not
788 2020-06-09 Iain Sandoe <iain@sandoe.co.uk>
791 * coroutines.cc (expand_one_await_expression): Build separate
792 DTOR trees for the awaitable object on the destroy and resume
795 2020-06-09 Jason Merrill <jason@redhat.com>
798 * cp-gimplify.c (predeclare_vla): Only predeclare a VLA if it's
799 wrapped in a pointer type.
801 2020-06-05 Marek Polacek <polacek@redhat.com>
804 * call.c (build_converted_constant_expr_internal): Allow
807 2020-06-05 Iain Sandoe <iain@sandoe.co.uk>
809 * cp-tree.def (CO_RETURN_EXPR): Correct the class
810 to use tcc_statement.
812 2020-06-05 Jason Merrill <jason@redhat.com>
814 * error.c (dump_binary_op): Handle negative operand to
817 2020-06-04 Jason Merrill <jason@redhat.com>
820 * constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
821 Evaluate OBJ_TYPE_REF_EXPR.
823 2020-06-04 Jason Merrill <jason@redhat.com>
826 * class.c (lookup_vfn_in_binfo): New.
827 * call.c (build_over_call): Use it.
828 * cp-tree.h (resolves_to_fixed_type_p): Add default argument.
829 (lookup_vfn_in_binfo): Declare.
831 2020-06-04 Iain Sandoe <iain@sandoe.co.uk>
834 * coroutines.cc (morph_fn_to_coro): Ensure that the get-
835 return-object is constructed correctly; When it is not the
836 final return value, pass it to the CTOR of the return type
837 as an rvalue, per the standard comment.
839 2020-06-04 Jakub Jelinek <jakub@redhat.com>
843 * constexpr.c (cxx_eval_constant_expression): Diagnose CONVERT_EXPR
844 conversions from pointer types to arithmetic types here...
845 (cxx_eval_outermost_constant_expr): ... instead of here.
847 2020-06-03 Mark Wielaard <mark@klomp.org>
849 * parser.c (cp_lexer_safe_previous_token): New function.
850 (cp_parser_error_1): Add name_hint if the previous token is
851 a string literal and next token is a CPP_NAME and we have a
852 missing header suggestion for the name.
854 2020-06-03 Patrick Palka <ppalka@redhat.com>
856 * pt.c (process_partial_specialization): Pass the full set of
857 generic template arguments to strictly_subsumes.
859 2020-06-03 Patrick Palka <ppalka@redhat.com>
862 * pt.c (most_specialized_partial_spec): Reorganize the loop over
863 DECL_TEMPLATE_SPECIALIZATIONS. Check constraints_satisfied_p on
864 the original template declaration, not on the tsubsted one.
866 2020-06-03 Iain Sandoe <iain@sandoe.co.uk>
869 * coroutines.cc (finish_co_await_expr): Revise to allow for
871 (finish_co_yield_expr): Likewise.
873 2020-06-03 Jason Merrill <jason@redhat.com>
876 * cp-tree.h (predeclare_vla): Declare.
877 * cp-gimplify.c (predeclare_vla): Handle getting a decl.
878 * pt.c (tsubst_expr) [DECL_EXPR]: Use it.
880 2020-06-03 Tobias Burnus <tobias@codesourcery.com>
882 * cp-gimplify.c (cxx_omp_predetermined_mapping): New.
883 * cp-objcp-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redfine.
884 * cp-tree.h (cxx_omp_predetermined_mapping): Declare.
886 2020-06-02 Jason Merrill <jason@redhat.com>
889 * pt.c (tsubst_decl): Relax assert.
891 2020-06-02 Iain Sandoe <iain@sandoe.co.uk>
894 * coroutines.cc (build_co_await): Wrap the co_await expression
895 in a TARGET_EXPR, where needed.
896 (finish_co_yield_expr): Likewise.
898 2020-06-02 Patrick Palka <ppalka@redhat.com>
902 * pt.c (tsubst_function_decl): Don't do set_constraints when
903 regenerating a lambda.
904 (tsubst_lambda_expr): Substitute into the lambda's constraints
905 and do set_constraints here.
907 2020-06-01 Jason Merrill <jason@redhat.com>
912 * class.c (build_vfn_ref): Revert 95311 change.
913 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): Build a
916 2020-06-01 Iain Sandoe <iain@sandoe.co.uk>
919 * coroutines.cc (struct param_info): Remove rv_ref field.
920 (build_actor_fn): Remove specifial rvalue ref handling.
921 (morph_fn_to_coro): Likewise.
923 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
926 * coroutines.cc (morph_fn_to_coro): If we see an
927 early fatal error, drop the erroneous function body.
929 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
931 * coroutines.cc (build_co_await): Remove unused
933 (finish_co_await_expr): Likewise.
934 (finish_co_yield_expr): Likewise; revise comment.
936 2020-05-30 Iain Sandoe <iain@sandoe.co.uk>
938 * coroutines.cc (morph_fn_to_coro): Revise initialization
939 of the frame pointer to avoid an unused value.
941 2020-05-30 Patrick Palka <ppalka@redhat.com>
944 * constraint.cc (satisfaction_value): Accept INTEGER_CST of any
947 2020-05-29 Patrick Palka <ppalka@redhat.com>
948 Jason Merrill <jason@redhat.com>
951 * class.c (add_method): Let special member function templates
952 coexist if they are not equivalently constrained, or in a class
955 2020-05-29 Jason Merrill <jason@redhat.com>
958 * pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
959 on the DECL_TEMPLATE_RESULT.
961 2020-05-29 Marek Polacek <polacek@redhat.com>
964 * cp-gimplify.c (cp_fold) <case MODIFY_EXPR>: Don't set
965 TREE_THIS_VOLATILE here.
966 (cp_fold): Set it here along with TREE_NO_WARNING.
968 2020-05-29 Jason Merrill <jason@redhat.com>
972 * class.c (build_vfn_ref): Don't fold the INDIRECT_REF.
974 2020-05-29 Patrick Palka <ppalka@redhat.com>
979 * parser.c (cp_parser_requires_clause_expression): Temporarily
980 increment processing_template_decl only if it is 0.
981 (cp_parser_constraint_expression): Likewise.
982 (cp_parser_requires_expression): Likewise.
984 2020-05-29 Patrick Palka <ppalka@redhat.com>
987 * constexpr.c (get_or_insert_ctor_field): Add limited support
988 for RANGE_EXPR index lookups.
990 2020-05-28 Jakub Jelinek <jakub@redhat.com>
993 * decl.c (cp_finish_decomp): Call complete_type before checking
996 2020-05-28 Jason Merrill <jason@redhat.com>
999 * decl.c (cp_finish_decl): Revert r9-297 change.
1000 (check_static_variable_definition): Likewise.
1001 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
1002 * pt.c (instantiate_decl): Return early on type error.
1004 2020-05-27 Jason Merrill <jason@redhat.com>
1007 * decl.c (reshape_init_array_1): Don't reuse in overload context.
1009 2020-05-27 Jason Merrill <jason@redhat.com>
1012 * call.c (build_new_op_1): Suppress
1013 warn_zero_as_null_pointer_constant across comparison of <=> result
1016 2020-05-27 Jason Merrill <jason@redhat.com>
1019 * decl.c (grokdeclarator): Don't shift attributes in TYPENAME
1022 2020-05-27 Nathan Sidwell <nathan@acm.org>
1025 * pt.c (lookup_template_class_1): Restore alias template mutation.
1027 2020-05-26 Jakub Jelinek <jakub@redhat.com>
1030 * cp-gimplify.c: Include omp-general.h.
1031 (cp_genericize_r) <case OMP_DISTRIBUTE>: For class iteration
1032 variables in composite distribute parallel for, instantiate copy
1033 ctor of their types.
1035 2020-05-23 Patrick Palka <ppalka@redhat.com>
1038 * constexpr.c (cxx_eval_constant_expression)
1039 <case TEMPLATE_ID_EXPR>: Don't evaluate the concept when
1040 constexpr evaluation is uid-sensitive.
1042 2020-05-22 Jason Merrill <jason@redhat.com>
1044 * cp-gimplify.c (cp_gimplify_expr) [CALL_EXPR]: Don't preevaluate
1045 the function address if the call used operator syntax.
1047 2020-05-21 Jason Merrill <jason@redhat.com>
1050 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): For a virtual
1051 call, instrument the OBJ_TYPE_REF.
1053 * decl.c (compute_array_index_type_loc): Diagnose expressions
1054 in a template that can't be constant.
1055 * parser.c (cp_parser_direct_declarator): Don't check
1056 non-constant array bounds here.
1058 * cp-tree.h (is_rvalue_constant_expression): Declare.
1059 * constexpr.c (is_rvalue_constant_expression): New.
1060 * parser.c (cp_parser_constant_expression): Use it.
1061 * decl.c (cp_finish_decl): Try to treat a constexpr initializer in a
1062 template as constant.
1064 * typeck.c (build_x_modify_expr): Handle error_mark_node arguments.
1066 * decl.c (grokparms): Return NULL_TREE if any parms were erroneous.
1068 2020-05-21 Iain Sandoe <iain@sandoe.co.uk>
1070 * coroutines.cc (finish_co_return_stmt): Revert change to use
1073 2020-05-21 Patrick Palka <ppalka@redhat.com>
1076 * constexpr.c (constexpr_ctx::uid_sensitive): Remove field.
1077 (uid_sensitive_constexpr_evaluation_value): Define.
1078 (uid_sensitive_constexpr_evaluation_true_counter): Define.
1079 (uid_sensitive_constexpr_evaluation_p): Define.
1080 (uid_sensitive_constexpr_evaluation_sentinel): Define its
1082 (uid_sensitive_constexpr_evaluation_checker): Define its
1083 constructor and its evaluation_restricted_p method.
1084 (get_fundef_copy): Remove 'ctx' parameter. Use u_s_c_e_p
1085 instead of constexpr_ctx::uid_sensitive.
1086 (cxx_eval_call_expression): Use u_s_c_e_p instead, and test it
1087 last. Adjust call to get_fundef_copy.
1088 (instantiate_cx_fn_r): Test u_s_c_e_p so that we increment the
1089 counter if necessary.
1090 (cxx_eval_outermost_constant_expr): Remove 'uid_sensitive'
1091 parameter. Adjust function body accordingly.
1092 (maybe_constant_value): Remove 'uid_sensitive' parameter and
1093 adjust function body accordingly. Set up a
1094 uid_sensitive_constexpr_evaluation_checker, and use it to
1095 conditionally update the cv_cache.
1096 * cp-gimplify.c (cp_fold): Set up a
1097 uid_sensitive_constexpr_evaluation_checker, and use it to
1098 conditionally update the fold_cache.
1099 * cp-tree.h (maybe_constant_value): Update declaration.
1100 (struct uid_sensitive_constexpr_evaluation_sentinel): Define.
1101 (struct sensitive_constexpr_evaluation_checker): Define.
1102 * expr.c (fold_for_warn): Set up a
1103 uid_sensitive_constexpr_evaluation_sentinel before calling
1104 the folding subroutines. Drop all but the first argument to
1105 maybe_constant_value.
1107 2020-05-20 Marek Polacek <polacek@redhat.com>
1110 * parser.c (cp_parser_unqualified_id): Reject simple-template-id as
1111 the declarator-id of a destructor.
1112 (cp_parser_constructor_declarator_p): Reject simple-template-id as
1113 the declarator-id of a constructor.
1115 2020-05-20 Marek Polacek <polacek@redhat.com>
1119 * cp-tree.h (SD_DECOMPOSITION): New flag.
1120 * decl.c (duplicate_decls): Make sure a structured binding is unique
1121 in its declarative region.
1122 (start_decl): If INITIALIZED is SD_DECOMPOSITION, call
1123 fit_decomposition_lang_decl.
1124 (grokdeclarator): Compare INITIALIZED directly to SD_* flags.
1125 * parser.c (cp_parser_decomposition_declaration): Pass SD_DECOMPOSITION
1128 2020-05-20 Patrick Palka <ppalka@redhat.com>
1131 * typeck.c (structural_comptypes): Don't perform
1132 context-dependent resolution of TYPENAME_TYPEs when
1133 comparing_specializations.
1135 2020-05-19 Nathan Sidwell <nathan@acm.org>
1137 * pt.c (lookup_template_class_1): Do not reinit template_info of an
1140 2020-05-18 Martin Sebor <msebor@redhat.com>
1143 * call.c ((maybe_warn_class_memaccess): Use is_byte_access_type.
1144 * cp-tree.h (is_dummy_object): Return bool.
1145 (is_byte_access_type): Declare new function.
1146 * tree.c (is_dummy_object): Return bool.
1147 (is_byte_access_type): Define new function.
1149 2020-05-19 Patrick Palka <ppalka@redhat.com>
1152 * pt.c (init_template_processing): Enable sanitization for
1153 decl_specializations and type_specializations.
1156 * pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
1157 the 'in_decl' parameter to coerce_template_parms.
1159 2020-05-18 Marek Polacek <polacek@redhat.com>
1162 * typeck.c (cp_build_binary_op): Use fold_for_warn instead of
1165 2020-05-18 Marek Polacek <polacek@redhat.com>
1168 * cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
1169 type is not INDIRECT_TYPE_P.
1170 * decl.c (omp_declare_variant_finalize_one): Call
1171 cp_get_callee_fndecl_nofold instead of looking for the function decl
1174 2020-05-18 Marek Polacek <polacek@redhat.com>
1177 * parser.c (cp_parser_has_attribute_expression): Sorry on a
1178 type-dependent argument.
1180 2020-05-18 Marek Polacek <polacek@redhat.com>
1184 * call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
1185 operator functions when type is std::nullptr_t for ==/!=.
1186 * typeck.c (composite_pointer_type_r): Add a bool * parameter. Use it
1187 to maybe add "const" to the pointer type.
1188 (composite_pointer_type): Update the call to composite_pointer_type_r.
1189 (cp_build_binary_op): Turn two warning_at into error_at. Print the
1192 2020-05-18 Jason Merrill <jason@redhat.com>
1194 * call.c (build_over_call): Remove unnecessary
1195 cp_stabilize_reference.
1197 2020-05-18 Marek Polacek <polacek@redhat.com>
1199 * call.c (add_builtin_candidate): Don't create a builtin overload
1200 candidate for ++ when type is bool in C++17.
1202 2020-05-18 Marek Polacek <polacek@redhat.com>
1204 * cfns.h: Regenerated.
1206 2020-05-17 Iain Sandoe <iain@sandoe.co.uk>
1208 * coroutines.cc (morph_fn_to_coro): Initialize the gro variable.
1210 2020-05-16 Iain Sandoe <iain@sandoe.co.uk>
1212 * coroutines.cc (finish_co_return_stmt): Implement rules
1213 from [class.copy.elision] /3.
1215 2020-05-16 Patrick Palka <ppalka@redhat.com>
1218 * semantics.c (finish_decltype_type): Call
1219 instantiate_non_dependent_expr_sfinae on the expression.
1221 2020-05-15 Patrick Palka <ppalka@redhat.com>
1225 2020-04-07 Patrick Palka <ppalka@redhat.com>
1228 * typeck2.c (process_init_constructor_array): Propagate
1229 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
1230 the array initializer.
1232 2020-05-15 Jason Merrill <jason@redhat.com>
1234 PR c++/93286 - ICE with __is_constructible and variadic template.
1235 * pt.c (tsubst_tree_list): New.
1236 (tsubst, tsubst_copy_and_build): Use it.
1237 * decl2.c (is_late_template_attribute): Handle error_mark_node args.
1239 2020-05-15 Nathan Sidwell <nathan@acm.org>
1241 * pt.c (template_args_equal): Fix thinkos in previous 'cleanup'.
1243 2020-05-14 Jason Merrill <jason@redhat.com>
1246 * pt.c (maybe_instantiate_noexcept): Change clone handling.
1248 2020-05-14 Patrick Palka <ppalka@redhat.com>
1251 * call.c (build_op_call): Pass complain to lookup_fnfields.
1252 (build_special_member_call): Likewise.
1253 * class.c (type_requires_array_cookie): Pass tf_warning_or_error
1255 * cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter.
1256 * except.c (build_throw): Pass tf_warning_or_error to
1258 * init.c (build_new_1): Pass complain to lookup_fnfields.
1259 * method.c (locate_fn_flags): Likewise.
1260 * name-lookup.c (lookup_name_real_1): Pass tf_warning_or_error
1262 * pt.c (tsubst_baselink): Pass complain to lookup_fnfields.
1263 * search.c (lookup_fnfields): New 'complain' parameter. Pass it
1266 2020-05-14 Nathan Sidwell <nathan@acm.org>
1268 * parser.c (cp_parser_diagnose_invalid_typename): Mention
1269 std=c++20 not 2a, reformat dependent binfo inform loops.
1271 * pt.c (tsubst_template_decl): Reorder and commonize some control
1274 * pt.c (tsubst_friend_function): Simplify control flow.
1276 * pt.c (lookup_template_class_1): Remove unnecessary else by
1277 simply grabbing TYPE_NAME earlier.
1279 * pt.c (push_template_decl_real): Adjust friend pushing logic.
1280 Reinit template type.
1282 * pt.c (build_template_decl): Init DECL_TEMPLATE_RESULT &
1284 (process_partial_specialization): ... not here ...
1285 (push_template_decl_real, add_inherited_template_parms)
1286 (build_deduction_guide): ... or here.
1288 2020-05-14 Jakub Jelinek <jakub@redhat.com>
1290 * cp-gimplify.c (cp_genericize_r): Set cfun->has_omp_target.
1292 2020-05-13 Patrick Palka <ppalka@redhat.com>
1295 * init.c (build_vec_delete_1): Just return error_mark_node if
1296 deallocate_expr is error_mark_node.
1297 (build_delete): Just return error_mark_node if do_delete is
1300 2020-05-13 Patrick Palka <ppalka@redhat.com>
1303 * constraint.cc (tsubst_requires_expr): Produce a new
1304 requires-expression when processing_template_decl, even if
1305 template arguments are not dependent.
1307 2020-05-13 Marek Polacek <polacek@redhat.com>
1310 * decl.c (duplicate_decls): Set DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.
1312 2020-05-13 Nathan Sidwell <nathan@acm.org>
1314 * pt.c (template_args_equal): Reorder category checking for
1317 * pt.c (perform_typedefs_access_check): Cache expensively
1318 calculated object references.
1319 (check_auto_in_tmpl_args): Just assert we do not get unexpected
1320 nodes, rather than silently do nothing.
1321 (append_type_to_template_for_access): Likewise, cache expensie
1324 * pt.c (canonical_type_parameter): Simplify.
1326 Formatting fixups & some simplifications.
1327 * pt.c (spec_hash_table): New typedef.
1328 (decl_specializations, type_specializations): Use it.
1329 (retrieve_specialization): Likewise.
1330 (register_specialization): Remove unnecessary casts.
1331 (push_template_decl_real): Reformat.
1332 (instantiate_class_template_1): Use more RAII.
1333 (make_argument_pack): Simplify.
1334 (instantiate_template_1): Use gcc_checking_assert for expensive
1336 (instantiate_decl): Likewise.
1337 (resolve_typename_type): Reformat comment.
1338 * semantics.c (struct deferred_access): Remove unnecessary GTY on
1340 (begin_class_definition): Fix formatting.
1342 2020-05-13 Jason Merrill <jason@redhat.com>
1344 * call.c, class.c, constexpr.c, constraint.cc, decl.c, init.c,
1345 lambda.c, lex.c, method.c, name-lookup.c, parser.c, pt.c, tree.c,
1346 typeck2.c: Change cxx2a to cxx20.
1348 2020-05-12 Marek Polacek <polacek@redhat.com>
1351 * parser.c (cp_parser_postfix_expression) <case CPP_OPEN_PAREN>: When
1352 looking for a block-scope function declaration, look through the whole
1353 set, not just the first function in the overload set.
1355 2020-05-12 Jakub Jelinek <jakub@redhat.com>
1358 * pt.c (tsubst_decl): Deal with DECL_OMP_PRIVATIZED_MEMBER for
1361 2020-05-11 Jason Merrill <jason@redhat.com>
1363 Resolve C++20 NB comment CA104
1364 * pt.c (determine_specialization): Compare constraints for
1365 specialization of member template of class instantiation.
1367 2020-05-11 Jason Merrill <jason@redhat.com>
1371 * tree.c (cp_walk_subtrees): Stop at typedefs.
1372 Handle TYPENAME_TYPE here.
1373 * pt.c (find_parameter_packs_r): Not here.
1374 (for_each_template_parm_r): Clear *walk_subtrees.
1375 * decl2.c (min_vis_r): Look through typedefs.
1377 2020-05-11 Jason Merrill <jason@redhat.com>
1379 * call.c (implicit_conversion_error): Split out from...
1380 (perform_implicit_conversion_flags): ...here.
1381 (build_converted_constant_expr_internal): Use it.
1383 2020-05-11 Jason Merrill <jason@redhat.com>
1386 * parser.c (inject_parm_decls): Set current_class_ptr here.
1387 (cp_parser_direct_declarator): And here.
1388 (cp_parser_late_return_type_opt): Not here.
1389 (cp_parser_noexcept_specification_opt): Nor here.
1390 (cp_parser_exception_specification_opt)
1391 (cp_parser_late_noexcept_specifier): Remove unneeded parameters.
1393 2020-05-11 Jason Merrill <jason@redhat.com>
1395 * decl.c (cxx_init_decl_processing): Call declare_weak for
1398 2020-05-11 Jason Merrill <jason@redhat.com>
1400 * pt.c (instantiate_class_template_1): Call tsubst_expr for
1401 STATIC_ASSERT member.
1402 * ptree.c (cxx_print_xnode): Handle STATIC_ASSERT.
1404 2020-05-11 Jason Merrill <jason@redhat.com>
1406 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Remove redundant
1407 walking of capture list.
1409 2020-05-11 Jason Merrill <jason@redhat.com>
1411 * cp-tree.h (LOOKUP_EXPLICIT_TMPL_ARGS): Remove.
1412 * call.c (build_new_function_call): Don't set it.
1413 (build_new_method_call_1): Likewise.
1414 (build_over_call): Check cand->explicit_targs instead.
1416 2020-05-11 Jason Merrill <jason@redhat.com>
1418 * decl.c (compute_array_index_type_loc): Stabilize before building
1421 2020-05-11 Jason Merrill <jason@redhat.com>
1423 * decl.c (grokdeclarator): Adjust deprecated_state here.
1424 (start_decl): Not here.
1426 2020-05-08 Iain Sandoe <iain@sandoe.co.uk>
1429 * coroutines.cc (build_actor_fn): Ensure that bind scopes
1430 are marked as having side-effects where necessary.
1431 (replace_statement_captures): Likewise.
1432 (morph_fn_to_coro): Likewise.
1434 2020-05-08 Nathan Sidwell <nathan@acm.org>
1436 * NEWS: Delete, it is so stale.
1438 * parser.c (cp_lexer_set_source_position_from_token): EOF has a
1441 2020-05-07 Iain Sandoe <iain@sandoe.co.uk>
1445 * coroutines.cc (morph_fn_to_coro): Set unformed outline
1446 functions to error_mark_node. For early error returns suppress
1447 warnings about missing ramp return values. Fix reinstatement
1448 of the function body on pre-existing initial error.
1449 * decl.c (finish_function): Use the normal error path for fails
1450 in the ramp function, do not try to compile the helpers if the
1453 2020-05-07 Marek Polacek <polacek@redhat.com>
1455 PR c++/94590 - Detect long double -> double narrowing.
1456 * typeck2.c (check_narrowing): Detect long double -> double
1457 narrowing even when double and long double have the same
1458 precision. Make it handle conversions to float too.
1460 2020-05-07 Marek Polacek <polacek@redhat.com>
1463 * parser.c (cp_parser_class_specifier_1): Check that the scope is
1464 nested inside current scope before pushing it.
1466 2020-05-07 Marek Polacek <polacek@redhat.com>
1469 * typeck2.c (check_narrowing): Consider T* to bool narrowing
1472 2020-05-07 Marek Polacek <polacek@redhat.com>
1474 * decl.c (grok_op_properties): Fix spelling of non-static.
1475 * typeck.c (build_class_member_access_expr): Likewise.
1477 2020-05-07 Richard Biener <rguenther@suse.de>
1480 * optimize.c (update_cloned_parm): Copy DECL_NOT_GIMPLE_REG_P.
1482 2020-05-06 Marek Polacek <polacek@redhat.com>
1485 * pt.c (tsubst_copy_and_build): Call type_dependent_expression_p_push
1486 instead of uses_template_parms. Move the warning_sentinels after the
1489 2020-05-06 Jakub Jelinek <jakub@redhat.com>
1492 * typeck.c (cp_strict_aliasing_warning): New function.
1493 (cp_build_indirect_ref_1, build_reinterpret_cast_1): Use
1494 it instead of strict_aliasing_warning.
1497 * method.c (defaulted_late_check): Don't call synthesize_method
1498 on constexpr sfk_comparison if it has been called on it already.
1500 2020-05-06 Nathan Sidwell <nathan@acm.org>
1503 * decl.c (grokdeclarator): Don't splice template attributes in
1504 parm context -- they can apply to the parm.
1506 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
1508 * coroutines.cc: Remove references to n4849 throughout.
1510 2020-05-05 Jason Merrill <jason@redhat.com>
1513 * pt.c (more_specialized_fn): Do consider parms with no deducible
1514 template parameters.
1516 2020-05-05 Jason Merrill <jason@redhat.com>
1519 * constexpr.c (potential_constant_expression_1): In a lambda
1520 function, consider a captured variable directly.
1522 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
1524 * coroutines.cc (transform_await_wrapper): Check that we have
1525 no unlowered co_yields.
1526 (captures_temporary): Likewise.
1527 (register_awaits): Likewise.
1529 2020-05-05 Nathan Sidwell <nathan@acm.org>
1532 * coroutines.cc (morph_fn_to_coro): Just check for
1534 * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name.
1536 2020-05-05 Marek Polacek <polacek@redhat.com>
1537 Jason Merrill <jason@redhat.com>
1540 * parser.c (cp_parser_postfix_dot_deref_expression): If we have
1541 a type-dependent object of class type, stash it to
1542 parser->context->object_type. If the postfix expression doesn't have
1544 (cp_parser_class_name): Consider object scope too.
1545 (cp_parser_lookup_name): Remove code dealing with the case when
1546 object_type is unknown_type_node.
1548 2020-05-04 Patrick Palka <ppalka@redhat.com>
1551 * cp-gimplify.c (cp_fold) <case CALL_EXPR>: Move some variable
1552 declarations closer to their uses. Copy the CALL_EXPR only
1553 when one of its arguments has changed.
1554 <case TREE_VEC>: Instead of first collecting the folded
1555 arguments into a releasing_vec, just make a copy of the TREE_VEC
1556 as soon as folding changes one of its arguments.
1558 2020-05-04 Iain Sandoe <iain@sandoe.co.uk>
1560 * coroutines.cc (morph_fn_to_coro): Mark the coro.gro variable
1561 as artificial and ignored.
1563 2020-05-04 Nathan Sidwell <nathan@acm.org>
1565 pt.c (process_template_parm): Don't walk the template list twice,
1566 remember the final node instead.
1567 (end_template_parm_list): Refactor. Comment on why we do a pop
1570 PR c++/94827 -- don't save parms in nested requirement
1571 * constraint.cc (tsubst_nested_requirement): TYPE directly holds
1572 notmalized requirement.
1573 (finish_nested_requirement): Don't stash current tpl parms into
1575 (diagnose_nested_requirement): TYPE directly holds notmalized
1578 2020-05-01 Patrick Palka <ppalka@redhat.com>
1581 * cp-tree.h (check_accessibility_of_qualified_id): Add
1582 tsubst_flags_t parameter and change return type to bool.
1583 * parser.c (cp_parser_lookup_name): Pass tf_warning_to_error to
1584 check_accessibility_of_qualified_id.
1585 * pt.c (tsubst_qualified_id): Return error_mark_node if
1586 check_accessibility_of_qualified_id returns false.
1587 * semantics.c (check_accessibility_of_qualified_id): Add
1588 complain parameter. Pass complain instead of
1589 tf_warning_or_error to perform_or_defer_access_check. Return
1590 true unless perform_or_defer_access_check returns false.
1592 2020-05-01 Marek Polacek <polacek@redhat.com>
1595 * typeck2.c (process_init_constructor_record): Return PICFLAG_ERRONEOUS
1596 if an initializer element was erroneous.
1598 2020-05-01 Jason Merrill <jason@redhat.com>
1601 * init.c (get_nsdmi): Don't push_to_top_level for a local class.
1603 2020-05-01 Jason Merrill <jason@redhat.com>
1606 * decl.c (cp_finish_decl): Also clear TREE_READONLY if
1607 -fmerge-all-constants.
1609 2020-05-01 Jason Merrill <jason@redhat.com>
1612 * pt.c (tsubst_decl): Make sure DECL_VALUE_EXPR continues to have
1613 the same type as the variable.
1615 2020-04-30 Jason Merrill <jason@redhat.com>
1616 Nathan Sidwell <nathan@acm.org>
1619 * constraint.cc (map_arguments): If ARGS is null, it's a
1620 self-mapping of parms.
1621 (finish_nested_requirement): Do not pass argified
1622 current_template_parms to normalization.
1623 (tsubst_nested_requirement): Don't assert no template parms.
1625 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
1628 * coroutines.cc (transform_local_var_uses): Defer walking
1629 the DECL_INITIALs of BIND_EXPR vars until all the frame
1630 allocations have been made.
1632 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
1635 * coroutines.cc (register_awaits): Update target
1636 expressions for awaitable and suspend handle
1639 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
1642 * coroutines.cc (build_co_await): Account for variables
1643 with DECL_VALUE_EXPRs.
1644 (captures_temporary): Likewise.
1645 (register_awaits): Likewise.
1647 2020-04-29 Patrick Palka <ppalka@redhat.com>
1650 * pt.c (find_template_parameter_info::parm_list): New field.
1651 (keep_template_parm): Use the new field to build up the
1652 parameter list here instead of ...
1653 (find_template_parameters): ... here. Return ftpi.parm_list.
1655 2020-04-29 Jakub Jelinek <jakub@redhat.com>
1658 * class.c (build_base_field): Set DECL_FIELD_ABI_IGNORED on C++17 empty
1659 base artificial FIELD_DECLs.
1660 (layout_class_type): Set DECL_FIELD_ABI_IGNORED on empty class
1661 field_poverlapping_p FIELD_DECLs.
1663 2020-04-29 Patrick Palka <ppalka@redhat.com>
1666 * constraint.cc (satisfy_declaration_constraints): Use saved_t
1667 instead of t as the key to decl_satisfied_cache.
1670 * error.c (print_requires_expression_info): Print the dependent
1671 form of the parameter list with its template parameter mapping,
1672 rather than printing the substituted form.
1674 2020-04-28 Jason Merrill <jason@redhat.com>
1677 * decl.c (use_eh_spec_block): Check nothrow type after
1679 * pt.c (maybe_instantiate_noexcept): Call synthesize_method for
1680 DECL_MAYBE_DELETED fns here.
1681 * decl2.c (mark_used): Not here.
1682 * method.c (get_defaulted_eh_spec): Reject DECL_MAYBE_DELETED here.
1684 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
1687 * coroutines.cc (instantiate_coro_traits): Pass a reference to
1688 object type rather than a pointer type for 'this', for method
1690 (struct param_info): Add a field to hold that the parm is a lambda
1692 (morph_fn_to_coro): Check for lambda closure pointers in the
1693 args. Use a reference to *this when building the args list for the
1694 promise allocator lookup.
1696 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
1699 * coroutines.cc (coro_promise_type_found_p): Do not
1700 exclude non-classes here (this needs to be handled in the
1702 (morph_fn_to_coro): Allow for the case where the coroutine
1705 2020-04-27 Iain Sandoe <iain@sandoe.co.uk>
1708 * coroutines.cc (struct local_var_info): Add fields for static
1709 variables and those with DECL_VALUE_EXPR redirection.
1710 (transform_local_var_uses): Skip past typedefs and static vars
1711 and then account for redirected variables.
1712 (register_local_var_uses): Likewise.
1714 2020-04-27 Jason Merrill <jason@redhat.com>
1718 * decl.c (grokdeclarator): Move dependent attribute to decl.
1719 * decl2.c (splice_template_attributes): No longer static.
1721 2020-04-27 Patrick Palka <ppalka@redhat.com>
1724 * constexpr.c (cxx_eval_call_expression): Don't set new_obj if we're
1725 evaluating the target constructor of a delegating constructor.
1726 (cxx_eval_store_expression): Don't set TREE_READONLY if the LHS of the
1727 INIT_EXPR is '*this'.
1729 2020-04-26 Marek Polacek <polacek@redhat.com>
1732 * call.c (struct conversion): Add copy_init_p.
1733 (standard_conversion): Set copy_init_p in ck_base and ck_rvalue
1734 if FLAGS demands LOOKUP_ONLYCONVERTING.
1735 (convert_like_real) <case ck_base>: If copy_init_p is set, or
1736 LOOKUP_ONLYCONVERTING into FLAGS.
1738 2020-04-26 Iain Sandoe <iain@sandoe.co.uk>
1741 * coroutines.cc (morph_fn_to_coro): Ensure that
1742 unnamed function params have a usable and distinct
1745 2020-04-24 Jason Merrill <jason@redhat.com>
1748 * decl.c (redeclaration_error_message): Reject defaulted comparison
1749 operator that has been previously declared.
1751 2020-04-25 Patrick Palka <ppalka@redhat.com>
1753 * parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
1754 concepts if the invalid identifier is 'requires'.
1756 2020-04-25 Jakub Jelinek <jakub@redhat.com>
1759 * semantics.c (finish_call_expr): When looking if all overloads
1760 are noreturn, use STRIP_TEMPLATE to look through TEMPLATE_DECLs.
1762 2020-04-24 Martin Liska <mliska@suse.cz>
1764 * coroutines.cc: Fix compilation error for release checking
1765 where we miss declaration of ‘coro_body_contains_bind_expr_p’.
1767 2020-04-23 Patrick Palka <ppalka@redhat.com>
1769 * tree.c (zero_init_expr_p): Use uses_template_parms instead of
1773 * pt.c (template_class_depth): Walk into the DECL_FRIEND_CONTEXT of a
1774 friend declaration rather than into its CP_DECL_CONTEXT.
1776 2020-04-23 Iain Sandoe <iain@sandoe.co.uk>
1779 * coroutines.cc (await_statement_expander): Simplify cases.
1780 (struct susp_frame_data): Add fields for truth and/or if
1781 cases, rename one field.
1782 (analyze_expression_awaits): New.
1783 (expand_one_truth_if): New.
1784 (add_var_to_bind): New helper.
1785 (coro_build_add_if_not_cond_break): New helper.
1786 (await_statement_walker): Handle conditional expressions,
1787 handle expansion of truth-and/or-if cases.
1788 (bind_expr_find_in_subtree): New, checking-only.
1789 (coro_body_contains_bind_expr_p): New, checking-only.
1790 (morph_fn_to_coro): Ensure that we have a top level bind
1793 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
1795 PR translation/94698
1796 * class.c (check_field_decls): Change "define" to "declare" in
1797 -Weffc++ diagnostics.
1799 2020-04-22 Patrick Palka <ppalka@redhat.com>
1803 * constraint.cc (satisfy_declaration_constraints): If the inherited
1804 constructor points to an instantiation of a constructor template,
1805 remember and use its attached template arguments.
1807 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
1809 PR translation/94698
1810 * class.c (check_field_decls): Change "override" to "define" in
1811 -Weffc++ diagnostics.
1813 2020-04-22 Iain Sandoe <iain@sandoe.co.uk>
1816 * coroutines.cc (struct param_info): Add a field to note that
1817 the param is 'this'.
1818 (morph_fn_to_coro): Convert this to a reference before using it
1819 in the promise parameter preview.
1821 2020-04-22 Jason Merrill <jason@redhat.com>
1824 * pt.c (register_parameter_specializations): If the instantiation is
1825 still a parameter pack, don't wrap it in a NONTYPE_ARGUMENT_PACK.
1826 (tsubst_pack_expansion, tsubst_expr): Adjust.
1828 2020-04-22 Martin Sebor <msebor@redhat.com>
1829 Jason Merrill <jason@redhat.com>
1832 * decl.c (reshape_init_array_1): Avoid stripping redundant trailing
1833 zero initializers...
1834 * mangle.c (write_expression): ...and handle them here even for
1835 pointers to members by calling zero_init_expr_p.
1836 * cp-tree.h (zero_init_expr_p): Declare.
1837 * tree.c (zero_init_expr_p): Define.
1838 (type_initializer_zero_p): Remove.
1839 * pt.c (tparm_obj_values): New hash_map.
1840 (get_template_parm_object): Store to it.
1841 (tparm_object_argument): New.
1843 2020-04-22 Patrick Palka <ppalka@redhat.com>
1846 * constraint.cc (diagnose_valid_expression): Check convert_to_void here
1847 as well as in tsubst_valid_expression_requirement.
1849 2020-04-21 Patrick Palka <ppalka@redhat.com>
1852 * constraint.cc (satisfy_declaration_constraints): Don't strip the
1853 inherited constructor if it already has template information.
1856 * pt.c (any_template_parm_r) <case IDENTIFIER_NODE>: New case. If this
1857 is a conversion operator, visit its TREE_TYPE.
1859 2020-04-21 Nathan Sidwell <nathan@acm.org>
1861 * pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for
1864 2020-04-21 Iain Sandoe <iain@sandoe.co.uk>
1867 * coroutines.cc (morph_fn_to_coro): Simplify return
1870 2020-04-17 Marek Polacek <polacek@redhat.com>
1873 * constexpr.c (cxx_eval_outermost_constant_expr): Return when T is
1874 a BRACE_ENCLOSED_INITIALIZER_P.
1875 (is_nondependent_constant_expression): Don't check
1876 BRACE_ENCLOSED_INITIALIZER_P.
1877 (is_nondependent_static_init_expression): Likewise.
1879 2020-04-20 Patrick Palka <ppalka@redhat.com>
1882 * cp-tree.h (lss_policy::lss_nop): New enumerator.
1883 * pt.c (local_specialization_stack::local_specialization_stack): Handle
1885 (local_specialization_stack::~local_specialization_stack): Likewise.
1886 (tsubst_pack_expansion): Use a local_specialization_stack instead of
1887 manually saving and restoring local_specializations. Conditionally
1888 replace local_specializations sooner, before the handling of the
1889 unsubstituted_packs case.
1891 2020-04-20 Marek Polacek <polacek@redhat.com>
1893 PR c++/94505 - bogus -Wparentheses warning with fold-expression.
1894 * pt.c (fold_expression): Add warning_sentinel for -Wparentheses
1895 before calling build_x_binary_op.
1897 2020-04-20 Marek Polacek <polacek@redhat.com>
1899 * coroutines.cc (captures_temporary): Don't assign the result of
1900 STRIP_NOPS to the same variable.
1902 2020-04-20 Nathan Sidwell <nathan@acm.org>
1904 PR c++/94454 - tpl-tpl-parms are not canonicalizable types
1905 * pt.c (canonical_type_parameter): Assert not a tpl-tpl-parm.
1906 (process_template_parm): tpl-tpl-parms are structural.
1907 (rewrite_template_parm): Propagate structuralness.
1909 PR c++/94454 - Expr pack expansion equality
1910 * tree.c (cp_tree_equal) [TEMPLATE_ID_EXPR, default]: Refactor.
1911 [EXPR_PACK_EXPANSION]: Add.
1913 PR c++/94454 Template Argument Hashing
1914 * pt.c (iterative_hash_template_arg): Strip nodes as
1915 template_args_equal does.
1916 [ARGUMENT_PACK_SELECT, TREE_VEC, CONSTRUCTOR]: Refactor.
1917 [node_class:TEMPLATE_TEMPLATE_PARM]: Hash by level & index.
1918 [node_class:default]: Refactor.
1920 2020-04-18 Patrick Palka <ppalka@redhat.com>
1923 * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
1924 comparing_specializations if the parameters' contexts are identical.
1927 * pt.c (splice_late_return_type): Propagate cv-qualifiers and
1928 PLACEHOLDER_TYPE_CONSTRAINTS from the original auto node to the new one.
1930 2020-04-17 Patrick Palka <ppalka@redhat.com>
1933 * lambda.c (lambda_capture_field_type): Avoid doing auto deduction if
1934 the explicit initializer has parameter packs.
1937 * parser.c (cp_parser_check_template_parameters): Before issuing a hard
1938 error, first try simulating an error instead.
1940 2020-04-17 Jakub Jelinek <jakub@redhat.com>
1943 * call.c (build_conditional_expr_1): Remove redundant assignment to
1946 2020-04-16 Patrick Palka <ppalka@redhat.com>
1949 * cvt.c (ocp_convert): If the result of scalar_constant_value is
1950 erroneous, ignore it and use the original expression.
1952 2020-04-16 Jakub Jelinek <jakub@redhat.com>
1955 * parser.c (cp_parser_simple_declaration): Fix up a pasto in
1958 2020-04-15 Jakub Jelinek <jakub@redhat.com>
1961 * parser.c (cp_parser_pragma) <case PRAGMA_OMP_REQUIRES>: Reject
1962 requires directive when not at file or namespace scope.
1964 2020-04-14 Iain Sandoe <iain@sandoe.co.uk>
1967 * coroutines.cc (build_actor_fn): Check that the target can
1968 support the resume tailcall before mandating it.
1970 2020-04-14 Patrick Palka <ppalka@redhat.com>
1973 * cxx-pretty-print.c (cxx_pretty_printer:simple_type_specifier)
1974 <case DECLTYPE_TYPE>: Handle DECLTYPE_TYPE here instead of ...
1975 (pp_cxx_type_specifier_seq) <case DECLTYPE_TYPE>: ... here.
1976 (cxx_pretty_printer::direct_abstract_declarator) <case DECLTYPE_TYPE>:
1980 * constexpr.c (replace_result_decl_data): New struct.
1981 (replace_result_decl_data_r): New function.
1982 (replace_result_decl): New function.
1983 (cxx_eval_call_expression): Use it.
1984 * tree.c (build_aggr_init_expr): Set the location of the AGGR_INIT_EXPR
1985 to that of its initializer.
1987 2020-04-13 Marek Polacek <polacek@redhat.com>
1990 * name-lookup.c (check_local_shadow): Add an inform call.
1992 2020-04-13 Patrick Palka <ppalka@redhat.com>
1995 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
1996 dump_function_decl when printing a function template instantiation as a
2000 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
2002 (cxx_eval_bare_aggregate): Use get_or_insert_ctor_field instead of
2003 assuming the the next index belongs at the end of the new CONSTRUCTOR.
2004 (cxx_eval_store_expression): Revert PR c++/78572 fix.
2006 2020-04-13 Nathan Sidwell <nathan@acm.org>
2008 PR c++/94426 lambdas with internal linkage are different to no-linkage
2009 * decl2.c (determine_visibility): A lambda's visibility is
2010 affected by its extra scope.
2011 * pt.c (instantiate_decl): Determine var's visibility before
2012 instantiating its initializer.
2013 * tree.c (no_linkage_check): Revert code looking at visibility of
2014 lambda's extra scope.
2016 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
2019 * coroutines.cc (co_await_expander): Remove.
2020 (expand_one_await_expression): New.
2021 (process_one_statement): New.
2022 (await_statement_expander): New.
2023 (build_actor_fn): Revise to use per-statement expander.
2024 (struct susp_frame_data): Reorder and comment.
2025 (register_awaits): Factor code.
2026 (replace_statement_captures): New, factored from...
2027 (maybe_promote_captured_temps):.. here.
2028 (await_statement_walker): Revise to process per statement.
2029 (morph_fn_to_coro): Use revised susp_frame_data layout.
2031 2020-04-10 Marek Polacek <polacek@redhat.com>
2034 * method.c (constructible_expr): In C++20, try using parenthesized
2035 initialization of aggregates to determine the result of
2038 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
2040 * coroutines.cc (co_await_expander): Simplify.
2042 2020-04-09 Jason Merrill <jason@redhat.com>
2045 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
2046 ctx->object and ctx->global->values first.
2048 2020-04-09 Marek Polacek <polacek@redhat.com>
2051 * call.c (initialize_reference): If the reference binding failed, maybe
2052 try initializing from { }.
2053 * decl.c (grok_reference_init): For T& t(e), set
2054 LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet.
2056 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
2057 Jun Ma <JunMa@linux.alibaba.com>
2059 * coroutines.cc (maybe_promote_captured_temps): Add a cleanup
2060 expression, if needed, to any call from which we promoted
2061 temporaries captured by reference.
2063 2020-04-08 Marek Polacek <polacek@redhat.com>
2065 PR c++/94507 - ICE-on-invalid with lambda template.
2066 * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
2067 tsubst_function_decl returns error_mark_node.
2069 2020-04-08 Martin Liska <mliska@suse.cz>
2072 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
2073 (cxx_init_decl_processing): Mark replaceable all implicitly defined
2076 2020-04-08 Patrick Palka <ppalka@redhat.com>
2078 Core issues 1001 and 1322
2080 * pt.c (rebuild_function_or_method_type): Split function out from ...
2081 (tsubst_function_type): ... here.
2082 (maybe_rebuild_function_decl_type): New function.
2083 (tsubst_function_decl): Use it.
2085 2020-04-08 Jakub Jelinek <jakub@redhat.com>
2088 * decl.c (begin_destructor_body): For CLASSTYPE_VBASECLASSES class
2089 dtors, if CLASSTYPE_PRIMARY_BINFO is non-NULL, but not BINFO_VIRTUAL_P,
2090 look at CLASSTYPE_PRIMARY_BINFO of its BINFO_TYPE if it is not
2091 BINFO_VIRTUAL_P, and so on.
2093 2020-04-08 Marek Polacek <polacek@redhat.com>
2095 PR c++/94478 - ICE with defaulted comparison operator
2096 * method.c (early_check_defaulted_comparison): Give an error when the
2099 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
2102 * paser.c (cp_parser_oacc_declare): Add check that variables
2103 are declared in the same scope as the directive.
2105 2020-04-07 Jason Merrill <jason@redhat.com>
2108 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
2111 * parser.c (cp_parser_placeholder_type_specifier): Use
2114 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
2116 * coroutines.cc (maybe_promote_captured_temps): Ensure that
2117 reference capture placeholder vars are properly declared.
2119 2020-04-07 Patrick Palka <ppalka@redhat.com>
2122 * tree.c (replace_placeholders): Look through all handled components,
2123 not just COMPONENT_REFs.
2124 * typeck2.c (process_init_constructor_array): Propagate
2125 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
2126 the array initializer.
2128 2020-04-07 Jakub Jelinek <jakub@redhat.com>
2131 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
2132 if cp_parser_omp_master succeeded.
2134 2020-04-06 Jason Merrill <jason@redhat.com>
2137 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
2139 2020-04-04 Marek Polacek <polacek@redhat.com>
2140 Jason Merrill <jason@redhat.com>
2142 PR c++/94155 - crash in gimplifier with paren init of aggregates.
2143 * init.c (build_vec_init): Fill in indexes.
2145 2020-04-04 Jason Merrill <jason@redhat.com>
2148 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
2150 2020-04-04 Patrick Palka <ppalka@redhat.com>
2154 * constexpr.c (struct constexpr_ctx): New field 'parent'.
2155 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
2156 flag from the original constructor to the reduced constructor.
2157 (lookup_placeholder): Prefer to return the outermost matching object
2158 by recursively calling lookup_placeholder on the 'parent' context,
2159 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
2160 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
2161 context via 'new_ctx.parent' when being expanded without an explicit
2162 target. Don't call replace_placeholders.
2163 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
2167 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
2168 support for VECTOR_TYPEs, and optimizations for the common case)
2170 (cxx_eval_store_expression): ... here. Rename local variable
2171 'changed_active_union_member_p' to 'activated_union_member_p'. Record
2172 the sequence of indexes into 'indexes' that yields the subobject we're
2173 assigning to. Record the integer offsets of the constructor indexes
2174 we're assigning through into 'index_pos_hints'. After evaluating the
2175 initializer of the store expression, recompute 'valp' using 'indexes'
2176 and using 'index_pos_hints' as hints.
2177 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
2178 to recompute the constructor_elt pointer we're assigning through after
2179 evaluating each initializer.
2181 2020-04-04 Jason Merrill <jason@redhat.com>
2184 * constraint.cc (tsubst_valid_expression_requirement): Call
2187 2020-04-04 Jason Merrill <jason@redhat.com>
2190 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
2191 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
2194 2020-04-04 Jakub Jelinek <jakub@redhat.com>
2197 * parser.c (cp_parser_omp_for_loop): Use
2198 protected_set_expr_location_if_unset.
2199 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
2202 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
2203 omp_parallel_combined_clauses.
2205 2020-04-03 Jason Merrill <jason@redhat.com>
2208 * pt.c (complex_pack_expansion_r): New.
2209 (complex_alias_template_p): Use it.
2211 2020-03-31 Jason Merrill <jason@redhat.com>
2214 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
2215 replace_placeholders.
2216 * typeck2.c (store_init_value): Fix arguments to
2217 fold_non_dependent_expr.
2219 2020-03-31 Jason Merrill <jason@redhat.com>
2221 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
2224 2020-03-30 Jason Merrill <jason@redhat.com>
2227 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
2228 (called_fns_equal): Check DECL_CONTEXT.
2230 2020-03-30 Jakub Jelinek <jakub@redhat.com>
2233 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
2234 STATEMENT_CODE_P code.
2236 2020-03-28 Patrick Palka <ppalka@redhat.com>
2239 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
2240 "requires {" when "requires requires {" was probably intended.
2243 * constraint.cc (tsubst_compound_requirement): Always suppress errors
2244 from type_deducible_p and expression_convertible_p, as they're not
2245 substitution errors.
2246 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
2247 that we diagnose INTEGER_CST expressions of non-bool type via the
2249 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
2250 * parser.c (cp_parser_requires_expression): Always parse the requirement
2251 body as if we're processing a template, by temporarily incrementing
2252 processing_template_decl. Afterwards, if we're not actually in a
2253 template context, perform semantic processing to diagnose any invalid
2254 types and expressions.
2255 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
2256 * semantics.c (finish_static_assert): Explain an assertion failure
2257 when the condition is a REQUIRES_EXPR like we do when it is a concept
2260 * constraint.cc (diagnose_compound_requirement): When diagnosing a
2261 compound requirement, maybe replay the satisfaction failure, subject to
2262 the current diagnosis depth.
2264 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
2265 as well as its range, because build_x_binary_op doesn't always do so.
2266 (current_constraint_diagnosis_depth): New.
2267 (concepts_diagnostics_max_depth_exceeded_p): New.
2268 (collect_operands_of_disjunction): New.
2269 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
2270 replay each branch of the disjunction, subject to the current diagnosis
2272 (diagnose_valid_expression): When diagnosing a satisfaction failure,
2273 maybe replay the substitution error, subject to the current diagnosis
2275 (diagnose_valid_type): Likewise.
2276 (diagnose_nested_requiremnet): Likewise.
2277 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
2278 current_constraint_diagnosis_depth when diagnosing.
2279 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
2280 current_constraint_diagnosis_depth when diagnosing.
2281 (diagnosing_failed_constraint::replay_errors_p): New static member
2283 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
2284 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
2285 the limit was exceeded.
2286 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
2288 2020-03-27 Nathan Sidwell <nathan@acm.org>
2291 * name-lookup.c (do_pushdecl): Look through cleanp levels.
2293 2020-03-27 Martin Sebor <msebor@redhat.com>
2298 * cp-tree.h (most_specialized_partial_spec): Declare.
2299 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
2301 (specialization_of): New function.
2302 (cp_parser_check_class_key): Move code...
2303 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
2304 -Wredundant-tags on first-time declarations in other declarators.
2305 Correct handling of template specializations.
2306 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
2307 when -Wredundant-tags is enabled. Use primary template or partial
2308 specialization as the guide for uses of implicit instantiations.
2309 * pt.c (most_specialized_partial_spec): Declare extern.
2311 2020-03-27 Nathan Sidwell <nathan@acm.org>
2314 * name-lookup.c (push_namespace): Triage ambiguous lookups that
2317 2020-03-27 Jakub Jelinek <jakub@redhat.com>
2320 * call.c (set_flags_from_callee): Don't update
2321 cp_function_chain->can_throw or current_function_returns_abnormally
2322 if cp_unevaluated_operand.
2325 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
2326 operand and creating a new COMPOUND_EXPR if anything changed.
2328 2020-03-26 Marek Polacek <polacek@redhat.com>
2330 PR c++/94336 - template keyword accepted before destructor names.
2331 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
2332 is followed by a destructor name.
2334 2020-03-27 Patrick Palka <ppalka@redhat.com>
2336 * decl.c (compute_array_index_type_loc): Remove redundant
2337 type_dependent_expression_p check that is subsumed by
2338 value_dependent_expression_p.
2339 * decl2.c (is_late_template_attribute): Likewise.
2340 * pt.c (uses_template_parms): Likewise.
2341 (dependent_template_arg_p): Likewise.
2343 2020-03-26 Marek Polacek <polacek@redhat.com>
2346 PR c++/94057 - template keyword in a typename-specifier.
2347 * parser.c (check_template_keyword_in_nested_name_spec): New.
2348 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
2349 'template'. Call check_template_keyword_in_nested_name_spec.
2350 (cp_parser_simple_type_specifier): Assume that a <
2351 following a qualified-id in a typename-specifier begins
2352 a template argument list.
2354 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
2356 * coroutines.cc (coro_init_identifiers): Initialize an identifier
2357 for the cororoutine handle 'address' method name.
2358 (struct coro_aw_data): Add fields to cover the continuations.
2359 (co_await_expander): Determine the kind of await_suspend in use.
2360 If we have the case that returns a continuation handle, then save
2361 this and make the target for 'scope exit without cleanup' be the
2362 continuation resume label.
2363 (expand_co_awaits): Remove.
2364 (struct suspend_point_info): Remove fields that kept the returned
2365 await_suspend handle type.
2366 (transform_await_expr): Remove code tracking continuation handles.
2367 (build_actor_fn): Add the continuation handle as an actor-function
2368 scope var. Build the symmetric transfer continuation point. Call
2369 the tree walk for co_await expansion directly, rather than via a
2370 trivial shim function.
2371 (register_await_info): Remove fields tracking continuation handles.
2372 (get_await_suspend_return_type): Remove.
2373 (register_awaits): Remove code tracking continuation handles.
2374 (morph_fn_to_coro): Remove code tracking continuation handles.
2376 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
2378 * coroutines.cc (co_await_expander): If we are expanding the
2379 initial await expression, set a boolean flag to show that we
2380 have now reached the initial await_resume() method call.
2381 (expand_co_awaits): Handle the 'initial await resume called' flag.
2382 (build_actor_fn): Insert the initial await expression into the
2383 start of the user-authored function-body. Handle the 'initial await
2384 resume called' flag.
2385 (morph_fn_to_coro): Initialise the 'initial await resume called'
2386 flag. Modify the unhandled exception catch clause to recognise
2387 exceptions that occur before the initial await_resume() and re-
2390 2020-03-26 Jakub Jelinek <jakub@redhat.com>
2393 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
2394 true for all TEMPLATE_DECLs.
2397 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
2399 2020-03-25 Patrick Palka <ppalka@redhat.com>
2402 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
2403 current condition chain when the if-statement has a non-empty
2406 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
2409 * coroutines.cc (captures_temporary): Fix a missing dereference.
2411 2020-03-24 Marek Polacek <polacek@redhat.com>
2413 PR c++/94190 - wrong no post-decrement operator error in template.
2414 * call.c (convert_like_real): Use convert_from_reference on the result.
2416 2020-03-24 Jason Merrill <jason@redhat.com>
2419 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
2421 (tsubst_nested_requirement): Likewise.
2422 (get_constraint_error_location): Allow missing context.
2423 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
2424 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
2426 2020-03-24 Jason Merrill <jason@redhat.com>
2428 * pt.c (any_template_parm_r): Look into the type of a non-type
2431 2020-03-24 Jason Merrill <jason@redhat.com>
2433 * cp-tree.h (cp_expr): When constructing from an expr and a
2434 location, call protected_set_expr_location.
2436 2020-03-23 Patrick Palka <ppalka@redhat.com>
2439 * except.c (maybe_noexcept_warning): Add TODO.
2440 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
2442 2020-03-23 nathans <nathan@acm.org>
2445 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
2448 2020-03-21 Patrick Palka <ppalka@redhat.com>
2451 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
2452 handle unions without an initializer.
2453 (cxx_eval_component_reference): Emit a different diagnostic when the
2454 constructor element corresponding to a union member is NULL.
2455 (cxx_eval_bare_aggregate): When constructing a union, always set the
2456 active union member before evaluating the initializer. Relax assertion
2457 that verifies the index of the constructor element we're initializing
2458 hasn't been changed.
2459 (cxx_eval_store_expression): Diagnose changing the active union member
2460 while the union is in the process of being initialized. After setting
2461 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
2463 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
2464 CONSTRUCTOR returned by lookup_placeholder.
2466 2020-03-20 Patrick Palka <ppalka@redhat.com>
2468 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
2469 the "[with ]" bits to here from ...
2470 (pp_cxx_atomic_constraint): ... here.
2471 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
2472 * error.c (rebuild_concept_check): Delete.
2473 (print_concept_check_info): Print the dependent form of the constraint and the
2474 preferably substituted parameter mapping alongside it.
2476 2020-03-19 Jason Merrill <jason@redhat.com>
2479 * cp-gimplify.c (simple_empty_class_p): Look through
2480 SIMPLE_TARGET_EXPR_P.
2481 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
2482 [RETURN_EXPR]: Avoid producing 'return *retval;'.
2483 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
2484 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
2487 2020-03-19 Jakub Jelinek <jakub@redhat.com>
2490 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
2491 on outer_automatic_var_p decls.
2492 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
2493 capture proxy decls.
2495 2020-03-18 Nathan Sidwell <nathan@acm.org>
2497 PR c++/94147 - mangling of lambdas assigned to globals
2498 * parser.c (cp_parser_init_declarator): Namespace-scope variables
2499 provide a lambda scope.
2500 * tree.c (no_linkage_check): Lambdas with a variable for extra
2501 scope have a linkage from the variable.
2503 2020-03-18 Jakub Jelinek <jakub@redhat.com>
2505 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
2506 strictly_subsumes): Fix up duplicated word issue in a comment.
2507 * coroutines.cc (build_init_or_final_await, captures_temporary):
2509 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
2510 * pt.c (append_type_to_template_for_access_check): Likewise.
2513 * decl.c (grokfndecl): Restore old diagnostics about deduction
2514 guide declared in different scope if in_namespace is NULL_TREE.
2516 2020-03-17 Jakub Jelinek <jakub@redhat.com>
2519 * parser.c (cp_parser_enum_specifier): Use temp_override for
2520 parser->colon_corrects_to_scope_p, replace goto out with return.
2521 If scoped enum or enum with underlying type is not followed by
2522 { or ;, call cp_parser_commit_to_tentative_parse before calling
2523 cp_parser_error and make sure to return error_mark_node instead of
2524 NULL_TREE. Formatting fixes.
2526 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
2529 * method.c (assignable_expr): Use cp_unevaluated.
2530 (is_xible_helper): Push a non-deferred access check for
2531 the stub objects created by assignable_expr and constructible_expr.
2533 2020-03-17 Jakub Jelinek <jakub@redhat.com>
2535 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
2536 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
2538 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
2539 cp_parser_placeholder_type_specifier,
2540 cp_parser_constraint_requires_parens): Likewise.
2541 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
2543 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
2545 * coroutines.cc (co_await_expander): Fix indentation.
2547 2020-03-14 Jason Merrill <jason@redhat.com>
2550 * pt.c (process_partial_specialization): Error rather than crash on
2551 extra pack expansion.
2553 2020-03-14 Jason Merrill <jason@redhat.com>
2556 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
2557 DECL_ORIGINAL_TYPE of a typedef.
2559 2020-03-14 Jason Merrill <jason@redhat.com>
2562 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
2563 substituting DECL_ARGUMENTS.
2565 2020-03-14 Jakub Jelinek <jakub@redhat.com>
2567 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
2568 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
2571 2020-03-13 Patrick Palka <ppalka@redhat.com>
2574 * call.c (build_over_call): Use a warning_sentinel to disable
2575 warn_deprecated_decl before calling build_addr_func.
2577 2020-03-12 Jakub Jelinek <jakub@redhat.com>
2580 * decl.c (reshape_init_array_1): Don't unshare constructor if there
2581 aren't any trailing zero elts, otherwise only unshare the first
2584 2020-03-11 Jason Merrill <jason@redhat.com>
2587 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
2590 2020-03-11 Marek Polacek <polacek@redhat.com>
2591 Jason Merrill <jason@redhat.com>
2593 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
2594 * constexpr.c (cref_has_const_field): New function.
2595 (modifying_const_object_p): Consider a COMPONENT_REF
2596 const only if any of its fields are const.
2597 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
2598 as readonly after its initialization has been done.
2600 2020-03-10 Marek Polacek <polacek@redhat.com>
2602 PR c++/94124 - wrong conversion error with non-viable overload.
2603 * decl.c (reshape_init_array_1): Unshare a constructor if we
2604 stripped trailing zero-initializers.
2606 2020-03-10 Jason Merrill <jason@redhat.com>
2609 * pt.c (maybe_instantiate_noexcept): Always update clones.
2611 2020-03-10 Jason Merrill <jason@redhat.com>
2614 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
2616 2020-03-10 Jason Merrill <jason@redhat.com>
2622 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
2623 66139: Don't split_nonconstant_init. Remove pre_p parameter.
2625 2020-03-09 Marek Polacek <polacek@redhat.com>
2627 PR c++/92031 - bogus taking address of rvalue error.
2628 PR c++/91465 - ICE with template codes in check_narrowing.
2629 PR c++/93870 - wrong error when converting template non-type arg.
2630 PR c++/94068 - ICE with template codes in check_narrowing.
2631 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
2632 in a template when not ck_identity and we're dealing with a class.
2633 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
2634 in a template if we need a temporary.
2635 * decl.c (compute_array_index_type_loc): Remove
2636 instantiate_non_dependent_expr_sfinae call. Call
2637 fold_non_dependent_expr instead of maybe_constant_value.
2638 (build_explicit_specifier): Don't instantiate or create a sentinel
2639 before converting the expression.
2640 * except.c (build_noexcept_spec): Likewise.
2641 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
2642 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
2643 build_converted_constant_expr returned.
2644 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
2645 of maybe_constant_value.
2647 2020-03-09 Jakub Jelinek <jakub@redhat.com>
2651 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
2653 * constexpr.c (cxx_eval_constant_expression): Do not handle
2654 RROTATE_EXPR and LROTATE_EXPR.
2656 2020-03-09 Marek Polacek <polacek@redhat.com>
2658 PR c++/94050 - ABI issue with alignas on armv7hl.
2659 * class.c (layout_class_type): Don't replace a class's
2660 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
2662 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
2664 * coroutines.cc (build_actor_fn): Factor out code inserting the
2665 default return_void call to...
2666 (morph_fn_to_coro): ...here, also hoist local var declarations.
2668 2020-03-08 Patrick Palka <ppalka@redhat.com>
2671 * call.c (convert_like_real): Check complain before emitting an error
2672 about binding a bit-field to a reference.
2674 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
2675 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
2678 2020-03-06 Nathan Sidwell <nathan@acm.org>
2681 * mangle.c (find_substitution): Don't call same_type_p on template
2682 args that cannot match.
2684 2020-03-04 Martin Sebor <msebor@redhat.com>
2687 * tree.c (type_initializer_zero_p): Fail for structs initialized
2690 2020-03-04 Jason Merrill <jason@redhat.com>
2693 * init.c (perform_member_init): Don't do aggregate initialization of
2695 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
2696 initialization of empty field.
2698 2020-03-04 Martin Liska <mliska@suse.cz>
2700 * method.c: Wrap array in ctor with braces in order
2701 to silent clang warnings.
2703 2020-03-03 Jason Merrill <jason@redhat.com>
2704 Marek Polacek <polacek@redhat.com>
2706 PR c++/90505 - mismatch in template argument deduction.
2707 * pt.c (tsubst): Don't reduce the template level of template
2708 parameters when tf_partial.
2710 2020-03-03 Jakub Jelinek <jakub@redhat.com>
2713 * constexpr.c (cxx_eval_constant_expression)
2714 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
2715 *non_constant_p is true.
2717 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
2719 * coroutines.cc (captures_temporary): Strip component_ref
2722 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
2724 * coroutines.cc (finish_co_await_expr): Build co_await_expr
2725 with unknown_type_node.
2726 (finish_co_yield_expr): Ditto.
2727 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
2728 with unknown type as dependent.
2730 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
2732 * coroutines.cc (struct local_var_info): Adjust to remove the
2733 reference to the captured var, and just to note that this is a
2734 lambda capture proxy.
2735 (transform_local_var_uses): Handle lambda captures specially.
2736 (struct param_frame_data): Add a visited set.
2737 (register_param_uses): Also check for param uses in lambda
2739 (struct local_vars_frame_data): Remove captures list.
2740 (register_local_var_uses): Handle lambda capture proxies by
2741 noting and bypassing them.
2742 (morph_fn_to_coro): Update to remove lifetime extension of
2743 lambda capture-by-copy vars.
2745 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
2747 * coroutines.cc (build_co_await): Do not build frame
2748 awaitable proxy vars when the co_await expression is
2749 a function parameter or local var.
2750 (co_await_expander): Do not initialise a frame var with
2752 (transform_await_expr): Only substitute the awaitable
2753 frame var if it's needed.
2754 (register_awaits): Do not make frame copies for param
2755 or local vars that are awaitables.
2757 2020-02-28 Jason Merrill <jason@redhat.com>
2759 Implement P2092R0, Disambiguating Nested-Requirements
2760 * parser.c (cp_parser_requirement_parameter_list): Pass
2761 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
2763 * call.c (build_user_type_conversion_1): Don't look at the second
2764 conversion of a non-viable candidate.
2766 2020-02-28 Jakub Jelinek <jakub@redhat.com>
2768 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
2769 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
2770 functions in unevaluated contexts.
2772 2020-02-27 Nathan Sidwell <nathan@acm.org>
2775 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
2777 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
2778 * typeck.c (comptypes): Assert we don't get any argument packs.
2780 * class.c (adjust_clone_args): Correct arg-checking assert.
2781 * typeck.c (comptypes): Assert not nulls.
2783 2020-02-26 Marek Polacek <polacek@redhat.com>
2785 PR c++/93789 - ICE with invalid array bounds.
2786 * decl.c (compute_array_index_type_loc): Don't use the folded
2787 size when folding cleared TREE_CONSTANT.
2789 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
2791 * class.c (classtype_has_non_deleted_copy_ctor): New.
2792 * coroutines.cc (struct param_info): Keep track of params
2793 that are references, and cache the original type and whether
2794 the DTOR is trivial.
2795 (build_actor_fn): Handle param copies always, and adjust the
2796 handling for references.
2797 (register_param_uses): Only handle uses here.
2798 (classtype_has_non_deleted_copy_ctor): New.
2799 (morph_fn_to_coro): Adjust param copy handling to match n4849
2800 by reordering ahead of the promise CTOR and always making a
2801 frame copy, even if the param is unused in the coroutine body.
2802 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
2804 2020-02-26 Patrick Palka <ppalka@redhat.com>
2806 * constraint.cc (finish_constraint_binary_op): Set expr's location range
2807 to the range of its operands.
2808 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
2809 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
2810 instead of the corresponding template arguments ARGS and adjust body
2812 (diagnose_requires_expr): Likewise.
2813 (diagnose_atomic_constraint): Likewise. When printing an atomic
2814 constraint expression, print the instantiated parameter mapping
2816 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
2817 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
2818 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
2820 2020-02-26 Marek Polacek <polacek@redhat.com>
2822 PR c++/93676 - value-init crash in template.
2823 * init.c (build_new_1): Don't call build_vec_init in a template.
2825 2020-02-26 Marek Polacek <polacek@redhat.com>
2827 PR c++/93862 - ICE with static_cast when converting from int[].
2828 * call.c (reference_compatible_p): No longer static.
2829 * cp-tree.h (reference_compatible_p): Declare.
2830 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
2831 of reference_related_p.
2833 2020-02-26 Marek Polacek <polacek@redhat.com>
2835 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
2836 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
2839 2020-02-24 Martin Sebor <msebor@redhat.com>
2842 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
2843 in shared C/C++ code in headers.
2844 Remove a duplicate hunk of code.
2846 2020-02-24 Marek Polacek <polacek@redhat.com>
2848 PR c++/93869 - ICE with -Wmismatched-tags.
2849 * parser.c (cp_parser_check_class_key): Check class_key earlier.
2851 2020-02-24 Marek Polacek <polacek@redhat.com>
2853 PR c++/93712 - ICE with ill-formed array list-initialization.
2854 * call.c (next_conversion): Return NULL for ck_aggr.
2855 (build_aggr_conv): Set u.expr instead of u.next.
2856 (build_array_conv): Likewise.
2857 (build_complex_conv): Likewise.
2858 (conv_get_original_expr): Handle ck_aggr.
2860 2020-02-24 Jakub Jelinek <jakub@redhat.com>
2862 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
2863 * call.c (build_over_call): Don't evaluate immediate functions in
2864 unevaluated operands.
2866 2020-02-24 Jason Merrill <jason@redhat.com>
2868 P0780R2: Resolve lambda init-capture pack grammar.
2869 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
2872 2020-02-22 Marek Polacek <polacek@redhat.com>
2875 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
2877 2020-02-21 Martin Sebor <msebor@redhat.com>
2879 PR gcov-profile/93753
2880 * class.c (check_flexarrays): Tighten up a test for potential members
2881 of anonymous structs or unions.
2883 2020-02-20 Martin Sebor <msebor@redhat.com>
2886 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
2888 2020-02-20 Martin Liska <mliska@suse.cz>
2890 PR translation/93841
2891 * config/or1k/or1k.opt: Remove superfluous word.
2892 * doc/invoke.texi: Likewise.
2894 2020-02-20 Martin Liska <mliska@suse.cz>
2896 PR translation/93838
2897 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
2899 2020-02-19 Marek Polacek <polacek@redhat.com>
2901 PR c++/93169 - wrong-code with a non-constexpr constructor.
2902 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
2903 on constant CONSTRUCTORs.
2905 2020-02-15 Marek Polacek <polacek@redhat.com>
2907 PR c++/93710 - poor diagnostic for array initializer.
2908 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
2911 2020-02-15 Jason Merrill <jason@redhat.com>
2914 * pt.c (any_template_parm_r): Look into lambda body.
2917 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
2919 2020-02-14 Jakub Jelinek <jakub@redhat.com>
2922 * class.c (enum_min_precision): Change prec type from int to int &.
2925 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
2926 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
2927 (fallback_dfloat32_type, fallback_dfloat64_type,
2928 fallback_dfloat128_type): Define.
2929 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
2931 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
2932 is disabled for compatibility.
2934 2020-02-13 Jason Merrill <jason@redhat.com>
2937 * name-lookup.c (matching_fn_p): A function does not match a
2942 * tree.c (decl_linkage): Always lk_none for locals.
2944 2020-02-12 Jason Merrill <jason@redhat.com>
2948 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
2949 * pt.c (find_parameter_packs_r): Not here.
2951 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
2953 * coroutines.cc (build_actor_fn): Implement deallocation function
2954 selection per n4849, dcl.fct.def.coroutine bullet 12.
2955 (morph_fn_to_coro): Implement allocation function selection per
2956 n4849, dcl.fct.def.coroutine bullets 9 and 10.
2958 2020-02-12 Marek Polacek <polacek@redhat.com>
2960 PR c++/93684 - ICE-on-invalid with broken attribute.
2961 * parser.c (cp_parser_std_attribute): Peek a token first before
2964 2020-02-11 Jason Merrill <jason@redhat.com>
2967 * class.c (add_implicitly_declared_members): Use do_friend.
2968 * method.c (implicitly_declare_fn): Fix friend handling.
2969 (decl_remember_implicit_trigger_p): New.
2970 (synthesize_method): Use it.
2971 * decl2.c (mark_used): Use it.
2973 2020-02-11 Jason Merrill <jason@redhat.com>
2977 * constexpr.c (maybe_constant_value): Correct earlier change.
2978 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
2979 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
2981 2020-02-12 Patrick Palka <ppalka@redhat.com>
2985 * type-utils.h (find_type_usage): Refactor to take a tree * and to
2986 return a tree *, and update documentation accordingly.
2987 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
2988 decltype(auto) node.
2989 (make_constrained_decltype_auto): No need to explicitly set
2990 AUTO_IS_DECLTYPE anymore.
2991 (splice_late_return_type): Use find_type_usage to find and
2992 replace a possibly nested auto node instead of using is_auto.
2993 Check test for is_auto into an assert when deciding whether
2994 to late_return_type.
2995 (type_uses_auto): Adjust the call to find_type_usage.
2996 * parser.c (cp_parser_decltype): No need to explicitly set
2997 AUTO_IS_DECLTYPE anymore.
2999 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
3000 (dump_simple_decl): Handle standard concept definitions as well as
3001 variable concept definitions.
3003 2020-02-10 Jakub Jelinek <jakub@redhat.com>
3006 * error.c (dump_decl_name): Fix up last argument to strncmp.
3008 2020-02-10 Jason Merrill <jason@redhat.com>
3011 * tree.c (array_of_unknown_bound_p): New.
3012 * init.c (perform_member_init): Do nothing for flexible arrays.
3014 2020-02-09 Jakub Jelinek <jakub@redhat.com>
3017 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
3018 ARRAY_TYPE, use the element type. Punt if objtype after that is not
3021 2020-02-08 Jason Merrill <jason@redhat.com>
3024 * expr.c (fold_for_warn): Call maybe_constant_value.
3025 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
3026 (maybe_constant_value): Add uid_sensitive parm.
3027 (get_fundef_copy): Don't copy if it's true.
3028 (cxx_eval_call_expression): Don't instantiate if it's true.
3029 (cxx_eval_outermost_constant_expr): Likewise.
3032 * constexpr.c (maybe_constant_value): Don't unshare if the cached
3033 value is the same as the argument.
3035 * typeck.c (maybe_warn_about_returning_address_of_local): Add
3038 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
3041 2020-02-08 Jakub Jelinek <jakub@redhat.com>
3044 * constexpr.c (find_array_ctor_elt): If last element has no index,
3045 for flag_checking verify all elts have no index. If i is within the
3046 elts, return it directly, if it is right after the last elt, append
3047 if NULL index, otherwise force indexes on all elts.
3048 (cxx_eval_store_expression): Allow cep->index to be NULL.
3050 2020-02-07 Marek Polacek <polacek@redhat.com>
3052 PR c++/92947 - Paren init of aggregates in unevaluated context.
3053 * call.c (build_new_method_call_1): Don't check
3054 cp_unevaluated_operand. Check the return value of digest_init.
3056 2020-02-06 Jason Merrill <jason@redhat.com>
3059 * tree.c (cp_walk_subtrees): Walk into type template arguments.
3060 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
3061 instead of TYPE_ALIAS_P.
3062 * pt.c (push_template_decl_real): Likewise.
3063 (find_parameter_packs_r): Likewise. Remove dead code.
3064 * error.c (find_typenames_r): Remove dead code.
3066 2020-02-06 Jason Merrill <jason@redhat.com>
3069 * parser.c (cp_parser_constraint_primary_expression): Do the main
3070 parse non-tentatively.
3072 2020-02-06 Marek Polacek <polacek@redhat.com>
3074 PR c++/93597 - ICE with lambda in operator function.
3075 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
3077 2020-02-05 Jason Merrill <jason@redhat.com>
3080 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
3081 handling of TREE_CHAIN for empty pack.
3083 2020-02-05 Jakub Jelinek <jakub@redhat.com>
3086 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
3087 prior to passing it to c_build_vec_convert.
3089 2020-02-05 Marek Polacek <polacek@redhat.com>
3091 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
3092 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
3095 2020-02-05 Jason Merrill <jason@redhat.com>
3098 * decl.c (grokdeclarator): Reject field of current class type even
3101 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
3103 * coroutines.cc (maybe_promote_captured_temps): Increase the index
3104 number for temporary variables' name.
3106 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
3108 * coroutines.cc (build_co_await): Call convert_from_reference
3109 to wrap co_await_expr with indirect_ref which avoid
3110 reference/non-reference type confusion.
3112 (co_await_expander): Sink to call_expr if await_resume
3113 is wrapped by indirect_ref.
3115 2020-02-04 Jason Merrill <jason@redhat.com>
3118 * constraint.cc (satisfy_declaration_constraints): Check return
3119 value of push_tinst_level.
3122 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
3123 elements instead of value-initializing them.
3126 * init.c (perform_member_init): Simplify.
3127 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
3129 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
3131 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
3133 * coroutines.cc (find_promise_type): Delete unused forward
3135 (struct coroutine_info): Add a bool for no promise type error.
3136 (coro_promise_type_found_p): Only emit the error for a missing
3137 promise once in each affected coroutine.
3139 2020-02-03 Jason Merrill <jason@redhat.com>
3142 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
3143 defer loading the value of a reference.
3145 2020-02-03 Jason Merrill <jason@redhat.com>
3148 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
3150 [COMPONENT_REF]: A member function reference doesn't use the object
3153 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
3156 * coroutines.cc (struct coroutine_info): Add a bool flag to note
3157 that we emitted an error for a bad function return type.
3158 (get_coroutine_info): Tolerate an unset info table in case of
3160 (find_coro_traits_template_decl): In case of error or if we didn't
3161 find a type template, note we emitted the error and suppress
3163 (find_coro_handle_template_decl): Likewise.
3164 (instantiate_coro_traits): Only check for error_mark_node in the
3165 return from lookup_qualified_name.
3166 (coro_promise_type_found_p): Reorder initialization so that we check
3167 for the traits and their usability before allocation of the info
3168 table. Check for a suitable return type and emit a diagnostic for
3169 here instead of relying on the lookup machinery. This allows the
3170 error to have a better location, and means we can suppress multiple
3172 (coro_function_valid_p): Re-check for a valid promise (and thus the
3173 traits) before proceeding. Tolerate missing info as a fatal error.
3175 2020-02-03 Jason Merrill <jason@redhat.com>
3178 * cp-gimplify.c (predeclare_vla): New.
3179 (cp_genericize_r) [NOP_EXPR]: Call it.
3181 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
3183 * coroutines.cc (transform_await_wrapper): Set actor funcion as
3184 new context of label_decl.
3185 (build_actor_fn): Fill new field of await_xform_data.
3187 2020-02-02 Marek Polacek <polacek@redhat.com>
3189 PR c++/93530 - ICE on invalid alignas in a template.
3190 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
3193 2020-01-31 Jason Merrill <jason@redhat.com>
3196 * semantics.c (process_outer_var_ref): Capture VLAs even in
3197 unevaluated context.
3200 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
3201 non-aggregate elements.
3202 (reshape_init_array): Add first_initializer_p parm.
3203 (reshape_init_r): Change first_initializer_p from bool to tree.
3204 (reshape_init): Pass init to it.
3207 * parser.c (cp_parser_initializer_list): Suppress location wrappers
3210 2020-01-29 Jason Merrill <jason@redhat.com>
3213 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
3214 the expression was dependent before substitution.
3216 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
3218 * coroutines.cc (act_des_fn): New.
3219 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
3220 Access promise via actor function's frame pointer argument.
3221 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
3223 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
3225 * coroutines.cc (co_await_expander): Handle type conversion case.
3227 2020-01-29 Jason Merrill <jason@redhat.com>
3232 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
3233 a trailing return type.
3234 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
3237 2020-01-29 Marek Polacek <polacek@redhat.com>
3239 PR c++/91754 - Fix template arguments comparison with class NTTP.
3240 * pt.c (class_nttp_const_wrapper_p): New.
3241 (template_args_equal): See through class_nttp_const_wrapper_p
3244 2020-01-29 Marek Polacek <polacek@redhat.com>
3246 PR c++/92948 - Fix class NTTP with template arguments.
3247 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
3248 converting a value-dependent expression to a class type.
3249 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
3250 as the result of the tsubst_copy call.
3252 2020-01-29 Jakub Jelinek <jakub@redhat.com>
3255 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
3256 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
3258 2020-01-28 Jason Merrill <jason@redhat.com>
3261 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
3265 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
3268 * call.c (build_user_type_conversion_1): Allow a template conversion
3269 returning an rvalue reference to bind directly to an lvalue.
3272 * decl.c (grokdeclarator): Propagate eh spec from typedef.
3274 2020-01-28 Martin Liska <mliska@suse.cz>
3277 * pt.c (redeclare_class_template): Group couple of
3278 errors and inform messages with auto_diagnostic_group.
3280 2020-01-28 Martin Liska <mliska@suse.cz>
3283 * pt.c (redeclare_class_template): Use inform
3284 for the second location.
3286 2020-01-27 Jason Merrill <jason@redhat.com>
3289 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
3291 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
3294 * coroutines.cc (morph_fn_to_coro): Check the ramp return
3295 value when it is constructed from the 'get return object'.
3297 2020-01-27 Nathan Sidwell <nathan@acm.org>
3300 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
3302 2020-01-26 Jason Merrill <jason@redhat.com>
3305 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
3306 temporarily enable -Wsystem-headers. Change second warning to
3310 * semantics.c (finish_call_expr): Don't call
3311 instantiate_non_dependent_expr before warn_for_memset.
3313 2020-01-25 Marek Polacek <polacek@redhat.com>
3315 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
3316 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
3317 dynamic_cast diagnostic.
3319 2020-01-24 Jason Merrill <jason@redhat.com>
3321 PR c++/93400 - ICE with constrained friend.
3322 * constraint.cc (maybe_substitute_reqs_for): New.
3323 * decl.c (function_requirements_equivalent_p): Call it.
3324 * pt.c (tsubst_friend_function): Only substitute
3325 TEMPLATE_PARMS_CONSTRAINTS.
3326 (tsubst_template_parms): Copy constraints.
3328 2020-01-24 Jason Merrill <jason@redhat.com>
3330 PR c++/93279 - ICE with lambda in member operator.
3331 * name-lookup.c (maybe_save_operator_binding): Don't remember
3332 class-scope bindings.
3334 2020-01-24 Jason Merrill <jason@redhat.com>
3336 PR c++/93377 - ICE with member alias in constraint.
3337 * pt.c (any_template_parm_r): Look at template arguments for all
3338 aliases, not only alias templates.
3340 2020-01-24 Marek Polacek <polacek@redhat.com>
3342 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
3343 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
3345 2020-01-24 Jason Merrill <jason@redhat.com>
3347 PR c++/92852 - ICE with generic lambda and reference var.
3348 * constexpr.c (maybe_constant_value): Likewise.
3350 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
3353 * parser.c (cp_parser_nested_name_specifier_opt): Properly
3354 diagnose concept-ids.
3356 2020-01-23 Jason Merrill <jason@redhat.com>
3358 PR c++/93331 - ICE with __builtin_strchr.
3359 * constexpr.c (cxx_eval_builtin_function_call): Use the original
3360 argument if we didn't manage to extract a STRING_CST.
3362 PR c++/93345 - ICE with defaulted dtor and template.
3364 * decl.c (cxx_maybe_build_cleanup): Don't try to set
3365 throwing_cleanup in a template.
3367 2020-01-22 Marek Polacek <polacek@redhat.com>
3369 PR c++/92907 - noexcept does not consider "const" in member functions.
3370 * g++.dg/cpp0x/noexcept56.C: New test.
3372 2020-01-22 Marek Polacek <polacek@redhat.com>
3374 PR c++/93324 - ICE with -Wall on constexpr if.
3375 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
3377 2020-01-22 Patrick Palka <ppalka@redhat.com>
3379 * constraint.cc (get_mapped_args): Avoid using auto_vec
3380 as a vector element. Release the vectors inside the lists
3382 * parser.c (cp_literal_operator_id): Free the buffer.
3384 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
3386 * coroutines.cc (finish_co_await_expr): Add error check on return
3387 value of build_co_await.
3388 (finish_co_yield_expr,): Ditto.
3390 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
3392 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
3393 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
3394 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
3396 2020-01-21 Jason Merrill <jason@redhat.com>
3398 PR c++/60855 - ICE with sizeof VLA capture.
3399 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
3401 PR c++/90732 - ICE with VLA capture and generic lambda.
3402 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
3404 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
3405 Bin Cheng <bin.cheng@linux.alibaba.com>
3407 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
3408 from complete_type_or_else.
3409 (register_param_uses): Likewise.
3410 (build_co_await): Do not try to use complete_type_or_else for void
3411 types, otherwise for incomplete types, check for NULL return from
3412 complete_type_or_else.
3414 2020-01-21 Jason Merrill <jason@redhat.com>
3416 PR c++/91476 - anon-namespace reference temp clash between TUs.
3417 * decl2.c (copy_linkage): Factor out of get_guard.
3418 * call.c (make_temporary_var_for_ref_to_temp): Use it.
3419 * decl.c (cp_finish_decomp): Use it.
3420 (cp_finish_decl): determine_visibility sooner.
3422 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
3424 * coroutines.cc (finish_co_await_expr): Set return value flag.
3425 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
3427 2020-01-19 Jason Merrill <jason@redhat.com>
3429 PR c++/33799 - destroy return value, take 2.
3430 * cp-tree.h (current_retval_sentinel): New macro.
3431 (struct language_function): Add throwing_cleanup bitfield.
3432 * decl.c (cxx_maybe_build_cleanup): Set it.
3433 * except.c (maybe_set_retval_sentinel)
3434 (maybe_splice_retval_cleanup): New functions.
3435 * parser.c (cp_parser_compound_statement): Call
3436 maybe_splice_retval_cleanup.
3437 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
3439 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
3441 2020-01-18 Jakub Jelinek <jakub@redhat.com>
3443 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
3444 but non-NO_DOLLAR_IN_LABEL case build.
3446 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
3448 * Make-lang.in: Add coroutines.o.
3449 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
3450 (DECL_COROUTINE_P): New.
3451 * lex.c (init_reswords): Enable keywords when the coroutine flag
3453 * operators.def (co_await): New operator.
3454 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
3455 (op_error): Likewise.
3456 (build_new_op_1): Likewise.
3457 (build_new_function_call): Validate coroutine builtin arguments.
3458 * constexpr.c (potential_constant_expression_1): Handle
3459 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
3460 * coroutines.cc: New file.
3461 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
3462 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
3463 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
3464 * cp-tree.h (coro_validate_builtin_call): New.
3465 * decl.c (emit_coro_helper): New.
3466 (finish_function): Handle the case when a function is found to
3467 be a coroutine, perform the outlining and emit the outlined
3468 functions. Set a bit to signal that this is a coroutine component.
3469 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
3470 (cp_parser_unary_expression): Handle co_await.
3471 (cp_parser_assignment_expression): Handle co_yield.
3472 (cp_parser_statement): Handle RID_CO_RETURN.
3473 (cp_parser_jump_statement): Handle co_return.
3474 (cp_parser_operator): Handle co_await operator.
3475 (cp_parser_yield_expression): New.
3476 (cp_parser_required_error): Handle RT_CO_YIELD.
3477 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
3478 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
3480 * tree.c (cp_walk_subtrees): Likewise.
3482 2020-01-17 Jason Merrill <jason@redhat.com>
3484 PR c++/92531 - ICE with noexcept(lambda).
3485 * pt.c (uses_template_parms): Don't try to enumerate all the
3488 2020-01-17 Jakub Jelinek <jakub@redhat.com>
3491 * parser.c (cp_parser_template_name): Look up deprecated attribute
3492 in DECL_TEMPLATE_RESULT or its type's attributes.
3494 2020-01-16 Jason Merrill <jason@redhat.com>
3496 PR c++/93286 - ICE with __is_constructible and variadic template.
3497 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
3498 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
3500 PR c++/93280 - ICE with aggregate assignment and DMI.
3501 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
3502 * typeck2.c (digest_nsdmi_init): Not here.
3504 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
3507 * cp-tree.h (is_constrained_auto): New.
3508 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
3509 handle concept-check expressions; take a cp_decl_specifier_seq*
3511 (cp_parser_condition): Update call.
3512 (cp_parser_simple_declaration): Likewise.
3513 (cp_parser_placeholder_type_specifier): Correctly handle
3514 concept-check expressions.
3516 2020-01-15 Jason Merrill <jason@redhat.com>
3519 PR c++/33799 - destroy return value if local cleanup throws.
3520 * cp-tree.h (current_retval_sentinel): New macro.
3521 * decl.c (start_preparsed_function): Set up cleanup for retval.
3522 * typeck.c (check_return_expr): Set current_retval_sentinel.
3524 PR c++/93257 - consteval void function.
3525 * constexpr.c (verify_constant): Allow void_node.
3527 PR c++/92871 - bad code with xvalue and GNU ?: extension.
3528 * call.c (prevent_lifetime_extension): New.
3529 (build_conditional_expr_1): Use it.
3531 2020-01-14 Nathan Sidwell <nathan@acm.org>
3534 * pt.c (retrieve_specialization): Use get_template_info, not open
3538 * pt.c (retrieve_specialization): Get the TI from the decl or the
3539 classtype as appropriate.
3541 2020-01-14 David Malcolm <dmalcolm@redhat.com>
3543 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
3544 New static constant.
3545 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
3546 (struct named_label_hash::empty_zero_p): Likewise.
3547 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
3549 2020-01-14 Jason Merrill <jason@redhat.com>
3551 PR c++/92590 - wrong handling of inherited default ctor.
3552 * class.c (add_method): A constrained inherited ctor doesn't hide an
3553 implicit derived ctor.
3555 PR c++/92552 - ICE with inherited constrained default ctor.
3556 * pt.c (instantiate_class_template_1): Copy
3557 TYPE_HAS_USER_CONSTRUCTOR.
3558 PR c++/91930 - ICE with constrained inherited default ctor.
3559 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
3560 for inherited constructor.
3561 PR c++/92594 - ICE with inherited trivial default ctor.
3562 * method.c (trivial_fn_p): Treat an inherited default constructor
3563 like a normal default constructor.
3565 PR c++/92594 - ICE with inherited trivial default ctor.
3566 * method.c (trivial_fn_p): Treat an inherited default constructor
3567 like a normal default constructor.
3569 PR c++/92009 - ICE with punning of typeid.
3570 * rtti.c (get_tinfo_desc): Call xref_basetypes.
3571 * constexpr.c (cxx_fold_indirect_ref): Don't strip
3574 2020-01-13 Jason Merrill <jason@redhat.com>
3576 PR c++/92746 - ICE with noexcept of function concept check.
3577 * except.c (check_noexcept_r): Handle concept-check.
3579 PR c++/92582 - ICE with member template as requirement.
3580 * pt.c (struct find_template_parameter_info): Add ctx_parms.
3581 (any_template_parm_r): Handle TEMPLATE_DECL.
3582 (find_template_parameters): Take parms instead of their depth.
3583 * constraint.cc (build_parameter_mapping): Pass them.
3585 PR c++/33799 - destroy return value if local cleanup throws.
3586 * cp-tree.h (current_retval_sentinel): New macro.
3587 * decl.c (start_preparsed_function): Set up cleanup for retval.
3588 * typeck.c (check_return_expr): Set current_retval_sentinel.
3590 PR c++/93238 - short right-shift with enum.
3591 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
3593 2020-01-10 Jason Merrill <jason@redhat.com>
3595 * typeck.c (cp_build_binary_op): Restore short_shift code.
3597 PR c++/93143 - incorrect tree sharing with constexpr.
3598 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
3599 CONSTRUCTORs are already unshared.
3601 PR c++/93173 - incorrect tree sharing.
3603 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
3604 copy_if_shared after cp_genericize_tree.
3605 * typeck2.c (split_nonconstant_init): Don't unshare here.
3607 2020-01-08 Jason Merrill <jason@redhat.com>
3609 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
3610 TARGET_EXPR_DIRECT_INIT_P.
3611 * constexpr.c (cxx_eval_constant_expression): Likewise.
3613 2020-01-08 Jason Merrill <jason@redhat.com>
3615 PR c++/91369 - constexpr destructor and member initializer.
3616 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
3617 when not preevaluating.
3619 2020-01-08 Jason Merrill <jason@redhat.com>
3621 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
3624 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
3626 * init.c (build_new): Add location_t parameter and use it throughout.
3627 (build_raw_new_expr): Likewise.
3628 * parser.c (cp_parser_new_expression): Pass the combined_loc.
3629 * pt.c (tsubst_copy_and_build): Adjust call.
3630 * cp-tree.h: Update declarations.
3632 2020-01-07 Jason Merrill <jason@redhat.com>
3634 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
3635 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
3636 explicit class visibility for a template.
3638 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
3640 * mangle.c (mangle_type_attribute_p): New function, split out from...
3641 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
3642 that contain a space.
3644 2020-01-07 Jakub Jelinek <jakub@redhat.com>
3647 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
3648 member, initialize it to zero in ctor.
3649 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
3650 a heap object. Don't cache calls to functions which allocate some
3651 heap objects and don't deallocate them or deallocate some heap
3652 objects they didn't allocate.
3654 2020-01-06 Jason Merrill <jason@redhat.com>
3656 PR c++/92552 - ICE with inherited constrained default ctor.
3657 * pt.c (instantiate_class_template_1): Copy
3658 TYPE_HAS_USER_CONSTRUCTOR.
3659 * class.c (one_inherited_ctor): Don't set it here.
3661 2020-01-06 Andrew Sutton <asutton@lock3software.com>
3663 PR c++/92739 - parsing requires clause with attributes.
3664 * parser.c (cp_parser_constraint_requires_parens): Exclude
3665 attributes as postfix expressions.
3667 2020-01-05 Jakub Jelinek <jakub@redhat.com>
3670 * parser.c (cp_parser_check_class_key): Disable access checks for the
3672 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
3673 !warn_redundant_tags.
3675 2010-01-05 Jakub Jelinek <jakub@redhat.com>
3678 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
3679 TARGET_EXPR if it has been gimplified already.
3681 2020-01-03 Jason Merrill <jason@redhat.com>
3683 PR c++/93033 - incorrect tree node sharing with array init.
3684 * typeck2.c (split_nonconstant_init): Unshare non-decl.
3685 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
3687 2020-01-02 Jason Merrill <jason@redhat.com>
3689 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
3692 2020-01-02 Jakub Jelinek <jakub@redhat.com>
3695 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
3696 has not been found, rather than error_mark_node.
3698 2020-01-01 Jakub Jelinek <jakub@redhat.com>
3700 Update copyright years.
3702 Copyright (C) 2020 Free Software Foundation, Inc.
3704 Copying and distribution of this file, with or without modification,
3705 are permitted in any medium without royalty provided the copyright
3706 notice and this notice are preserved.