1 2020-08-05 Patrick Palka <ppalka@redhat.com>
2 Jason Merrill <jason@redhat.com>
5 * constexpr.c (cxx_eval_vec_init_1): Truncate ctx->ctor and
6 then clear CONSTRUCTOR_NO_CLEARING on each appended element
7 initializer if we're initializing a previously zero-initialized
10 2020-08-04 Marek Polacek <polacek@redhat.com>
13 * parser.c (cp_parser_elaborated_type_specifier): Allow
14 'template' following ::.
16 2020-08-04 Nathan Sidwell <nathan@acm.org>
18 * parser.c (cp_parser_explicit_specialization): Refactor
19 to avoid leak of num_template_parameter_lists value.
21 2020-08-04 Patrick Palka <ppalka@redhat.com>
24 * init.c (sort_mem_initializers): Preserve TREE_TYPE of the
25 member initializer list node.
26 (emit_mem_initializers): Set input_location when performing each
27 member initialization.
28 * parser.c (cp_parser_mem_initializer): Attach the source
29 location of this initializer to a dummy EMPTY_CLASS_EXPR
30 within the TREE_TYPE of the list node.
31 * pt.c (tsubst_initializer_list): Preserve TREE_TYPE of the
32 member initializer list node.
34 2020-08-03 Marek Polacek <polacek@redhat.com>
36 * cp-tree.h (after_nsdmi_defaulted_late_checks): Remove.
38 2020-08-03 Marek Polacek <polacek@redhat.com>
42 * pt.c (check_default_tmpl_args): Also consider variable
45 2020-07-31 Jakub Jelinek <jakub@redhat.com>
48 * decl.c (finish_function): In constexpr functions use for C++14 and
49 later error instead of warning if no return statement is present and
50 diagnose it regardless of warn_return_type. Move the warn_return_type
51 diagnostics earlier in the function.
53 2020-07-31 Martin Sebor <msebor@redhat.com>
56 * class.c (build_base_path): Set no-warning bit on the synthesized
57 conditional expression in static_cast.
59 2020-07-31 Richard Biener <rguenther@suse.de>
62 * cp-objcp-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
63 Define to c_common_finalize_early_debug.
65 2020-07-31 Patrick Palka <ppalka@redhat.com>
68 * constexpr.c (cxx_eval_constant_expression) <case CONST_DECL>:
69 Pass false to decl_constant_value and decl_really_constant_value
70 so that they don't unshare their result.
71 * cp-tree.h (decl_constant_value): New declaration with an added
73 (decl_really_constant_value): Add bool parameter defaulting to
74 true to existing declaration.
75 * init.c (constant_value_1): Add bool parameter which controls
76 whether to unshare the initializer before returning. Call
77 unshare_expr at most once.
78 (scalar_constant_value): Pass true to constant_value_1's new
80 (decl_really_constant_value): Add bool parameter and forward it
82 (decl_constant_value): Likewise, but instead define a new
83 overload with an added bool parameter.
85 2020-07-30 Patrick Palka <ppalka@redhat.com>
88 * pt.c (resolve_overloaded_unification): If the function
89 template specialization has a placeholder return type,
90 then instantiate it before attempting unification.
92 2020-07-30 Patrick Palka <ppalka@redhat.com>
95 * pt.c (alias_ctad_tweaks): Call remove_constraints before
96 calling set_constraints.
98 2020-07-30 Patrick Palka <ppalka@redhat.com>
101 * pt.c (reduce_template_parm_level): Propagate DECL_VIRTUAL_P
102 from the original TEMPLATE_PARM_DECL to the new lowered one.
104 2020-07-30 Patrick Palka <ppalka@redhat.com>
107 * constraint.cc (constraints_satisfied_p): Return true if
109 * pt.c (do_type_instantiation): Update a paragraph taken from
110 [temp.explicit] to reflect the latest specification. Don't
111 instantiate a member with unsatisfied constraints.
113 2020-07-29 Jason Merrill <jason@redhat.com>
116 * cp-tree.h (IMPLICIT_RVALUE_P): New.
117 (enum cp_lvalue_kind_flags): Add clk_implicit_rval.
118 (implicit_rvalue_p, set_implicit_rvalue_p): New.
119 * call.c (reference_binding): Check clk_implicit_rval.
120 (build_over_call): Adjust C++20 implicit move.
121 * coroutines.cc (finish_co_return_stmt): Simplify implicit move.
122 * except.c (build_throw): Adjust C++20 implicit move.
123 * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Propagate
125 * tree.c (lvalue_kind): Set clk_implicit_rval.
126 * typeck.c (treat_lvalue_as_rvalue_p): Overhaul.
127 (maybe_warn_pessimizing_move): Adjust.
128 (check_return_expr): Adjust C++20 implicit move.
130 2020-07-29 Jason Merrill <jason@redhat.com>
133 * call.c (build_over_call): Don't call a const ref
134 overload for implicit move.
136 2020-07-28 Nathan Sidwell <nathan@acm.org>
138 * cp-gimplify.c (cp_genericize_r): Set IMPORTED_DECL's context.
139 * cp-objcp-common.c (cp_pushdecl): Set decl's context.
140 * decl.c (grokfndecl): Make DECL_CONTEXT setting clearer.
142 2020-07-28 Nathan Sidwell <nathan@acm.org>
144 * class.c (fixup_type_variants): Copy TYPE_SIZE and
146 (finish_struct): Call it.
148 2020-07-28 Nathan Sidwell <nathan@acm.org>
150 * ptree.c (cxx_print_decl): Better indentation.
152 2020-07-28 Jakub Jelinek <jakub@redhat.com>
153 Mark Wielaard <mark@klomp.org>
156 * parser.c (cp_lexer_safe_previous_token): Don't call
157 cp_lexer_previous_token, instead inline it by hand and return NULL
158 instead of failing assertion if all previous tokens until the first
160 (cp_parser_error_1): Optimize - only call cp_lexer_safe_previous_token
161 if token->type is CPP_NAME. Use cp_lexer_safe_previous_token instead
162 of cp_lexer_previous_token for the missing_token_desc != RT_NONE
165 2020-07-27 Nathan Sidwell <nathan@acm.org>
167 * cp-tree.h (enum cp_tree_index): Add CPTI_AS_BASE_IDENTIFIER.
168 (as_base_identifier): Define.
169 * decl.c (initialize_predifined_identifiers): Initialize as_base
171 * class.c (layout_class_type): Name the as-base type. Zap
172 NSDMI its fields may have.
174 2020-07-22 Nathan Sidwell <nathan@acm.org>
176 * class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.
178 2020-07-22 Nathan Sidwell <nathan@acm.org>
180 * typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
182 [UNDERLYING_TYPE]: Use an if.
185 2020-07-22 Nathan Sidwell <nathan@acm.org>
187 * decl.c (decls_match): Move variables into scopes
189 (duplicate_decls): Use STRIP_TEMPLATE.
190 (build_typename_type): Move var decls to their assignments.
191 (begin_function_body): Likewise.
192 * decl2.c (get_guard): Likewise.
193 (mark_used): Use true for truthiness.
194 * error.c (dump_aggr_type): Hold the decl in a var called
197 2020-07-22 Nathan Sidwell <nathan@acm.org>
199 * cp-tree.h (struct tree_lambda_expr): Shrink
200 default_capture_mode & discriminator.
202 2020-07-22 Nathan Sidwell <nathan@acm.org>
204 * mangle.c (decl_is_template_id): Rename to ...
205 (maybe_template_info): ... here. Return the template info,
206 rather than use a pointer. Adjust all callers.
207 (find_substitution): Use template_args_equal, rather than
210 2020-07-22 Tobias Burnus <tobias@codesourcery.com>
212 * parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
213 (cp_parser_omp_critical): Permit hint(0) clause without named critical.
214 * pt.c (tsubst_expr): Re-check the latter for templates.
216 2020-07-21 Sunil K Pandey <skpgkp2@gmail.com>
219 * decl.c (cp_finish_decl): Call target hook
220 lower_local_decl_alignment to lower local decl alignment.
222 2020-07-21 Nathan Sidwell <nathan@acm.org>
224 * parser.c (cp_lexer_consume_token): Drop PRAGMA_EOL assert.
225 (cp_parser_skip_to_closing_parenthesis_1): Only pass start token
226 to pragma skipper if recovering.
227 (cp_parser_skip_to_pragma_eol): Only purge and change pragma
228 state when recovering.
230 2020-07-20 Jason Merrill <jason@redhat.com>
232 * pt.c (type_dependent_expression_p): A pseudo-dtor can be
234 * semantics.c (finish_call_expr): Use build_trivial_dtor_call for
236 (finish_pseudo_destructor_expr): Leave type NULL for dependent arg.
238 2020-07-20 Jason Merrill <jason@redhat.com>
240 * mangle.c (write_base_ref): New.
241 (write_expression): Use it for base field COMPONENT_REFs.
242 * pt.c (invalid_tparm_referent_p): Canonicalize the type
243 of array offsets. Allow subobjects.
245 2020-07-20 Jason Merrill <jason@redhat.com>
247 * pt.c (collect_ctor_idx_types): Add 'const' when deducing from
250 2020-07-17 Marek Polacek <polacek@redhat.com>
253 * decl.c (grokdeclarator): Detect cv-qual decltype(auto).
254 * pt.c (do_auto_deduction): Likewise.
256 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
263 * coroutines.cc (struct coro_ret_data): Delete.
264 (coro_maybe_expand_co_return): Delete.
265 (co_return_expander): Delete.
266 (expand_co_returns): Delete.
267 (co_await_find_in_subtree): Remove unused name.
268 (build_actor_fn): Remove unused parm, remove handling
269 for co_return expansion.
270 (register_await_info): Demote duplicate info message to a
272 (coro_make_frame_entry): Move closer to use site.
273 (struct susp_frame_data): Add fields for final suspend label
274 and a flag to indicate await expressions with initializers.
275 (captures_temporary): Delete.
276 (register_awaits): Remove unused code, update comments.
277 (find_any_await): New.
278 (tmp_target_expr_p): New.
279 (struct interesting): New.
280 (find_interesting_subtree): New.
281 (struct var_nest_node): New.
282 (flatten_await_stmt): New.
283 (handle_nested_conditionals): New.
284 (process_conditional): New.
285 (replace_statement_captures): Rename to...
286 (maybe_promote_temps): ... this.
287 (maybe_promote_captured_temps): Delete.
288 (analyze_expression_awaits): Check for await expressions with
289 initializers. Simplify handling for truth-and/or-if.
290 (expand_one_truth_if): Simplify (map cases that need expansion
292 (await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
293 handling for truth-and/or-if expressions.
294 (register_local_var_uses): Ensure that we create names in the
295 implementation namespace.
296 (morph_fn_to_coro): Add final suspend label to suspend frame
297 callback data and remove it from the build_actor_fn call.
299 2020-07-16 Marek Polacek <polacek@redhat.com>
301 * call.c (convert_like): Remove macro and introduce a new
303 (convert_like_with_context): Likewise.
304 (convert_like_real): Rename to convert_like.
305 (convert_like_real_1): Rename to convert_like_internal. Call
306 convert_like instead of convert_like_real therein.
307 (perform_direct_initialization_if_possible): Call convert_like
308 instead of convert_like_real.
310 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
312 * coroutines.cc: Correct some spelling errors
315 2020-07-15 Nathan Sidwell <nathan@acm.org>
317 * parser.c (cp_parser_declaration): Avoid copying tokens.
318 (cp_parser_block_declaration): RAII token pointer.
320 2020-07-15 Nathan Sidwell <nathan@acm.org>
322 * parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
323 meeting a deferred pragma.
324 (cp_parser_skip_to_end_of_statement): Likewise.
325 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
326 (cp_parser_skip_to_pragma_eol): We should never meet EOF.
327 (cp_parser_omp_declare_simd): Likewise.
328 (cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
329 (pragma_lex): Likewise.
331 2020-07-14 Marek Polacek <polacek@redhat.com>
336 * call.c (convert_like_real_1): Renamed from convert_like_real.
337 (convert_like_real): New wrapper for convert_like_real_1.
339 2020-07-14 Nathan Sidwell <nathan@acm.org>
341 * parser.c (cp_lexer_alloc): Do not deal with PCH here.
342 (cp_lexer_new_main): Deal with PCH here. Store the tokens directly
344 (cp_lexer_new_from_tokens): Assert last token isn't purged either.
345 (cp_lexer_get_preprocessor_token): Change first arg to flags, adjust.
346 (cp_parser_new): Pass the lexer in, don't create it here.
347 (cp_parser_translation_unit): Initialize access checks here.
348 (cp_parser_initial_pragma): First token is provided by caller,
349 don't deal with PCH stopping here. Adjust error message.
350 (c_parse_file): Adjust, change error message to avoid C++20 module
353 2020-07-14 Nathan Sidwell <nathan@acm.org>
355 * ptree.c (cxx_print_type): Add TYPEOF_TYPE and BASES.
357 2020-07-14 Nathan Sidwell <nathan@acm.org>
359 * class.c (build_base_field_1): Cache CLASSTYPE_AS_BASE.
360 (build_self_reference): Rename value -> decl.
361 (dump_class_hierarchy_1): Cache CLASSTYPE_AS_BASE.
363 2020-07-14 Marek Polacek <polacek@redhat.com>
366 * decl.c (grokdeclarator) <case cdk_function>: Check also
367 pointers/references/... to functions.
369 2020-07-14 Nathan Sidwell <nathan@acm.org>
371 * cp-tree.h: Correct some tree lang flag comments,
372 reformat some structure definitions. Note some structure
373 sizes. Clarify some comments.
374 (yyungetc): Delete. Not been a thing for some time.
375 * class.c (copy_fndecl_with_name): Comment.
376 (check_bases_and_members): Unnecessary {}.
377 (layout_class_type): Comment.
378 * cp-tree.def (UNBOUND_CLASS_TEMPLATE): Adjust comment.
379 * decl.c: Fix some formatting & whitespace issues.
380 (function_requirements_equivalent_p): Note why
381 substitutions are needed.
382 * decl2.c (no_linkage_error): Note that heroics about
383 'typedef struct { ... };' are no longer needed.
384 * method.c: Whitespace.
385 * name-lookup.c: Whitespace.
386 (add_decl_to_level): Reformat a line.
387 (print_binding_stack): Mark as DEBUG_FUNCTION.
388 (has_using_namespace_std_directive_p): Delete comment.
390 * ptree.c: Whitespace.
391 * rtti.c: Whitespace & comment.
393 * typeck.c (structural_comptypes): Add comment.
395 2020-07-13 Nathan Sidwell <nathan@acm.org>
397 * Make-lang.in (c++.disclean): Likewise.
399 2020-07-13 Marek Polacek <polacek@redhat.com>
402 * parser.c (cp_parser_enum_specifier): Commit to tentative parse
403 after we've seen an opening brace.
405 2020-07-10 Jason Merrill <jason@redhat.com>
407 * tree.c (structural_type_p): Allow unions.
408 * mangle.c (write_expression): Express unions with a designator.
410 2020-07-10 Jason Merrill <jason@redhat.com>
412 * pt.c (convert_nontype_argument): Handle REAL_TYPE.
413 (invalid_nontype_parm_type_p): Allow all structural types.
414 * tree.c (structural_type_p): Use SCALAR_TYPE_P.
416 2020-07-10 Jason Merrill <jason@redhat.com>
421 * class.c (check_field_decls): An array of empty classes is not an
423 (layout_empty_base_or_field): Handle explicit alignment.
426 2020-07-09 Julian Brown <julian@codesourcery.com>
427 Thomas Schwinge <thomas@codesourcery.com>
430 * semantics.c (finish_omp_clauses): Likewise.
432 2020-07-09 Patrick Palka <ppalka@redhat.com>
435 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
436 Restore dependent_type_p check that guarded the call to
437 is_really_empty_class.
439 2020-07-08 Patrick Palka <ppalka@redhat.com>
442 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
443 When processing_template_decl, check COMPLETE_TYPE_P before
444 calling is_really_empty_class. Don't check dependent_type_p.
446 2020-07-08 Marek Polacek <polacek@redhat.com>
449 * parser.c (cp_parser_decltype): Print error about using decltype(auto)
450 in C++11. Check that the token following "auto" is ")".
452 2020-07-07 Patrick Palka <ppalka@redhat.com>
455 * cxx-pretty-print.c (pp_cxx_unqualified_id): Check
456 PRIMARY_TEMPLATE_P before printing the innermost template
459 2020-07-07 Martin Sebor <msebor@redhat.com>
462 * parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
463 if warning_at returns nonzero.
465 2020-07-06 Martin Sebor <msebor@redhat.com>
468 * call.c (build_over_call): Check calls only when tf_warning is set.
470 2020-07-06 Nathan Sidwell <nathan@acm.org>
472 * decl.c (push_library_fn): Return the decl pushdecl_toplevel returns.
473 * except.c (verify_library_fn): Replace with ...
474 (declare_library_fn_1): ... this fn. Always push the fn.
475 (declare_library_fn): Call it.
476 (build_throw): Call declare_library_fn_1.
478 2020-07-06 Jonathan Wakely <jwakely@redhat.com>
481 * parser.c (cp_parser_toplevel_declaration): Only do pedwarn for
482 empty-declaration in C++98.
484 2020-07-02 Jason Merrill <jason@redhat.com>
485 Jakub Jelinek <jakub@redhat.com>
487 * decl.c (grokfndecl): Allow consteval virtual.
488 * search.c (check_final_overrider): Check consteval mismatch.
489 * constexpr.c (cxx_eval_thunk_call): New.
490 (cxx_eval_call_expression): Call it.
491 * cvt.c (cp_get_fndecl_from_callee): Handle FDESC_EXPR.
492 * decl2.c (mark_vtable_entries): Track vtables with consteval.
493 (maybe_emit_vtables): Pass consteval_vtables through.
494 (clear_consteval_vfns): Replace consteval with nullptr.
495 (c_parse_final_cleanups): Call it.
497 2020-07-01 Nathan Sidwell <nathan@acm.org>
499 * class.c (copy_fndecl_with_name): Add additional predicate args, do
500 not deduce them locally.
501 (copy_operator_fn): Adjust copy_fndecl_with_name call.
502 (build_clone): Add vtt and inherited predicate args. Pass through
503 to copy_fndecl_with_name call.
504 (build_cdtor_clones): Likewise, pass through to build_clone as
506 (build_cdtor): Determine vtt and inherited here.
507 * cp-tree.h (DECL_NEEDS_CTT_PARM_P): Delete.
509 2020-06-30 Nathan Sidwell <nathan@acm.org>
511 * cp-tree.h (copy_fndecl_with_name): Rename to ...
512 (copy_operatorn_fn): ... this. Change arg type.
513 (clone_function_decl): Rename to ...
514 (clone_cdtor): ... this.
515 * class.c (copy_fndecl_with_name): Make static.
516 (copy_operator_fn): New wrapper.
517 (build_clones): Rename to ...
518 (build_cdtor_clones): ... this.
519 (clone_function_decl): Rename to ...
520 (clone_cdtor): ... this. Adjust build_clones calls.
521 (clone_constructors_and_destructors): Adjust clone_function_decl
523 * method.c (implicitly_declare_fn): Adjust copy_fndecl_with_name
525 (lazily_declare_fn): Adjust clone_function_decl call.
526 * pt.c (tsubst_function_decl): Likewise.
527 (instantiate_template_1): Likewise.
529 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
531 * coroutines.cc (morph_fn_to_coro): Remove trailing
532 space in a diagnostic.
534 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
536 * coroutines.cc (expand_one_await_expression): Remove
537 code dealing with initial suspend.
538 (build_actor_fn): Remove code special-casing initial
539 and final suspend. Handle the final suspend and marking
540 of the coroutine as done.
541 (coro_rewrite_function_body): New.
542 (bind_expr_find_in_subtree): Remove.
543 (coro_body_contains_bind_expr_p): Remove.
544 (morph_fn_to_coro): Split the rewrite of the original
545 function into coro_rewrite_function_body and call it.
547 2020-06-29 Marek Polacek <polacek@redhat.com>
550 * decl.c (duplicate_decls): Make sure a concept or a variable
551 template is unique in its declarative region.
553 2020-06-29 Marek Polacek <polacek@redhat.com>
556 * pt.c (collect_ctor_idx_types): Use TREE_TYPE.
558 2020-06-28 Iain Sandoe <iain@sandoe.co.uk>
561 * coroutines.cc (register_local_var_uses): Skip past
564 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
567 * coroutines.cc (get_awaitable_var): New helper.
568 (build_co_await): Check more carefully before
569 copying an awaitable.
570 (expand_one_await_expression): No initializer
571 is required when the awaitable is not a temp.
572 (register_awaits): Remove handling that is now
573 completed when the await expression is built.
575 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
577 * coroutines.cc (morph_fn_to_coro): Diagnose unavailable
578 get_return_object_on_allocation_failure.
580 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
583 * coroutines.cc (struct coroutine_info):Add a field
584 to hold computed p.return_void expressions.
585 (coro_build_promise_expression): New.
586 (get_coroutine_return_void_expr): New.
587 (finish_co_yield_expr): Build the promise expression
588 using coro_build_promise_expression.
589 (finish_co_return_stmt): Likewise.
590 (build_init_or_final_await): Likewise.
591 (morph_fn_to_coro): Likewise, for several cases.
593 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
595 * coroutines.cc (morph_fn_to_coro): Handle error
596 returns in building g-r-o-o-a-f expressions.
598 2020-06-24 Nicholas Krause <xerofoify@gmail.com>
601 * typeck2.c (cxx_incomplete_type_diagnostic): Add missing
602 TYPE_EXPANSION_PACK check for diagnosing incomplete types in
603 cxx_incomplete_type_diagnostic.
605 2020-06-24 Iain Sandoe <iain@sandoe.co.uk>
609 * coroutines.cc (act_des_fn): Copy function
610 attributes onto the outlined coroutine helpers.
612 2020-06-24 Jason Merrill <jason@redhat.com>
614 * call.c (build_over_call): Only call build_base_path once.
616 2020-06-24 Jason Merrill <jason@redhat.com>
619 * call.c (build_over_call): Look up the overrider in base_binfo.
620 * class.c (lookup_vfn_in_binfo): Look through BINFO_PRIMARY_P.
622 2020-06-23 Jason Merrill <jason@redhat.com>
625 Implement C++20 P2082R1, Fixing CTAD for aggregates.
626 * cp-tree.h (TPARMS_PRIMARY_TEMPLATE): Split out from...
627 (DECL_PRIMARY_TEMPLATE): ...here.
628 (builtin_guide_p): Declare.
629 * decl.c (reshape_init_class): Handle bases of a template.
630 (reshape_init_r): An array with dependent bound takes a single
632 * pt.c (tsubst_default_argument): Shortcut {}.
633 (unify_pack_expansion): Allow omitted arguments to trailing pack.
634 (builtin_guide_p): New.
635 (collect_ctor_idx_types): Give a trailing pack a {} default
636 argument. Handle arrays better.
638 2020-06-23 Iain Sandoe <iain@sandoe.co.uk>
641 * coroutines.cc (morph_fn_to_coro): Apply a cleanup to
642 the get return object when the DTOR is non-trivial.
644 2020-06-20 Iain Sandoe <iain@sandoe.co.uk>
647 * coroutines.cc (morph_fn_to_coro): Update handling of
648 get-return-object-on-allocation-fail and diagnose missing
651 2020-06-20 Jason Merrill <jason@redhat.com>
653 * call.c (joust): Only compare constraints for non-template
654 candidates with matching parameters.
655 * pt.c (tsubst_pack_expansion): Fix getting a type parameter
657 (more_specialized_fn): Only compare constraints for candidates with
660 2020-06-19 Jason Merrill <jason@redhat.com>
662 * method.c (early_check_defaulted_comparison): Allow defaulting
663 comparison outside class. Complain if non-member operator isn't a
666 2020-06-18 Jason Merrill <jason@redhat.com>
668 * method.c (early_check_defaulted_comparison): Check for &&.
669 (build_comparison_op): Allow empty union. Diagnose non-category
671 (common_comparison_type): Remove handling for non-category type.
673 2020-06-18 Marek Polacek <polacek@redhat.com>
676 * pt.c (finish_template_variable): Return if
677 coerce_innermost_template_parms return error_mark_node.
679 2020-06-18 Marek Polacek <polacek@redhat.com>
682 * pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
683 if placement is erroneous.
685 2020-06-17 Jonathan Wakely <jwakely@redhat.com>
688 * parser.c (cp_parser_elaborated_type_specifier): Do not warn
689 unless in a declaration.
691 2020-06-17 Jason Merrill <jason@redhat.com>
693 * cp-tree.h (copy_fndecl_with_name): Declare.
694 * class.c (copy_fndecl_with_name): Split out from...
695 (build_clone): ...here.
696 (add_implicitly_declared_members): Add op== to TYPE_FIELDS.
697 * method.c (implicitly_declare_fn): Use copy_fndecl_with_name.
699 2020-06-17 Jason Merrill <jason@redhat.com>
701 * call.c (build_new_op_1): Don't look for a CALL_EXPR when
702 calling a consteval function.
704 2020-06-17 Jason Merrill <jason@redhat.com>
706 * decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED.
707 * decl.c (duplicate_decls): Reduce error for delete
708 after earlier declaration to pedwarn.
710 2020-06-17 Marek Polacek <polacek@redhat.com>
713 * constexpr.c (maybe_fold_non_dependent_expr): New.
714 * cp-tree.h (maybe_fold_non_dependent_expr): Declare.
715 * typeck.c (cp_build_array_ref): Call maybe_fold_non_dependent_expr
716 instead of maybe_constant_value.
718 2020-06-16 Marek Polacek <polacek@redhat.com>
721 * call.c (add_list_candidates): Return if a designated initializer
722 is used with a non-aggregate.
723 (implicit_conversion_error): Give an error for the case above.
725 2020-06-16 Marek Polacek <polacek@redhat.com>
728 * name-lookup.c (check_local_shadow): Check if types are
729 non-null before calling same_type_p.
731 2020-06-16 Jakub Jelinek <jakub@redhat.com>
733 * semantics.c (handle_omp_for_class_iterator): Adjust
734 c_omp_check_loop_iv_exprs caller.
735 (finish_omp_for): Likewise. Don't call fold_build_cleanup_point_expr
736 before calling c_finish_omp_for and c_omp_check_loop_iv, move it
738 * pt.c (tsubst_omp_for_iterator): Handle non-rectangular loops.
740 2020-06-16 Jakub Jelinek <jakub@redhat.com>
742 * parser.c (cp_parser_omp_clause_schedule): Reject modifier separated
743 from kind by comma rather than colon.
745 2020-06-16 Patrick Palka <ppalka@redhat.com>
747 * pt.c (perform_instantiation_time_access_checks): No need to
749 * semantics.c (enforce_access): Verify that decl is not
752 2020-06-16 Patrick Palka <ppalka@redhat.com>
756 * cp-tree.h (qualified_typedef_usage_s): Delete.
757 (qualified_typedef_usage_t): Delete.
758 (deferred_access_check): Move up in file.
759 (tree_template_info::typedefs_needing_access_checking): Delete.
760 (tree_template_info::deferred_access_checks): New field.
761 (TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Rename to ...
762 (TI_DEFERRED_ACCESS_CHECKS): ... this, and adjust accordingly.
763 * pt.c (perform_typedefs_access_check): Rename to ...
764 (perform_instantiation_time_access_checks): ... this, and adjust
765 accordingly. Remove unnecessary tree tests.
766 (instantiate_class_template_1): Adjust accordingly.
767 (instantiate_decl): Likewise.
768 * semantics.c (enforce_access): Likewise.
770 2020-06-16 Patrick Palka <ppalka@redhat.com>
774 * call.c (enforce_access): Move to semantics.c.
775 * cp-tree.h (enforce_access): Delete.
776 (get_types_needing_access_check): Delete.
777 (add_typedef_to_current_template_for_access_check): Delete.
778 * decl.c (make_typename_type): Adjust accordingly. Use
779 check_accessibility_of_qualified_id instead of directly using
780 perform_or_defer_access_check.
781 * parser.c (cp_parser_template_declaration_after_parameters):
782 Don't push a dk_no_check access state when parsing a template.
783 * pt.c (get_types_needing_access_check): Delete.
784 (append_type_to_template_for_access_check_1): Delete.
785 (perform_typedefs_access_check): Adjust. If type_decl is a
786 FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
787 tsubst_copy instead of tsubst to substitute into type_decl so
788 that we substitute into the DECL_CONTEXT of a FIELD_DECL.
789 (append_type_to_template_for_access_check): Delete.
790 * search.c (accessible_p): Remove the processing_template_decl
792 * semantics.c (enforce_access): Moved from call.c. If we're
793 parsing a template and the access check failed, add the check to
794 TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
795 (perform_or_defer_access_check): Adjust comment.
796 (add_typedef_to_current_template_for_access_check): Delete.
797 (check_accessibility_of_qualified_id): Adjust accordingly.
798 Exit early if the scope is dependent.
800 2020-06-11 Patrick Palka <ppalka@redhat.com>
803 * constraint.cc (associate_classtype_constraints): If there is a
804 discrepancy between the current template depth and the template
805 depth of the original declaration, then adjust the template
806 parameter depth within the current constraints appropriately.
807 * pt.c (tsubst_friend_class): Substitute into and set the
808 constraints on the injected declaration.
810 2020-06-11 Iain Sandoe <iain@sandoe.co.uk>
812 * coroutines.cc (instantiate_coro_traits): Pass a reference
813 to lambda closure objects to traits instantiation.
814 (morph_fn_to_coro): Likewise for promise parameter
815 preview and allocator lookup.
817 2020-06-10 Iain Sandoe <iain@sandoe.co.uk>
820 * call.c (add_candidates): Use vec_safe_length() for
821 testing the arguments list.
822 (build_new_method_call_1): Use vec_safe_is_empty() when
823 checking for an empty args list.
825 2020-06-10 Marek Polacek <polacek@redhat.com>
828 * parser.c (cp_parser_direct_declarator): Clear
829 CP_PARSER_FLAGS_DELAY_NOEXCEPT if the declarator kind is not
832 2020-06-09 Iain Sandoe <iain@sandoe.co.uk>
835 * coroutines.cc (expand_one_await_expression): Build separate
836 DTOR trees for the awaitable object on the destroy and resume
839 2020-06-09 Jason Merrill <jason@redhat.com>
842 * cp-gimplify.c (predeclare_vla): Only predeclare a VLA if it's
843 wrapped in a pointer type.
845 2020-06-05 Marek Polacek <polacek@redhat.com>
848 * call.c (build_converted_constant_expr_internal): Allow
851 2020-06-05 Iain Sandoe <iain@sandoe.co.uk>
853 * cp-tree.def (CO_RETURN_EXPR): Correct the class
854 to use tcc_statement.
856 2020-06-05 Jason Merrill <jason@redhat.com>
858 * error.c (dump_binary_op): Handle negative operand to
861 2020-06-04 Jason Merrill <jason@redhat.com>
864 * constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
865 Evaluate OBJ_TYPE_REF_EXPR.
867 2020-06-04 Jason Merrill <jason@redhat.com>
870 * class.c (lookup_vfn_in_binfo): New.
871 * call.c (build_over_call): Use it.
872 * cp-tree.h (resolves_to_fixed_type_p): Add default argument.
873 (lookup_vfn_in_binfo): Declare.
875 2020-06-04 Iain Sandoe <iain@sandoe.co.uk>
878 * coroutines.cc (morph_fn_to_coro): Ensure that the get-
879 return-object is constructed correctly; When it is not the
880 final return value, pass it to the CTOR of the return type
881 as an rvalue, per the standard comment.
883 2020-06-04 Jakub Jelinek <jakub@redhat.com>
887 * constexpr.c (cxx_eval_constant_expression): Diagnose CONVERT_EXPR
888 conversions from pointer types to arithmetic types here...
889 (cxx_eval_outermost_constant_expr): ... instead of here.
891 2020-06-03 Mark Wielaard <mark@klomp.org>
893 * parser.c (cp_lexer_safe_previous_token): New function.
894 (cp_parser_error_1): Add name_hint if the previous token is
895 a string literal and next token is a CPP_NAME and we have a
896 missing header suggestion for the name.
898 2020-06-03 Patrick Palka <ppalka@redhat.com>
900 * pt.c (process_partial_specialization): Pass the full set of
901 generic template arguments to strictly_subsumes.
903 2020-06-03 Patrick Palka <ppalka@redhat.com>
906 * pt.c (most_specialized_partial_spec): Reorganize the loop over
907 DECL_TEMPLATE_SPECIALIZATIONS. Check constraints_satisfied_p on
908 the original template declaration, not on the tsubsted one.
910 2020-06-03 Iain Sandoe <iain@sandoe.co.uk>
913 * coroutines.cc (finish_co_await_expr): Revise to allow for
915 (finish_co_yield_expr): Likewise.
917 2020-06-03 Jason Merrill <jason@redhat.com>
920 * cp-tree.h (predeclare_vla): Declare.
921 * cp-gimplify.c (predeclare_vla): Handle getting a decl.
922 * pt.c (tsubst_expr) [DECL_EXPR]: Use it.
924 2020-06-03 Tobias Burnus <tobias@codesourcery.com>
926 * cp-gimplify.c (cxx_omp_predetermined_mapping): New.
927 * cp-objcp-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redfine.
928 * cp-tree.h (cxx_omp_predetermined_mapping): Declare.
930 2020-06-02 Jason Merrill <jason@redhat.com>
933 * pt.c (tsubst_decl): Relax assert.
935 2020-06-02 Iain Sandoe <iain@sandoe.co.uk>
938 * coroutines.cc (build_co_await): Wrap the co_await expression
939 in a TARGET_EXPR, where needed.
940 (finish_co_yield_expr): Likewise.
942 2020-06-02 Patrick Palka <ppalka@redhat.com>
946 * pt.c (tsubst_function_decl): Don't do set_constraints when
947 regenerating a lambda.
948 (tsubst_lambda_expr): Substitute into the lambda's constraints
949 and do set_constraints here.
951 2020-06-01 Jason Merrill <jason@redhat.com>
956 * class.c (build_vfn_ref): Revert 95311 change.
957 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): Build a
960 2020-06-01 Iain Sandoe <iain@sandoe.co.uk>
963 * coroutines.cc (struct param_info): Remove rv_ref field.
964 (build_actor_fn): Remove specifial rvalue ref handling.
965 (morph_fn_to_coro): Likewise.
967 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
970 * coroutines.cc (morph_fn_to_coro): If we see an
971 early fatal error, drop the erroneous function body.
973 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
975 * coroutines.cc (build_co_await): Remove unused
977 (finish_co_await_expr): Likewise.
978 (finish_co_yield_expr): Likewise; revise comment.
980 2020-05-30 Iain Sandoe <iain@sandoe.co.uk>
982 * coroutines.cc (morph_fn_to_coro): Revise initialization
983 of the frame pointer to avoid an unused value.
985 2020-05-30 Patrick Palka <ppalka@redhat.com>
988 * constraint.cc (satisfaction_value): Accept INTEGER_CST of any
991 2020-05-29 Patrick Palka <ppalka@redhat.com>
992 Jason Merrill <jason@redhat.com>
995 * class.c (add_method): Let special member function templates
996 coexist if they are not equivalently constrained, or in a class
999 2020-05-29 Jason Merrill <jason@redhat.com>
1002 * pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
1003 on the DECL_TEMPLATE_RESULT.
1005 2020-05-29 Marek Polacek <polacek@redhat.com>
1008 * cp-gimplify.c (cp_fold) <case MODIFY_EXPR>: Don't set
1009 TREE_THIS_VOLATILE here.
1010 (cp_fold): Set it here along with TREE_NO_WARNING.
1012 2020-05-29 Jason Merrill <jason@redhat.com>
1016 * class.c (build_vfn_ref): Don't fold the INDIRECT_REF.
1018 2020-05-29 Patrick Palka <ppalka@redhat.com>
1023 * parser.c (cp_parser_requires_clause_expression): Temporarily
1024 increment processing_template_decl only if it is 0.
1025 (cp_parser_constraint_expression): Likewise.
1026 (cp_parser_requires_expression): Likewise.
1028 2020-05-29 Patrick Palka <ppalka@redhat.com>
1031 * constexpr.c (get_or_insert_ctor_field): Add limited support
1032 for RANGE_EXPR index lookups.
1034 2020-05-28 Jakub Jelinek <jakub@redhat.com>
1037 * decl.c (cp_finish_decomp): Call complete_type before checking
1040 2020-05-28 Jason Merrill <jason@redhat.com>
1043 * decl.c (cp_finish_decl): Revert r9-297 change.
1044 (check_static_variable_definition): Likewise.
1045 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
1046 * pt.c (instantiate_decl): Return early on type error.
1048 2020-05-27 Jason Merrill <jason@redhat.com>
1051 * decl.c (reshape_init_array_1): Don't reuse in overload context.
1053 2020-05-27 Jason Merrill <jason@redhat.com>
1056 * call.c (build_new_op_1): Suppress
1057 warn_zero_as_null_pointer_constant across comparison of <=> result
1060 2020-05-27 Jason Merrill <jason@redhat.com>
1063 * decl.c (grokdeclarator): Don't shift attributes in TYPENAME
1066 2020-05-27 Nathan Sidwell <nathan@acm.org>
1069 * pt.c (lookup_template_class_1): Restore alias template mutation.
1071 2020-05-26 Jakub Jelinek <jakub@redhat.com>
1074 * cp-gimplify.c: Include omp-general.h.
1075 (cp_genericize_r) <case OMP_DISTRIBUTE>: For class iteration
1076 variables in composite distribute parallel for, instantiate copy
1077 ctor of their types.
1079 2020-05-23 Patrick Palka <ppalka@redhat.com>
1082 * constexpr.c (cxx_eval_constant_expression)
1083 <case TEMPLATE_ID_EXPR>: Don't evaluate the concept when
1084 constexpr evaluation is uid-sensitive.
1086 2020-05-22 Jason Merrill <jason@redhat.com>
1088 * cp-gimplify.c (cp_gimplify_expr) [CALL_EXPR]: Don't preevaluate
1089 the function address if the call used operator syntax.
1091 2020-05-21 Jason Merrill <jason@redhat.com>
1094 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): For a virtual
1095 call, instrument the OBJ_TYPE_REF.
1097 * decl.c (compute_array_index_type_loc): Diagnose expressions
1098 in a template that can't be constant.
1099 * parser.c (cp_parser_direct_declarator): Don't check
1100 non-constant array bounds here.
1102 * cp-tree.h (is_rvalue_constant_expression): Declare.
1103 * constexpr.c (is_rvalue_constant_expression): New.
1104 * parser.c (cp_parser_constant_expression): Use it.
1105 * decl.c (cp_finish_decl): Try to treat a constexpr initializer in a
1106 template as constant.
1108 * typeck.c (build_x_modify_expr): Handle error_mark_node arguments.
1110 * decl.c (grokparms): Return NULL_TREE if any parms were erroneous.
1112 2020-05-21 Iain Sandoe <iain@sandoe.co.uk>
1114 * coroutines.cc (finish_co_return_stmt): Revert change to use
1117 2020-05-21 Patrick Palka <ppalka@redhat.com>
1120 * constexpr.c (constexpr_ctx::uid_sensitive): Remove field.
1121 (uid_sensitive_constexpr_evaluation_value): Define.
1122 (uid_sensitive_constexpr_evaluation_true_counter): Define.
1123 (uid_sensitive_constexpr_evaluation_p): Define.
1124 (uid_sensitive_constexpr_evaluation_sentinel): Define its
1126 (uid_sensitive_constexpr_evaluation_checker): Define its
1127 constructor and its evaluation_restricted_p method.
1128 (get_fundef_copy): Remove 'ctx' parameter. Use u_s_c_e_p
1129 instead of constexpr_ctx::uid_sensitive.
1130 (cxx_eval_call_expression): Use u_s_c_e_p instead, and test it
1131 last. Adjust call to get_fundef_copy.
1132 (instantiate_cx_fn_r): Test u_s_c_e_p so that we increment the
1133 counter if necessary.
1134 (cxx_eval_outermost_constant_expr): Remove 'uid_sensitive'
1135 parameter. Adjust function body accordingly.
1136 (maybe_constant_value): Remove 'uid_sensitive' parameter and
1137 adjust function body accordingly. Set up a
1138 uid_sensitive_constexpr_evaluation_checker, and use it to
1139 conditionally update the cv_cache.
1140 * cp-gimplify.c (cp_fold): Set up a
1141 uid_sensitive_constexpr_evaluation_checker, and use it to
1142 conditionally update the fold_cache.
1143 * cp-tree.h (maybe_constant_value): Update declaration.
1144 (struct uid_sensitive_constexpr_evaluation_sentinel): Define.
1145 (struct sensitive_constexpr_evaluation_checker): Define.
1146 * expr.c (fold_for_warn): Set up a
1147 uid_sensitive_constexpr_evaluation_sentinel before calling
1148 the folding subroutines. Drop all but the first argument to
1149 maybe_constant_value.
1151 2020-05-20 Marek Polacek <polacek@redhat.com>
1154 * parser.c (cp_parser_unqualified_id): Reject simple-template-id as
1155 the declarator-id of a destructor.
1156 (cp_parser_constructor_declarator_p): Reject simple-template-id as
1157 the declarator-id of a constructor.
1159 2020-05-20 Marek Polacek <polacek@redhat.com>
1163 * cp-tree.h (SD_DECOMPOSITION): New flag.
1164 * decl.c (duplicate_decls): Make sure a structured binding is unique
1165 in its declarative region.
1166 (start_decl): If INITIALIZED is SD_DECOMPOSITION, call
1167 fit_decomposition_lang_decl.
1168 (grokdeclarator): Compare INITIALIZED directly to SD_* flags.
1169 * parser.c (cp_parser_decomposition_declaration): Pass SD_DECOMPOSITION
1172 2020-05-20 Patrick Palka <ppalka@redhat.com>
1175 * typeck.c (structural_comptypes): Don't perform
1176 context-dependent resolution of TYPENAME_TYPEs when
1177 comparing_specializations.
1179 2020-05-19 Nathan Sidwell <nathan@acm.org>
1181 * pt.c (lookup_template_class_1): Do not reinit template_info of an
1184 2020-05-18 Martin Sebor <msebor@redhat.com>
1187 * call.c ((maybe_warn_class_memaccess): Use is_byte_access_type.
1188 * cp-tree.h (is_dummy_object): Return bool.
1189 (is_byte_access_type): Declare new function.
1190 * tree.c (is_dummy_object): Return bool.
1191 (is_byte_access_type): Define new function.
1193 2020-05-19 Patrick Palka <ppalka@redhat.com>
1196 * pt.c (init_template_processing): Enable sanitization for
1197 decl_specializations and type_specializations.
1200 * pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
1201 the 'in_decl' parameter to coerce_template_parms.
1203 2020-05-18 Marek Polacek <polacek@redhat.com>
1206 * typeck.c (cp_build_binary_op): Use fold_for_warn instead of
1209 2020-05-18 Marek Polacek <polacek@redhat.com>
1212 * cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
1213 type is not INDIRECT_TYPE_P.
1214 * decl.c (omp_declare_variant_finalize_one): Call
1215 cp_get_callee_fndecl_nofold instead of looking for the function decl
1218 2020-05-18 Marek Polacek <polacek@redhat.com>
1221 * parser.c (cp_parser_has_attribute_expression): Sorry on a
1222 type-dependent argument.
1224 2020-05-18 Marek Polacek <polacek@redhat.com>
1228 * call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
1229 operator functions when type is std::nullptr_t for ==/!=.
1230 * typeck.c (composite_pointer_type_r): Add a bool * parameter. Use it
1231 to maybe add "const" to the pointer type.
1232 (composite_pointer_type): Update the call to composite_pointer_type_r.
1233 (cp_build_binary_op): Turn two warning_at into error_at. Print the
1236 2020-05-18 Jason Merrill <jason@redhat.com>
1238 * call.c (build_over_call): Remove unnecessary
1239 cp_stabilize_reference.
1241 2020-05-18 Marek Polacek <polacek@redhat.com>
1243 * call.c (add_builtin_candidate): Don't create a builtin overload
1244 candidate for ++ when type is bool in C++17.
1246 2020-05-18 Marek Polacek <polacek@redhat.com>
1248 * cfns.h: Regenerated.
1250 2020-05-17 Iain Sandoe <iain@sandoe.co.uk>
1252 * coroutines.cc (morph_fn_to_coro): Initialize the gro variable.
1254 2020-05-16 Iain Sandoe <iain@sandoe.co.uk>
1256 * coroutines.cc (finish_co_return_stmt): Implement rules
1257 from [class.copy.elision] /3.
1259 2020-05-16 Patrick Palka <ppalka@redhat.com>
1262 * semantics.c (finish_decltype_type): Call
1263 instantiate_non_dependent_expr_sfinae on the expression.
1265 2020-05-15 Patrick Palka <ppalka@redhat.com>
1269 2020-04-07 Patrick Palka <ppalka@redhat.com>
1272 * typeck2.c (process_init_constructor_array): Propagate
1273 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
1274 the array initializer.
1276 2020-05-15 Jason Merrill <jason@redhat.com>
1278 PR c++/93286 - ICE with __is_constructible and variadic template.
1279 * pt.c (tsubst_tree_list): New.
1280 (tsubst, tsubst_copy_and_build): Use it.
1281 * decl2.c (is_late_template_attribute): Handle error_mark_node args.
1283 2020-05-15 Nathan Sidwell <nathan@acm.org>
1285 * pt.c (template_args_equal): Fix thinkos in previous 'cleanup'.
1287 2020-05-14 Jason Merrill <jason@redhat.com>
1290 * pt.c (maybe_instantiate_noexcept): Change clone handling.
1292 2020-05-14 Patrick Palka <ppalka@redhat.com>
1295 * call.c (build_op_call): Pass complain to lookup_fnfields.
1296 (build_special_member_call): Likewise.
1297 * class.c (type_requires_array_cookie): Pass tf_warning_or_error
1299 * cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter.
1300 * except.c (build_throw): Pass tf_warning_or_error to
1302 * init.c (build_new_1): Pass complain to lookup_fnfields.
1303 * method.c (locate_fn_flags): Likewise.
1304 * name-lookup.c (lookup_name_real_1): Pass tf_warning_or_error
1306 * pt.c (tsubst_baselink): Pass complain to lookup_fnfields.
1307 * search.c (lookup_fnfields): New 'complain' parameter. Pass it
1310 2020-05-14 Nathan Sidwell <nathan@acm.org>
1312 * parser.c (cp_parser_diagnose_invalid_typename): Mention
1313 std=c++20 not 2a, reformat dependent binfo inform loops.
1315 * pt.c (tsubst_template_decl): Reorder and commonize some control
1318 * pt.c (tsubst_friend_function): Simplify control flow.
1320 * pt.c (lookup_template_class_1): Remove unnecessary else by
1321 simply grabbing TYPE_NAME earlier.
1323 * pt.c (push_template_decl_real): Adjust friend pushing logic.
1324 Reinit template type.
1326 * pt.c (build_template_decl): Init DECL_TEMPLATE_RESULT &
1328 (process_partial_specialization): ... not here ...
1329 (push_template_decl_real, add_inherited_template_parms)
1330 (build_deduction_guide): ... or here.
1332 2020-05-14 Jakub Jelinek <jakub@redhat.com>
1334 * cp-gimplify.c (cp_genericize_r): Set cfun->has_omp_target.
1336 2020-05-13 Patrick Palka <ppalka@redhat.com>
1339 * init.c (build_vec_delete_1): Just return error_mark_node if
1340 deallocate_expr is error_mark_node.
1341 (build_delete): Just return error_mark_node if do_delete is
1344 2020-05-13 Patrick Palka <ppalka@redhat.com>
1347 * constraint.cc (tsubst_requires_expr): Produce a new
1348 requires-expression when processing_template_decl, even if
1349 template arguments are not dependent.
1351 2020-05-13 Marek Polacek <polacek@redhat.com>
1354 * decl.c (duplicate_decls): Set DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.
1356 2020-05-13 Nathan Sidwell <nathan@acm.org>
1358 * pt.c (template_args_equal): Reorder category checking for
1361 * pt.c (perform_typedefs_access_check): Cache expensively
1362 calculated object references.
1363 (check_auto_in_tmpl_args): Just assert we do not get unexpected
1364 nodes, rather than silently do nothing.
1365 (append_type_to_template_for_access): Likewise, cache expensie
1368 * pt.c (canonical_type_parameter): Simplify.
1370 Formatting fixups & some simplifications.
1371 * pt.c (spec_hash_table): New typedef.
1372 (decl_specializations, type_specializations): Use it.
1373 (retrieve_specialization): Likewise.
1374 (register_specialization): Remove unnecessary casts.
1375 (push_template_decl_real): Reformat.
1376 (instantiate_class_template_1): Use more RAII.
1377 (make_argument_pack): Simplify.
1378 (instantiate_template_1): Use gcc_checking_assert for expensive
1380 (instantiate_decl): Likewise.
1381 (resolve_typename_type): Reformat comment.
1382 * semantics.c (struct deferred_access): Remove unnecessary GTY on
1384 (begin_class_definition): Fix formatting.
1386 2020-05-13 Jason Merrill <jason@redhat.com>
1388 * call.c, class.c, constexpr.c, constraint.cc, decl.c, init.c,
1389 lambda.c, lex.c, method.c, name-lookup.c, parser.c, pt.c, tree.c,
1390 typeck2.c: Change cxx2a to cxx20.
1392 2020-05-12 Marek Polacek <polacek@redhat.com>
1395 * parser.c (cp_parser_postfix_expression) <case CPP_OPEN_PAREN>: When
1396 looking for a block-scope function declaration, look through the whole
1397 set, not just the first function in the overload set.
1399 2020-05-12 Jakub Jelinek <jakub@redhat.com>
1402 * pt.c (tsubst_decl): Deal with DECL_OMP_PRIVATIZED_MEMBER for
1405 2020-05-11 Jason Merrill <jason@redhat.com>
1407 Resolve C++20 NB comment CA104
1408 * pt.c (determine_specialization): Compare constraints for
1409 specialization of member template of class instantiation.
1411 2020-05-11 Jason Merrill <jason@redhat.com>
1415 * tree.c (cp_walk_subtrees): Stop at typedefs.
1416 Handle TYPENAME_TYPE here.
1417 * pt.c (find_parameter_packs_r): Not here.
1418 (for_each_template_parm_r): Clear *walk_subtrees.
1419 * decl2.c (min_vis_r): Look through typedefs.
1421 2020-05-11 Jason Merrill <jason@redhat.com>
1423 * call.c (implicit_conversion_error): Split out from...
1424 (perform_implicit_conversion_flags): ...here.
1425 (build_converted_constant_expr_internal): Use it.
1427 2020-05-11 Jason Merrill <jason@redhat.com>
1430 * parser.c (inject_parm_decls): Set current_class_ptr here.
1431 (cp_parser_direct_declarator): And here.
1432 (cp_parser_late_return_type_opt): Not here.
1433 (cp_parser_noexcept_specification_opt): Nor here.
1434 (cp_parser_exception_specification_opt)
1435 (cp_parser_late_noexcept_specifier): Remove unneeded parameters.
1437 2020-05-11 Jason Merrill <jason@redhat.com>
1439 * decl.c (cxx_init_decl_processing): Call declare_weak for
1442 2020-05-11 Jason Merrill <jason@redhat.com>
1444 * pt.c (instantiate_class_template_1): Call tsubst_expr for
1445 STATIC_ASSERT member.
1446 * ptree.c (cxx_print_xnode): Handle STATIC_ASSERT.
1448 2020-05-11 Jason Merrill <jason@redhat.com>
1450 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Remove redundant
1451 walking of capture list.
1453 2020-05-11 Jason Merrill <jason@redhat.com>
1455 * cp-tree.h (LOOKUP_EXPLICIT_TMPL_ARGS): Remove.
1456 * call.c (build_new_function_call): Don't set it.
1457 (build_new_method_call_1): Likewise.
1458 (build_over_call): Check cand->explicit_targs instead.
1460 2020-05-11 Jason Merrill <jason@redhat.com>
1462 * decl.c (compute_array_index_type_loc): Stabilize before building
1465 2020-05-11 Jason Merrill <jason@redhat.com>
1467 * decl.c (grokdeclarator): Adjust deprecated_state here.
1468 (start_decl): Not here.
1470 2020-05-08 Iain Sandoe <iain@sandoe.co.uk>
1473 * coroutines.cc (build_actor_fn): Ensure that bind scopes
1474 are marked as having side-effects where necessary.
1475 (replace_statement_captures): Likewise.
1476 (morph_fn_to_coro): Likewise.
1478 2020-05-08 Nathan Sidwell <nathan@acm.org>
1480 * NEWS: Delete, it is so stale.
1482 * parser.c (cp_lexer_set_source_position_from_token): EOF has a
1485 2020-05-07 Iain Sandoe <iain@sandoe.co.uk>
1489 * coroutines.cc (morph_fn_to_coro): Set unformed outline
1490 functions to error_mark_node. For early error returns suppress
1491 warnings about missing ramp return values. Fix reinstatement
1492 of the function body on pre-existing initial error.
1493 * decl.c (finish_function): Use the normal error path for fails
1494 in the ramp function, do not try to compile the helpers if the
1497 2020-05-07 Marek Polacek <polacek@redhat.com>
1499 PR c++/94590 - Detect long double -> double narrowing.
1500 * typeck2.c (check_narrowing): Detect long double -> double
1501 narrowing even when double and long double have the same
1502 precision. Make it handle conversions to float too.
1504 2020-05-07 Marek Polacek <polacek@redhat.com>
1507 * parser.c (cp_parser_class_specifier_1): Check that the scope is
1508 nested inside current scope before pushing it.
1510 2020-05-07 Marek Polacek <polacek@redhat.com>
1513 * typeck2.c (check_narrowing): Consider T* to bool narrowing
1516 2020-05-07 Marek Polacek <polacek@redhat.com>
1518 * decl.c (grok_op_properties): Fix spelling of non-static.
1519 * typeck.c (build_class_member_access_expr): Likewise.
1521 2020-05-07 Richard Biener <rguenther@suse.de>
1524 * optimize.c (update_cloned_parm): Copy DECL_NOT_GIMPLE_REG_P.
1526 2020-05-06 Marek Polacek <polacek@redhat.com>
1529 * pt.c (tsubst_copy_and_build): Call type_dependent_expression_p_push
1530 instead of uses_template_parms. Move the warning_sentinels after the
1533 2020-05-06 Jakub Jelinek <jakub@redhat.com>
1536 * typeck.c (cp_strict_aliasing_warning): New function.
1537 (cp_build_indirect_ref_1, build_reinterpret_cast_1): Use
1538 it instead of strict_aliasing_warning.
1541 * method.c (defaulted_late_check): Don't call synthesize_method
1542 on constexpr sfk_comparison if it has been called on it already.
1544 2020-05-06 Nathan Sidwell <nathan@acm.org>
1547 * decl.c (grokdeclarator): Don't splice template attributes in
1548 parm context -- they can apply to the parm.
1550 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
1552 * coroutines.cc: Remove references to n4849 throughout.
1554 2020-05-05 Jason Merrill <jason@redhat.com>
1557 * pt.c (more_specialized_fn): Do consider parms with no deducible
1558 template parameters.
1560 2020-05-05 Jason Merrill <jason@redhat.com>
1563 * constexpr.c (potential_constant_expression_1): In a lambda
1564 function, consider a captured variable directly.
1566 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
1568 * coroutines.cc (transform_await_wrapper): Check that we have
1569 no unlowered co_yields.
1570 (captures_temporary): Likewise.
1571 (register_awaits): Likewise.
1573 2020-05-05 Nathan Sidwell <nathan@acm.org>
1576 * coroutines.cc (morph_fn_to_coro): Just check for
1578 * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name.
1580 2020-05-05 Marek Polacek <polacek@redhat.com>
1581 Jason Merrill <jason@redhat.com>
1584 * parser.c (cp_parser_postfix_dot_deref_expression): If we have
1585 a type-dependent object of class type, stash it to
1586 parser->context->object_type. If the postfix expression doesn't have
1588 (cp_parser_class_name): Consider object scope too.
1589 (cp_parser_lookup_name): Remove code dealing with the case when
1590 object_type is unknown_type_node.
1592 2020-05-04 Patrick Palka <ppalka@redhat.com>
1595 * cp-gimplify.c (cp_fold) <case CALL_EXPR>: Move some variable
1596 declarations closer to their uses. Copy the CALL_EXPR only
1597 when one of its arguments has changed.
1598 <case TREE_VEC>: Instead of first collecting the folded
1599 arguments into a releasing_vec, just make a copy of the TREE_VEC
1600 as soon as folding changes one of its arguments.
1602 2020-05-04 Iain Sandoe <iain@sandoe.co.uk>
1604 * coroutines.cc (morph_fn_to_coro): Mark the coro.gro variable
1605 as artificial and ignored.
1607 2020-05-04 Nathan Sidwell <nathan@acm.org>
1609 pt.c (process_template_parm): Don't walk the template list twice,
1610 remember the final node instead.
1611 (end_template_parm_list): Refactor. Comment on why we do a pop
1614 PR c++/94827 -- don't save parms in nested requirement
1615 * constraint.cc (tsubst_nested_requirement): TYPE directly holds
1616 notmalized requirement.
1617 (finish_nested_requirement): Don't stash current tpl parms into
1619 (diagnose_nested_requirement): TYPE directly holds notmalized
1622 2020-05-01 Patrick Palka <ppalka@redhat.com>
1625 * cp-tree.h (check_accessibility_of_qualified_id): Add
1626 tsubst_flags_t parameter and change return type to bool.
1627 * parser.c (cp_parser_lookup_name): Pass tf_warning_to_error to
1628 check_accessibility_of_qualified_id.
1629 * pt.c (tsubst_qualified_id): Return error_mark_node if
1630 check_accessibility_of_qualified_id returns false.
1631 * semantics.c (check_accessibility_of_qualified_id): Add
1632 complain parameter. Pass complain instead of
1633 tf_warning_or_error to perform_or_defer_access_check. Return
1634 true unless perform_or_defer_access_check returns false.
1636 2020-05-01 Marek Polacek <polacek@redhat.com>
1639 * typeck2.c (process_init_constructor_record): Return PICFLAG_ERRONEOUS
1640 if an initializer element was erroneous.
1642 2020-05-01 Jason Merrill <jason@redhat.com>
1645 * init.c (get_nsdmi): Don't push_to_top_level for a local class.
1647 2020-05-01 Jason Merrill <jason@redhat.com>
1650 * decl.c (cp_finish_decl): Also clear TREE_READONLY if
1651 -fmerge-all-constants.
1653 2020-05-01 Jason Merrill <jason@redhat.com>
1656 * pt.c (tsubst_decl): Make sure DECL_VALUE_EXPR continues to have
1657 the same type as the variable.
1659 2020-04-30 Jason Merrill <jason@redhat.com>
1660 Nathan Sidwell <nathan@acm.org>
1663 * constraint.cc (map_arguments): If ARGS is null, it's a
1664 self-mapping of parms.
1665 (finish_nested_requirement): Do not pass argified
1666 current_template_parms to normalization.
1667 (tsubst_nested_requirement): Don't assert no template parms.
1669 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
1672 * coroutines.cc (transform_local_var_uses): Defer walking
1673 the DECL_INITIALs of BIND_EXPR vars until all the frame
1674 allocations have been made.
1676 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
1679 * coroutines.cc (register_awaits): Update target
1680 expressions for awaitable and suspend handle
1683 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
1686 * coroutines.cc (build_co_await): Account for variables
1687 with DECL_VALUE_EXPRs.
1688 (captures_temporary): Likewise.
1689 (register_awaits): Likewise.
1691 2020-04-29 Patrick Palka <ppalka@redhat.com>
1694 * pt.c (find_template_parameter_info::parm_list): New field.
1695 (keep_template_parm): Use the new field to build up the
1696 parameter list here instead of ...
1697 (find_template_parameters): ... here. Return ftpi.parm_list.
1699 2020-04-29 Jakub Jelinek <jakub@redhat.com>
1702 * class.c (build_base_field): Set DECL_FIELD_ABI_IGNORED on C++17 empty
1703 base artificial FIELD_DECLs.
1704 (layout_class_type): Set DECL_FIELD_ABI_IGNORED on empty class
1705 field_poverlapping_p FIELD_DECLs.
1707 2020-04-29 Patrick Palka <ppalka@redhat.com>
1710 * constraint.cc (satisfy_declaration_constraints): Use saved_t
1711 instead of t as the key to decl_satisfied_cache.
1714 * error.c (print_requires_expression_info): Print the dependent
1715 form of the parameter list with its template parameter mapping,
1716 rather than printing the substituted form.
1718 2020-04-28 Jason Merrill <jason@redhat.com>
1721 * decl.c (use_eh_spec_block): Check nothrow type after
1723 * pt.c (maybe_instantiate_noexcept): Call synthesize_method for
1724 DECL_MAYBE_DELETED fns here.
1725 * decl2.c (mark_used): Not here.
1726 * method.c (get_defaulted_eh_spec): Reject DECL_MAYBE_DELETED here.
1728 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
1731 * coroutines.cc (instantiate_coro_traits): Pass a reference to
1732 object type rather than a pointer type for 'this', for method
1734 (struct param_info): Add a field to hold that the parm is a lambda
1736 (morph_fn_to_coro): Check for lambda closure pointers in the
1737 args. Use a reference to *this when building the args list for the
1738 promise allocator lookup.
1740 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
1743 * coroutines.cc (coro_promise_type_found_p): Do not
1744 exclude non-classes here (this needs to be handled in the
1746 (morph_fn_to_coro): Allow for the case where the coroutine
1749 2020-04-27 Iain Sandoe <iain@sandoe.co.uk>
1752 * coroutines.cc (struct local_var_info): Add fields for static
1753 variables and those with DECL_VALUE_EXPR redirection.
1754 (transform_local_var_uses): Skip past typedefs and static vars
1755 and then account for redirected variables.
1756 (register_local_var_uses): Likewise.
1758 2020-04-27 Jason Merrill <jason@redhat.com>
1762 * decl.c (grokdeclarator): Move dependent attribute to decl.
1763 * decl2.c (splice_template_attributes): No longer static.
1765 2020-04-27 Patrick Palka <ppalka@redhat.com>
1768 * constexpr.c (cxx_eval_call_expression): Don't set new_obj if we're
1769 evaluating the target constructor of a delegating constructor.
1770 (cxx_eval_store_expression): Don't set TREE_READONLY if the LHS of the
1771 INIT_EXPR is '*this'.
1773 2020-04-26 Marek Polacek <polacek@redhat.com>
1776 * call.c (struct conversion): Add copy_init_p.
1777 (standard_conversion): Set copy_init_p in ck_base and ck_rvalue
1778 if FLAGS demands LOOKUP_ONLYCONVERTING.
1779 (convert_like_real) <case ck_base>: If copy_init_p is set, or
1780 LOOKUP_ONLYCONVERTING into FLAGS.
1782 2020-04-26 Iain Sandoe <iain@sandoe.co.uk>
1785 * coroutines.cc (morph_fn_to_coro): Ensure that
1786 unnamed function params have a usable and distinct
1789 2020-04-24 Jason Merrill <jason@redhat.com>
1792 * decl.c (redeclaration_error_message): Reject defaulted comparison
1793 operator that has been previously declared.
1795 2020-04-25 Patrick Palka <ppalka@redhat.com>
1797 * parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
1798 concepts if the invalid identifier is 'requires'.
1800 2020-04-25 Jakub Jelinek <jakub@redhat.com>
1803 * semantics.c (finish_call_expr): When looking if all overloads
1804 are noreturn, use STRIP_TEMPLATE to look through TEMPLATE_DECLs.
1806 2020-04-24 Martin Liska <mliska@suse.cz>
1808 * coroutines.cc: Fix compilation error for release checking
1809 where we miss declaration of ‘coro_body_contains_bind_expr_p’.
1811 2020-04-23 Patrick Palka <ppalka@redhat.com>
1813 * tree.c (zero_init_expr_p): Use uses_template_parms instead of
1817 * pt.c (template_class_depth): Walk into the DECL_FRIEND_CONTEXT of a
1818 friend declaration rather than into its CP_DECL_CONTEXT.
1820 2020-04-23 Iain Sandoe <iain@sandoe.co.uk>
1823 * coroutines.cc (await_statement_expander): Simplify cases.
1824 (struct susp_frame_data): Add fields for truth and/or if
1825 cases, rename one field.
1826 (analyze_expression_awaits): New.
1827 (expand_one_truth_if): New.
1828 (add_var_to_bind): New helper.
1829 (coro_build_add_if_not_cond_break): New helper.
1830 (await_statement_walker): Handle conditional expressions,
1831 handle expansion of truth-and/or-if cases.
1832 (bind_expr_find_in_subtree): New, checking-only.
1833 (coro_body_contains_bind_expr_p): New, checking-only.
1834 (morph_fn_to_coro): Ensure that we have a top level bind
1837 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
1839 PR translation/94698
1840 * class.c (check_field_decls): Change "define" to "declare" in
1841 -Weffc++ diagnostics.
1843 2020-04-22 Patrick Palka <ppalka@redhat.com>
1847 * constraint.cc (satisfy_declaration_constraints): If the inherited
1848 constructor points to an instantiation of a constructor template,
1849 remember and use its attached template arguments.
1851 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
1853 PR translation/94698
1854 * class.c (check_field_decls): Change "override" to "define" in
1855 -Weffc++ diagnostics.
1857 2020-04-22 Iain Sandoe <iain@sandoe.co.uk>
1860 * coroutines.cc (struct param_info): Add a field to note that
1861 the param is 'this'.
1862 (morph_fn_to_coro): Convert this to a reference before using it
1863 in the promise parameter preview.
1865 2020-04-22 Jason Merrill <jason@redhat.com>
1868 * pt.c (register_parameter_specializations): If the instantiation is
1869 still a parameter pack, don't wrap it in a NONTYPE_ARGUMENT_PACK.
1870 (tsubst_pack_expansion, tsubst_expr): Adjust.
1872 2020-04-22 Martin Sebor <msebor@redhat.com>
1873 Jason Merrill <jason@redhat.com>
1876 * decl.c (reshape_init_array_1): Avoid stripping redundant trailing
1877 zero initializers...
1878 * mangle.c (write_expression): ...and handle them here even for
1879 pointers to members by calling zero_init_expr_p.
1880 * cp-tree.h (zero_init_expr_p): Declare.
1881 * tree.c (zero_init_expr_p): Define.
1882 (type_initializer_zero_p): Remove.
1883 * pt.c (tparm_obj_values): New hash_map.
1884 (get_template_parm_object): Store to it.
1885 (tparm_object_argument): New.
1887 2020-04-22 Patrick Palka <ppalka@redhat.com>
1890 * constraint.cc (diagnose_valid_expression): Check convert_to_void here
1891 as well as in tsubst_valid_expression_requirement.
1893 2020-04-21 Patrick Palka <ppalka@redhat.com>
1896 * constraint.cc (satisfy_declaration_constraints): Don't strip the
1897 inherited constructor if it already has template information.
1900 * pt.c (any_template_parm_r) <case IDENTIFIER_NODE>: New case. If this
1901 is a conversion operator, visit its TREE_TYPE.
1903 2020-04-21 Nathan Sidwell <nathan@acm.org>
1905 * pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for
1908 2020-04-21 Iain Sandoe <iain@sandoe.co.uk>
1911 * coroutines.cc (morph_fn_to_coro): Simplify return
1914 2020-04-17 Marek Polacek <polacek@redhat.com>
1917 * constexpr.c (cxx_eval_outermost_constant_expr): Return when T is
1918 a BRACE_ENCLOSED_INITIALIZER_P.
1919 (is_nondependent_constant_expression): Don't check
1920 BRACE_ENCLOSED_INITIALIZER_P.
1921 (is_nondependent_static_init_expression): Likewise.
1923 2020-04-20 Patrick Palka <ppalka@redhat.com>
1926 * cp-tree.h (lss_policy::lss_nop): New enumerator.
1927 * pt.c (local_specialization_stack::local_specialization_stack): Handle
1929 (local_specialization_stack::~local_specialization_stack): Likewise.
1930 (tsubst_pack_expansion): Use a local_specialization_stack instead of
1931 manually saving and restoring local_specializations. Conditionally
1932 replace local_specializations sooner, before the handling of the
1933 unsubstituted_packs case.
1935 2020-04-20 Marek Polacek <polacek@redhat.com>
1937 PR c++/94505 - bogus -Wparentheses warning with fold-expression.
1938 * pt.c (fold_expression): Add warning_sentinel for -Wparentheses
1939 before calling build_x_binary_op.
1941 2020-04-20 Marek Polacek <polacek@redhat.com>
1943 * coroutines.cc (captures_temporary): Don't assign the result of
1944 STRIP_NOPS to the same variable.
1946 2020-04-20 Nathan Sidwell <nathan@acm.org>
1948 PR c++/94454 - tpl-tpl-parms are not canonicalizable types
1949 * pt.c (canonical_type_parameter): Assert not a tpl-tpl-parm.
1950 (process_template_parm): tpl-tpl-parms are structural.
1951 (rewrite_template_parm): Propagate structuralness.
1953 PR c++/94454 - Expr pack expansion equality
1954 * tree.c (cp_tree_equal) [TEMPLATE_ID_EXPR, default]: Refactor.
1955 [EXPR_PACK_EXPANSION]: Add.
1957 PR c++/94454 Template Argument Hashing
1958 * pt.c (iterative_hash_template_arg): Strip nodes as
1959 template_args_equal does.
1960 [ARGUMENT_PACK_SELECT, TREE_VEC, CONSTRUCTOR]: Refactor.
1961 [node_class:TEMPLATE_TEMPLATE_PARM]: Hash by level & index.
1962 [node_class:default]: Refactor.
1964 2020-04-18 Patrick Palka <ppalka@redhat.com>
1967 * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
1968 comparing_specializations if the parameters' contexts are identical.
1971 * pt.c (splice_late_return_type): Propagate cv-qualifiers and
1972 PLACEHOLDER_TYPE_CONSTRAINTS from the original auto node to the new one.
1974 2020-04-17 Patrick Palka <ppalka@redhat.com>
1977 * lambda.c (lambda_capture_field_type): Avoid doing auto deduction if
1978 the explicit initializer has parameter packs.
1981 * parser.c (cp_parser_check_template_parameters): Before issuing a hard
1982 error, first try simulating an error instead.
1984 2020-04-17 Jakub Jelinek <jakub@redhat.com>
1987 * call.c (build_conditional_expr_1): Remove redundant assignment to
1990 2020-04-16 Patrick Palka <ppalka@redhat.com>
1993 * cvt.c (ocp_convert): If the result of scalar_constant_value is
1994 erroneous, ignore it and use the original expression.
1996 2020-04-16 Jakub Jelinek <jakub@redhat.com>
1999 * parser.c (cp_parser_simple_declaration): Fix up a pasto in
2002 2020-04-15 Jakub Jelinek <jakub@redhat.com>
2005 * parser.c (cp_parser_pragma) <case PRAGMA_OMP_REQUIRES>: Reject
2006 requires directive when not at file or namespace scope.
2008 2020-04-14 Iain Sandoe <iain@sandoe.co.uk>
2011 * coroutines.cc (build_actor_fn): Check that the target can
2012 support the resume tailcall before mandating it.
2014 2020-04-14 Patrick Palka <ppalka@redhat.com>
2017 * cxx-pretty-print.c (cxx_pretty_printer:simple_type_specifier)
2018 <case DECLTYPE_TYPE>: Handle DECLTYPE_TYPE here instead of ...
2019 (pp_cxx_type_specifier_seq) <case DECLTYPE_TYPE>: ... here.
2020 (cxx_pretty_printer::direct_abstract_declarator) <case DECLTYPE_TYPE>:
2024 * constexpr.c (replace_result_decl_data): New struct.
2025 (replace_result_decl_data_r): New function.
2026 (replace_result_decl): New function.
2027 (cxx_eval_call_expression): Use it.
2028 * tree.c (build_aggr_init_expr): Set the location of the AGGR_INIT_EXPR
2029 to that of its initializer.
2031 2020-04-13 Marek Polacek <polacek@redhat.com>
2034 * name-lookup.c (check_local_shadow): Add an inform call.
2036 2020-04-13 Patrick Palka <ppalka@redhat.com>
2039 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
2040 dump_function_decl when printing a function template instantiation as a
2044 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
2046 (cxx_eval_bare_aggregate): Use get_or_insert_ctor_field instead of
2047 assuming the the next index belongs at the end of the new CONSTRUCTOR.
2048 (cxx_eval_store_expression): Revert PR c++/78572 fix.
2050 2020-04-13 Nathan Sidwell <nathan@acm.org>
2052 PR c++/94426 lambdas with internal linkage are different to no-linkage
2053 * decl2.c (determine_visibility): A lambda's visibility is
2054 affected by its extra scope.
2055 * pt.c (instantiate_decl): Determine var's visibility before
2056 instantiating its initializer.
2057 * tree.c (no_linkage_check): Revert code looking at visibility of
2058 lambda's extra scope.
2060 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
2063 * coroutines.cc (co_await_expander): Remove.
2064 (expand_one_await_expression): New.
2065 (process_one_statement): New.
2066 (await_statement_expander): New.
2067 (build_actor_fn): Revise to use per-statement expander.
2068 (struct susp_frame_data): Reorder and comment.
2069 (register_awaits): Factor code.
2070 (replace_statement_captures): New, factored from...
2071 (maybe_promote_captured_temps):.. here.
2072 (await_statement_walker): Revise to process per statement.
2073 (morph_fn_to_coro): Use revised susp_frame_data layout.
2075 2020-04-10 Marek Polacek <polacek@redhat.com>
2078 * method.c (constructible_expr): In C++20, try using parenthesized
2079 initialization of aggregates to determine the result of
2082 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
2084 * coroutines.cc (co_await_expander): Simplify.
2086 2020-04-09 Jason Merrill <jason@redhat.com>
2089 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
2090 ctx->object and ctx->global->values first.
2092 2020-04-09 Marek Polacek <polacek@redhat.com>
2095 * call.c (initialize_reference): If the reference binding failed, maybe
2096 try initializing from { }.
2097 * decl.c (grok_reference_init): For T& t(e), set
2098 LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet.
2100 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
2101 Jun Ma <JunMa@linux.alibaba.com>
2103 * coroutines.cc (maybe_promote_captured_temps): Add a cleanup
2104 expression, if needed, to any call from which we promoted
2105 temporaries captured by reference.
2107 2020-04-08 Marek Polacek <polacek@redhat.com>
2109 PR c++/94507 - ICE-on-invalid with lambda template.
2110 * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
2111 tsubst_function_decl returns error_mark_node.
2113 2020-04-08 Martin Liska <mliska@suse.cz>
2116 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
2117 (cxx_init_decl_processing): Mark replaceable all implicitly defined
2120 2020-04-08 Patrick Palka <ppalka@redhat.com>
2122 Core issues 1001 and 1322
2124 * pt.c (rebuild_function_or_method_type): Split function out from ...
2125 (tsubst_function_type): ... here.
2126 (maybe_rebuild_function_decl_type): New function.
2127 (tsubst_function_decl): Use it.
2129 2020-04-08 Jakub Jelinek <jakub@redhat.com>
2132 * decl.c (begin_destructor_body): For CLASSTYPE_VBASECLASSES class
2133 dtors, if CLASSTYPE_PRIMARY_BINFO is non-NULL, but not BINFO_VIRTUAL_P,
2134 look at CLASSTYPE_PRIMARY_BINFO of its BINFO_TYPE if it is not
2135 BINFO_VIRTUAL_P, and so on.
2137 2020-04-08 Marek Polacek <polacek@redhat.com>
2139 PR c++/94478 - ICE with defaulted comparison operator
2140 * method.c (early_check_defaulted_comparison): Give an error when the
2143 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
2146 * paser.c (cp_parser_oacc_declare): Add check that variables
2147 are declared in the same scope as the directive.
2149 2020-04-07 Jason Merrill <jason@redhat.com>
2152 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
2155 * parser.c (cp_parser_placeholder_type_specifier): Use
2158 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
2160 * coroutines.cc (maybe_promote_captured_temps): Ensure that
2161 reference capture placeholder vars are properly declared.
2163 2020-04-07 Patrick Palka <ppalka@redhat.com>
2166 * tree.c (replace_placeholders): Look through all handled components,
2167 not just COMPONENT_REFs.
2168 * typeck2.c (process_init_constructor_array): Propagate
2169 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
2170 the array initializer.
2172 2020-04-07 Jakub Jelinek <jakub@redhat.com>
2175 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
2176 if cp_parser_omp_master succeeded.
2178 2020-04-06 Jason Merrill <jason@redhat.com>
2181 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
2183 2020-04-04 Marek Polacek <polacek@redhat.com>
2184 Jason Merrill <jason@redhat.com>
2186 PR c++/94155 - crash in gimplifier with paren init of aggregates.
2187 * init.c (build_vec_init): Fill in indexes.
2189 2020-04-04 Jason Merrill <jason@redhat.com>
2192 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
2194 2020-04-04 Patrick Palka <ppalka@redhat.com>
2198 * constexpr.c (struct constexpr_ctx): New field 'parent'.
2199 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
2200 flag from the original constructor to the reduced constructor.
2201 (lookup_placeholder): Prefer to return the outermost matching object
2202 by recursively calling lookup_placeholder on the 'parent' context,
2203 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
2204 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
2205 context via 'new_ctx.parent' when being expanded without an explicit
2206 target. Don't call replace_placeholders.
2207 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
2211 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
2212 support for VECTOR_TYPEs, and optimizations for the common case)
2214 (cxx_eval_store_expression): ... here. Rename local variable
2215 'changed_active_union_member_p' to 'activated_union_member_p'. Record
2216 the sequence of indexes into 'indexes' that yields the subobject we're
2217 assigning to. Record the integer offsets of the constructor indexes
2218 we're assigning through into 'index_pos_hints'. After evaluating the
2219 initializer of the store expression, recompute 'valp' using 'indexes'
2220 and using 'index_pos_hints' as hints.
2221 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
2222 to recompute the constructor_elt pointer we're assigning through after
2223 evaluating each initializer.
2225 2020-04-04 Jason Merrill <jason@redhat.com>
2228 * constraint.cc (tsubst_valid_expression_requirement): Call
2231 2020-04-04 Jason Merrill <jason@redhat.com>
2234 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
2235 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
2238 2020-04-04 Jakub Jelinek <jakub@redhat.com>
2241 * parser.c (cp_parser_omp_for_loop): Use
2242 protected_set_expr_location_if_unset.
2243 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
2246 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
2247 omp_parallel_combined_clauses.
2249 2020-04-03 Jason Merrill <jason@redhat.com>
2252 * pt.c (complex_pack_expansion_r): New.
2253 (complex_alias_template_p): Use it.
2255 2020-03-31 Jason Merrill <jason@redhat.com>
2258 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
2259 replace_placeholders.
2260 * typeck2.c (store_init_value): Fix arguments to
2261 fold_non_dependent_expr.
2263 2020-03-31 Jason Merrill <jason@redhat.com>
2265 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
2268 2020-03-30 Jason Merrill <jason@redhat.com>
2271 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
2272 (called_fns_equal): Check DECL_CONTEXT.
2274 2020-03-30 Jakub Jelinek <jakub@redhat.com>
2277 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
2278 STATEMENT_CODE_P code.
2280 2020-03-28 Patrick Palka <ppalka@redhat.com>
2283 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
2284 "requires {" when "requires requires {" was probably intended.
2287 * constraint.cc (tsubst_compound_requirement): Always suppress errors
2288 from type_deducible_p and expression_convertible_p, as they're not
2289 substitution errors.
2290 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
2291 that we diagnose INTEGER_CST expressions of non-bool type via the
2293 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
2294 * parser.c (cp_parser_requires_expression): Always parse the requirement
2295 body as if we're processing a template, by temporarily incrementing
2296 processing_template_decl. Afterwards, if we're not actually in a
2297 template context, perform semantic processing to diagnose any invalid
2298 types and expressions.
2299 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
2300 * semantics.c (finish_static_assert): Explain an assertion failure
2301 when the condition is a REQUIRES_EXPR like we do when it is a concept
2304 * constraint.cc (diagnose_compound_requirement): When diagnosing a
2305 compound requirement, maybe replay the satisfaction failure, subject to
2306 the current diagnosis depth.
2308 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
2309 as well as its range, because build_x_binary_op doesn't always do so.
2310 (current_constraint_diagnosis_depth): New.
2311 (concepts_diagnostics_max_depth_exceeded_p): New.
2312 (collect_operands_of_disjunction): New.
2313 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
2314 replay each branch of the disjunction, subject to the current diagnosis
2316 (diagnose_valid_expression): When diagnosing a satisfaction failure,
2317 maybe replay the substitution error, subject to the current diagnosis
2319 (diagnose_valid_type): Likewise.
2320 (diagnose_nested_requiremnet): Likewise.
2321 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
2322 current_constraint_diagnosis_depth when diagnosing.
2323 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
2324 current_constraint_diagnosis_depth when diagnosing.
2325 (diagnosing_failed_constraint::replay_errors_p): New static member
2327 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
2328 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
2329 the limit was exceeded.
2330 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
2332 2020-03-27 Nathan Sidwell <nathan@acm.org>
2335 * name-lookup.c (do_pushdecl): Look through cleanp levels.
2337 2020-03-27 Martin Sebor <msebor@redhat.com>
2342 * cp-tree.h (most_specialized_partial_spec): Declare.
2343 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
2345 (specialization_of): New function.
2346 (cp_parser_check_class_key): Move code...
2347 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
2348 -Wredundant-tags on first-time declarations in other declarators.
2349 Correct handling of template specializations.
2350 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
2351 when -Wredundant-tags is enabled. Use primary template or partial
2352 specialization as the guide for uses of implicit instantiations.
2353 * pt.c (most_specialized_partial_spec): Declare extern.
2355 2020-03-27 Nathan Sidwell <nathan@acm.org>
2358 * name-lookup.c (push_namespace): Triage ambiguous lookups that
2361 2020-03-27 Jakub Jelinek <jakub@redhat.com>
2364 * call.c (set_flags_from_callee): Don't update
2365 cp_function_chain->can_throw or current_function_returns_abnormally
2366 if cp_unevaluated_operand.
2369 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
2370 operand and creating a new COMPOUND_EXPR if anything changed.
2372 2020-03-26 Marek Polacek <polacek@redhat.com>
2374 PR c++/94336 - template keyword accepted before destructor names.
2375 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
2376 is followed by a destructor name.
2378 2020-03-27 Patrick Palka <ppalka@redhat.com>
2380 * decl.c (compute_array_index_type_loc): Remove redundant
2381 type_dependent_expression_p check that is subsumed by
2382 value_dependent_expression_p.
2383 * decl2.c (is_late_template_attribute): Likewise.
2384 * pt.c (uses_template_parms): Likewise.
2385 (dependent_template_arg_p): Likewise.
2387 2020-03-26 Marek Polacek <polacek@redhat.com>
2390 PR c++/94057 - template keyword in a typename-specifier.
2391 * parser.c (check_template_keyword_in_nested_name_spec): New.
2392 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
2393 'template'. Call check_template_keyword_in_nested_name_spec.
2394 (cp_parser_simple_type_specifier): Assume that a <
2395 following a qualified-id in a typename-specifier begins
2396 a template argument list.
2398 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
2400 * coroutines.cc (coro_init_identifiers): Initialize an identifier
2401 for the cororoutine handle 'address' method name.
2402 (struct coro_aw_data): Add fields to cover the continuations.
2403 (co_await_expander): Determine the kind of await_suspend in use.
2404 If we have the case that returns a continuation handle, then save
2405 this and make the target for 'scope exit without cleanup' be the
2406 continuation resume label.
2407 (expand_co_awaits): Remove.
2408 (struct suspend_point_info): Remove fields that kept the returned
2409 await_suspend handle type.
2410 (transform_await_expr): Remove code tracking continuation handles.
2411 (build_actor_fn): Add the continuation handle as an actor-function
2412 scope var. Build the symmetric transfer continuation point. Call
2413 the tree walk for co_await expansion directly, rather than via a
2414 trivial shim function.
2415 (register_await_info): Remove fields tracking continuation handles.
2416 (get_await_suspend_return_type): Remove.
2417 (register_awaits): Remove code tracking continuation handles.
2418 (morph_fn_to_coro): Remove code tracking continuation handles.
2420 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
2422 * coroutines.cc (co_await_expander): If we are expanding the
2423 initial await expression, set a boolean flag to show that we
2424 have now reached the initial await_resume() method call.
2425 (expand_co_awaits): Handle the 'initial await resume called' flag.
2426 (build_actor_fn): Insert the initial await expression into the
2427 start of the user-authored function-body. Handle the 'initial await
2428 resume called' flag.
2429 (morph_fn_to_coro): Initialise the 'initial await resume called'
2430 flag. Modify the unhandled exception catch clause to recognise
2431 exceptions that occur before the initial await_resume() and re-
2434 2020-03-26 Jakub Jelinek <jakub@redhat.com>
2437 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
2438 true for all TEMPLATE_DECLs.
2441 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
2443 2020-03-25 Patrick Palka <ppalka@redhat.com>
2446 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
2447 current condition chain when the if-statement has a non-empty
2450 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
2453 * coroutines.cc (captures_temporary): Fix a missing dereference.
2455 2020-03-24 Marek Polacek <polacek@redhat.com>
2457 PR c++/94190 - wrong no post-decrement operator error in template.
2458 * call.c (convert_like_real): Use convert_from_reference on the result.
2460 2020-03-24 Jason Merrill <jason@redhat.com>
2463 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
2465 (tsubst_nested_requirement): Likewise.
2466 (get_constraint_error_location): Allow missing context.
2467 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
2468 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
2470 2020-03-24 Jason Merrill <jason@redhat.com>
2472 * pt.c (any_template_parm_r): Look into the type of a non-type
2475 2020-03-24 Jason Merrill <jason@redhat.com>
2477 * cp-tree.h (cp_expr): When constructing from an expr and a
2478 location, call protected_set_expr_location.
2480 2020-03-23 Patrick Palka <ppalka@redhat.com>
2483 * except.c (maybe_noexcept_warning): Add TODO.
2484 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
2486 2020-03-23 nathans <nathan@acm.org>
2489 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
2492 2020-03-21 Patrick Palka <ppalka@redhat.com>
2495 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
2496 handle unions without an initializer.
2497 (cxx_eval_component_reference): Emit a different diagnostic when the
2498 constructor element corresponding to a union member is NULL.
2499 (cxx_eval_bare_aggregate): When constructing a union, always set the
2500 active union member before evaluating the initializer. Relax assertion
2501 that verifies the index of the constructor element we're initializing
2502 hasn't been changed.
2503 (cxx_eval_store_expression): Diagnose changing the active union member
2504 while the union is in the process of being initialized. After setting
2505 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
2507 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
2508 CONSTRUCTOR returned by lookup_placeholder.
2510 2020-03-20 Patrick Palka <ppalka@redhat.com>
2512 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
2513 the "[with ]" bits to here from ...
2514 (pp_cxx_atomic_constraint): ... here.
2515 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
2516 * error.c (rebuild_concept_check): Delete.
2517 (print_concept_check_info): Print the dependent form of the constraint and the
2518 preferably substituted parameter mapping alongside it.
2520 2020-03-19 Jason Merrill <jason@redhat.com>
2523 * cp-gimplify.c (simple_empty_class_p): Look through
2524 SIMPLE_TARGET_EXPR_P.
2525 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
2526 [RETURN_EXPR]: Avoid producing 'return *retval;'.
2527 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
2528 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
2531 2020-03-19 Jakub Jelinek <jakub@redhat.com>
2534 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
2535 on outer_automatic_var_p decls.
2536 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
2537 capture proxy decls.
2539 2020-03-18 Nathan Sidwell <nathan@acm.org>
2541 PR c++/94147 - mangling of lambdas assigned to globals
2542 * parser.c (cp_parser_init_declarator): Namespace-scope variables
2543 provide a lambda scope.
2544 * tree.c (no_linkage_check): Lambdas with a variable for extra
2545 scope have a linkage from the variable.
2547 2020-03-18 Jakub Jelinek <jakub@redhat.com>
2549 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
2550 strictly_subsumes): Fix up duplicated word issue in a comment.
2551 * coroutines.cc (build_init_or_final_await, captures_temporary):
2553 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
2554 * pt.c (append_type_to_template_for_access_check): Likewise.
2557 * decl.c (grokfndecl): Restore old diagnostics about deduction
2558 guide declared in different scope if in_namespace is NULL_TREE.
2560 2020-03-17 Jakub Jelinek <jakub@redhat.com>
2563 * parser.c (cp_parser_enum_specifier): Use temp_override for
2564 parser->colon_corrects_to_scope_p, replace goto out with return.
2565 If scoped enum or enum with underlying type is not followed by
2566 { or ;, call cp_parser_commit_to_tentative_parse before calling
2567 cp_parser_error and make sure to return error_mark_node instead of
2568 NULL_TREE. Formatting fixes.
2570 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
2573 * method.c (assignable_expr): Use cp_unevaluated.
2574 (is_xible_helper): Push a non-deferred access check for
2575 the stub objects created by assignable_expr and constructible_expr.
2577 2020-03-17 Jakub Jelinek <jakub@redhat.com>
2579 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
2580 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
2582 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
2583 cp_parser_placeholder_type_specifier,
2584 cp_parser_constraint_requires_parens): Likewise.
2585 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
2587 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
2589 * coroutines.cc (co_await_expander): Fix indentation.
2591 2020-03-14 Jason Merrill <jason@redhat.com>
2594 * pt.c (process_partial_specialization): Error rather than crash on
2595 extra pack expansion.
2597 2020-03-14 Jason Merrill <jason@redhat.com>
2600 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
2601 DECL_ORIGINAL_TYPE of a typedef.
2603 2020-03-14 Jason Merrill <jason@redhat.com>
2606 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
2607 substituting DECL_ARGUMENTS.
2609 2020-03-14 Jakub Jelinek <jakub@redhat.com>
2611 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
2612 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
2615 2020-03-13 Patrick Palka <ppalka@redhat.com>
2618 * call.c (build_over_call): Use a warning_sentinel to disable
2619 warn_deprecated_decl before calling build_addr_func.
2621 2020-03-12 Jakub Jelinek <jakub@redhat.com>
2624 * decl.c (reshape_init_array_1): Don't unshare constructor if there
2625 aren't any trailing zero elts, otherwise only unshare the first
2628 2020-03-11 Jason Merrill <jason@redhat.com>
2631 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
2634 2020-03-11 Marek Polacek <polacek@redhat.com>
2635 Jason Merrill <jason@redhat.com>
2637 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
2638 * constexpr.c (cref_has_const_field): New function.
2639 (modifying_const_object_p): Consider a COMPONENT_REF
2640 const only if any of its fields are const.
2641 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
2642 as readonly after its initialization has been done.
2644 2020-03-10 Marek Polacek <polacek@redhat.com>
2646 PR c++/94124 - wrong conversion error with non-viable overload.
2647 * decl.c (reshape_init_array_1): Unshare a constructor if we
2648 stripped trailing zero-initializers.
2650 2020-03-10 Jason Merrill <jason@redhat.com>
2653 * pt.c (maybe_instantiate_noexcept): Always update clones.
2655 2020-03-10 Jason Merrill <jason@redhat.com>
2658 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
2660 2020-03-10 Jason Merrill <jason@redhat.com>
2666 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
2667 66139: Don't split_nonconstant_init. Remove pre_p parameter.
2669 2020-03-09 Marek Polacek <polacek@redhat.com>
2671 PR c++/92031 - bogus taking address of rvalue error.
2672 PR c++/91465 - ICE with template codes in check_narrowing.
2673 PR c++/93870 - wrong error when converting template non-type arg.
2674 PR c++/94068 - ICE with template codes in check_narrowing.
2675 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
2676 in a template when not ck_identity and we're dealing with a class.
2677 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
2678 in a template if we need a temporary.
2679 * decl.c (compute_array_index_type_loc): Remove
2680 instantiate_non_dependent_expr_sfinae call. Call
2681 fold_non_dependent_expr instead of maybe_constant_value.
2682 (build_explicit_specifier): Don't instantiate or create a sentinel
2683 before converting the expression.
2684 * except.c (build_noexcept_spec): Likewise.
2685 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
2686 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
2687 build_converted_constant_expr returned.
2688 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
2689 of maybe_constant_value.
2691 2020-03-09 Jakub Jelinek <jakub@redhat.com>
2695 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
2697 * constexpr.c (cxx_eval_constant_expression): Do not handle
2698 RROTATE_EXPR and LROTATE_EXPR.
2700 2020-03-09 Marek Polacek <polacek@redhat.com>
2702 PR c++/94050 - ABI issue with alignas on armv7hl.
2703 * class.c (layout_class_type): Don't replace a class's
2704 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
2706 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
2708 * coroutines.cc (build_actor_fn): Factor out code inserting the
2709 default return_void call to...
2710 (morph_fn_to_coro): ...here, also hoist local var declarations.
2712 2020-03-08 Patrick Palka <ppalka@redhat.com>
2715 * call.c (convert_like_real): Check complain before emitting an error
2716 about binding a bit-field to a reference.
2718 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
2719 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
2722 2020-03-06 Nathan Sidwell <nathan@acm.org>
2725 * mangle.c (find_substitution): Don't call same_type_p on template
2726 args that cannot match.
2728 2020-03-04 Martin Sebor <msebor@redhat.com>
2731 * tree.c (type_initializer_zero_p): Fail for structs initialized
2734 2020-03-04 Jason Merrill <jason@redhat.com>
2737 * init.c (perform_member_init): Don't do aggregate initialization of
2739 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
2740 initialization of empty field.
2742 2020-03-04 Martin Liska <mliska@suse.cz>
2744 * method.c: Wrap array in ctor with braces in order
2745 to silent clang warnings.
2747 2020-03-03 Jason Merrill <jason@redhat.com>
2748 Marek Polacek <polacek@redhat.com>
2750 PR c++/90505 - mismatch in template argument deduction.
2751 * pt.c (tsubst): Don't reduce the template level of template
2752 parameters when tf_partial.
2754 2020-03-03 Jakub Jelinek <jakub@redhat.com>
2757 * constexpr.c (cxx_eval_constant_expression)
2758 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
2759 *non_constant_p is true.
2761 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
2763 * coroutines.cc (captures_temporary): Strip component_ref
2766 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
2768 * coroutines.cc (finish_co_await_expr): Build co_await_expr
2769 with unknown_type_node.
2770 (finish_co_yield_expr): Ditto.
2771 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
2772 with unknown type as dependent.
2774 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
2776 * coroutines.cc (struct local_var_info): Adjust to remove the
2777 reference to the captured var, and just to note that this is a
2778 lambda capture proxy.
2779 (transform_local_var_uses): Handle lambda captures specially.
2780 (struct param_frame_data): Add a visited set.
2781 (register_param_uses): Also check for param uses in lambda
2783 (struct local_vars_frame_data): Remove captures list.
2784 (register_local_var_uses): Handle lambda capture proxies by
2785 noting and bypassing them.
2786 (morph_fn_to_coro): Update to remove lifetime extension of
2787 lambda capture-by-copy vars.
2789 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
2791 * coroutines.cc (build_co_await): Do not build frame
2792 awaitable proxy vars when the co_await expression is
2793 a function parameter or local var.
2794 (co_await_expander): Do not initialise a frame var with
2796 (transform_await_expr): Only substitute the awaitable
2797 frame var if it's needed.
2798 (register_awaits): Do not make frame copies for param
2799 or local vars that are awaitables.
2801 2020-02-28 Jason Merrill <jason@redhat.com>
2803 Implement P2092R0, Disambiguating Nested-Requirements
2804 * parser.c (cp_parser_requirement_parameter_list): Pass
2805 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
2807 * call.c (build_user_type_conversion_1): Don't look at the second
2808 conversion of a non-viable candidate.
2810 2020-02-28 Jakub Jelinek <jakub@redhat.com>
2812 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
2813 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
2814 functions in unevaluated contexts.
2816 2020-02-27 Nathan Sidwell <nathan@acm.org>
2819 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
2821 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
2822 * typeck.c (comptypes): Assert we don't get any argument packs.
2824 * class.c (adjust_clone_args): Correct arg-checking assert.
2825 * typeck.c (comptypes): Assert not nulls.
2827 2020-02-26 Marek Polacek <polacek@redhat.com>
2829 PR c++/93789 - ICE with invalid array bounds.
2830 * decl.c (compute_array_index_type_loc): Don't use the folded
2831 size when folding cleared TREE_CONSTANT.
2833 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
2835 * class.c (classtype_has_non_deleted_copy_ctor): New.
2836 * coroutines.cc (struct param_info): Keep track of params
2837 that are references, and cache the original type and whether
2838 the DTOR is trivial.
2839 (build_actor_fn): Handle param copies always, and adjust the
2840 handling for references.
2841 (register_param_uses): Only handle uses here.
2842 (classtype_has_non_deleted_copy_ctor): New.
2843 (morph_fn_to_coro): Adjust param copy handling to match n4849
2844 by reordering ahead of the promise CTOR and always making a
2845 frame copy, even if the param is unused in the coroutine body.
2846 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
2848 2020-02-26 Patrick Palka <ppalka@redhat.com>
2850 * constraint.cc (finish_constraint_binary_op): Set expr's location range
2851 to the range of its operands.
2852 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
2853 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
2854 instead of the corresponding template arguments ARGS and adjust body
2856 (diagnose_requires_expr): Likewise.
2857 (diagnose_atomic_constraint): Likewise. When printing an atomic
2858 constraint expression, print the instantiated parameter mapping
2860 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
2861 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
2862 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
2864 2020-02-26 Marek Polacek <polacek@redhat.com>
2866 PR c++/93676 - value-init crash in template.
2867 * init.c (build_new_1): Don't call build_vec_init in a template.
2869 2020-02-26 Marek Polacek <polacek@redhat.com>
2871 PR c++/93862 - ICE with static_cast when converting from int[].
2872 * call.c (reference_compatible_p): No longer static.
2873 * cp-tree.h (reference_compatible_p): Declare.
2874 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
2875 of reference_related_p.
2877 2020-02-26 Marek Polacek <polacek@redhat.com>
2879 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
2880 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
2883 2020-02-24 Martin Sebor <msebor@redhat.com>
2886 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
2887 in shared C/C++ code in headers.
2888 Remove a duplicate hunk of code.
2890 2020-02-24 Marek Polacek <polacek@redhat.com>
2892 PR c++/93869 - ICE with -Wmismatched-tags.
2893 * parser.c (cp_parser_check_class_key): Check class_key earlier.
2895 2020-02-24 Marek Polacek <polacek@redhat.com>
2897 PR c++/93712 - ICE with ill-formed array list-initialization.
2898 * call.c (next_conversion): Return NULL for ck_aggr.
2899 (build_aggr_conv): Set u.expr instead of u.next.
2900 (build_array_conv): Likewise.
2901 (build_complex_conv): Likewise.
2902 (conv_get_original_expr): Handle ck_aggr.
2904 2020-02-24 Jakub Jelinek <jakub@redhat.com>
2906 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
2907 * call.c (build_over_call): Don't evaluate immediate functions in
2908 unevaluated operands.
2910 2020-02-24 Jason Merrill <jason@redhat.com>
2912 P0780R2: Resolve lambda init-capture pack grammar.
2913 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
2916 2020-02-22 Marek Polacek <polacek@redhat.com>
2919 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
2921 2020-02-21 Martin Sebor <msebor@redhat.com>
2923 PR gcov-profile/93753
2924 * class.c (check_flexarrays): Tighten up a test for potential members
2925 of anonymous structs or unions.
2927 2020-02-20 Martin Sebor <msebor@redhat.com>
2930 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
2932 2020-02-20 Martin Liska <mliska@suse.cz>
2934 PR translation/93841
2935 * config/or1k/or1k.opt: Remove superfluous word.
2936 * doc/invoke.texi: Likewise.
2938 2020-02-20 Martin Liska <mliska@suse.cz>
2940 PR translation/93838
2941 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
2943 2020-02-19 Marek Polacek <polacek@redhat.com>
2945 PR c++/93169 - wrong-code with a non-constexpr constructor.
2946 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
2947 on constant CONSTRUCTORs.
2949 2020-02-15 Marek Polacek <polacek@redhat.com>
2951 PR c++/93710 - poor diagnostic for array initializer.
2952 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
2955 2020-02-15 Jason Merrill <jason@redhat.com>
2958 * pt.c (any_template_parm_r): Look into lambda body.
2961 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
2963 2020-02-14 Jakub Jelinek <jakub@redhat.com>
2966 * class.c (enum_min_precision): Change prec type from int to int &.
2969 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
2970 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
2971 (fallback_dfloat32_type, fallback_dfloat64_type,
2972 fallback_dfloat128_type): Define.
2973 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
2975 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
2976 is disabled for compatibility.
2978 2020-02-13 Jason Merrill <jason@redhat.com>
2981 * name-lookup.c (matching_fn_p): A function does not match a
2986 * tree.c (decl_linkage): Always lk_none for locals.
2988 2020-02-12 Jason Merrill <jason@redhat.com>
2992 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
2993 * pt.c (find_parameter_packs_r): Not here.
2995 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
2997 * coroutines.cc (build_actor_fn): Implement deallocation function
2998 selection per n4849, dcl.fct.def.coroutine bullet 12.
2999 (morph_fn_to_coro): Implement allocation function selection per
3000 n4849, dcl.fct.def.coroutine bullets 9 and 10.
3002 2020-02-12 Marek Polacek <polacek@redhat.com>
3004 PR c++/93684 - ICE-on-invalid with broken attribute.
3005 * parser.c (cp_parser_std_attribute): Peek a token first before
3008 2020-02-11 Jason Merrill <jason@redhat.com>
3011 * class.c (add_implicitly_declared_members): Use do_friend.
3012 * method.c (implicitly_declare_fn): Fix friend handling.
3013 (decl_remember_implicit_trigger_p): New.
3014 (synthesize_method): Use it.
3015 * decl2.c (mark_used): Use it.
3017 2020-02-11 Jason Merrill <jason@redhat.com>
3021 * constexpr.c (maybe_constant_value): Correct earlier change.
3022 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
3023 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
3025 2020-02-12 Patrick Palka <ppalka@redhat.com>
3029 * type-utils.h (find_type_usage): Refactor to take a tree * and to
3030 return a tree *, and update documentation accordingly.
3031 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
3032 decltype(auto) node.
3033 (make_constrained_decltype_auto): No need to explicitly set
3034 AUTO_IS_DECLTYPE anymore.
3035 (splice_late_return_type): Use find_type_usage to find and
3036 replace a possibly nested auto node instead of using is_auto.
3037 Check test for is_auto into an assert when deciding whether
3038 to late_return_type.
3039 (type_uses_auto): Adjust the call to find_type_usage.
3040 * parser.c (cp_parser_decltype): No need to explicitly set
3041 AUTO_IS_DECLTYPE anymore.
3043 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
3044 (dump_simple_decl): Handle standard concept definitions as well as
3045 variable concept definitions.
3047 2020-02-10 Jakub Jelinek <jakub@redhat.com>
3050 * error.c (dump_decl_name): Fix up last argument to strncmp.
3052 2020-02-10 Jason Merrill <jason@redhat.com>
3055 * tree.c (array_of_unknown_bound_p): New.
3056 * init.c (perform_member_init): Do nothing for flexible arrays.
3058 2020-02-09 Jakub Jelinek <jakub@redhat.com>
3061 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
3062 ARRAY_TYPE, use the element type. Punt if objtype after that is not
3065 2020-02-08 Jason Merrill <jason@redhat.com>
3068 * expr.c (fold_for_warn): Call maybe_constant_value.
3069 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
3070 (maybe_constant_value): Add uid_sensitive parm.
3071 (get_fundef_copy): Don't copy if it's true.
3072 (cxx_eval_call_expression): Don't instantiate if it's true.
3073 (cxx_eval_outermost_constant_expr): Likewise.
3076 * constexpr.c (maybe_constant_value): Don't unshare if the cached
3077 value is the same as the argument.
3079 * typeck.c (maybe_warn_about_returning_address_of_local): Add
3082 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
3085 2020-02-08 Jakub Jelinek <jakub@redhat.com>
3088 * constexpr.c (find_array_ctor_elt): If last element has no index,
3089 for flag_checking verify all elts have no index. If i is within the
3090 elts, return it directly, if it is right after the last elt, append
3091 if NULL index, otherwise force indexes on all elts.
3092 (cxx_eval_store_expression): Allow cep->index to be NULL.
3094 2020-02-07 Marek Polacek <polacek@redhat.com>
3096 PR c++/92947 - Paren init of aggregates in unevaluated context.
3097 * call.c (build_new_method_call_1): Don't check
3098 cp_unevaluated_operand. Check the return value of digest_init.
3100 2020-02-06 Jason Merrill <jason@redhat.com>
3103 * tree.c (cp_walk_subtrees): Walk into type template arguments.
3104 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
3105 instead of TYPE_ALIAS_P.
3106 * pt.c (push_template_decl_real): Likewise.
3107 (find_parameter_packs_r): Likewise. Remove dead code.
3108 * error.c (find_typenames_r): Remove dead code.
3110 2020-02-06 Jason Merrill <jason@redhat.com>
3113 * parser.c (cp_parser_constraint_primary_expression): Do the main
3114 parse non-tentatively.
3116 2020-02-06 Marek Polacek <polacek@redhat.com>
3118 PR c++/93597 - ICE with lambda in operator function.
3119 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
3121 2020-02-05 Jason Merrill <jason@redhat.com>
3124 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
3125 handling of TREE_CHAIN for empty pack.
3127 2020-02-05 Jakub Jelinek <jakub@redhat.com>
3130 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
3131 prior to passing it to c_build_vec_convert.
3133 2020-02-05 Marek Polacek <polacek@redhat.com>
3135 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
3136 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
3139 2020-02-05 Jason Merrill <jason@redhat.com>
3142 * decl.c (grokdeclarator): Reject field of current class type even
3145 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
3147 * coroutines.cc (maybe_promote_captured_temps): Increase the index
3148 number for temporary variables' name.
3150 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
3152 * coroutines.cc (build_co_await): Call convert_from_reference
3153 to wrap co_await_expr with indirect_ref which avoid
3154 reference/non-reference type confusion.
3156 (co_await_expander): Sink to call_expr if await_resume
3157 is wrapped by indirect_ref.
3159 2020-02-04 Jason Merrill <jason@redhat.com>
3162 * constraint.cc (satisfy_declaration_constraints): Check return
3163 value of push_tinst_level.
3166 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
3167 elements instead of value-initializing them.
3170 * init.c (perform_member_init): Simplify.
3171 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
3173 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
3175 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
3177 * coroutines.cc (find_promise_type): Delete unused forward
3179 (struct coroutine_info): Add a bool for no promise type error.
3180 (coro_promise_type_found_p): Only emit the error for a missing
3181 promise once in each affected coroutine.
3183 2020-02-03 Jason Merrill <jason@redhat.com>
3186 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
3187 defer loading the value of a reference.
3189 2020-02-03 Jason Merrill <jason@redhat.com>
3192 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
3194 [COMPONENT_REF]: A member function reference doesn't use the object
3197 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
3200 * coroutines.cc (struct coroutine_info): Add a bool flag to note
3201 that we emitted an error for a bad function return type.
3202 (get_coroutine_info): Tolerate an unset info table in case of
3204 (find_coro_traits_template_decl): In case of error or if we didn't
3205 find a type template, note we emitted the error and suppress
3207 (find_coro_handle_template_decl): Likewise.
3208 (instantiate_coro_traits): Only check for error_mark_node in the
3209 return from lookup_qualified_name.
3210 (coro_promise_type_found_p): Reorder initialization so that we check
3211 for the traits and their usability before allocation of the info
3212 table. Check for a suitable return type and emit a diagnostic for
3213 here instead of relying on the lookup machinery. This allows the
3214 error to have a better location, and means we can suppress multiple
3216 (coro_function_valid_p): Re-check for a valid promise (and thus the
3217 traits) before proceeding. Tolerate missing info as a fatal error.
3219 2020-02-03 Jason Merrill <jason@redhat.com>
3222 * cp-gimplify.c (predeclare_vla): New.
3223 (cp_genericize_r) [NOP_EXPR]: Call it.
3225 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
3227 * coroutines.cc (transform_await_wrapper): Set actor funcion as
3228 new context of label_decl.
3229 (build_actor_fn): Fill new field of await_xform_data.
3231 2020-02-02 Marek Polacek <polacek@redhat.com>
3233 PR c++/93530 - ICE on invalid alignas in a template.
3234 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
3237 2020-01-31 Jason Merrill <jason@redhat.com>
3240 * semantics.c (process_outer_var_ref): Capture VLAs even in
3241 unevaluated context.
3244 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
3245 non-aggregate elements.
3246 (reshape_init_array): Add first_initializer_p parm.
3247 (reshape_init_r): Change first_initializer_p from bool to tree.
3248 (reshape_init): Pass init to it.
3251 * parser.c (cp_parser_initializer_list): Suppress location wrappers
3254 2020-01-29 Jason Merrill <jason@redhat.com>
3257 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
3258 the expression was dependent before substitution.
3260 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
3262 * coroutines.cc (act_des_fn): New.
3263 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
3264 Access promise via actor function's frame pointer argument.
3265 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
3267 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
3269 * coroutines.cc (co_await_expander): Handle type conversion case.
3271 2020-01-29 Jason Merrill <jason@redhat.com>
3276 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
3277 a trailing return type.
3278 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
3281 2020-01-29 Marek Polacek <polacek@redhat.com>
3283 PR c++/91754 - Fix template arguments comparison with class NTTP.
3284 * pt.c (class_nttp_const_wrapper_p): New.
3285 (template_args_equal): See through class_nttp_const_wrapper_p
3288 2020-01-29 Marek Polacek <polacek@redhat.com>
3290 PR c++/92948 - Fix class NTTP with template arguments.
3291 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
3292 converting a value-dependent expression to a class type.
3293 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
3294 as the result of the tsubst_copy call.
3296 2020-01-29 Jakub Jelinek <jakub@redhat.com>
3299 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
3300 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
3302 2020-01-28 Jason Merrill <jason@redhat.com>
3305 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
3309 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
3312 * call.c (build_user_type_conversion_1): Allow a template conversion
3313 returning an rvalue reference to bind directly to an lvalue.
3316 * decl.c (grokdeclarator): Propagate eh spec from typedef.
3318 2020-01-28 Martin Liska <mliska@suse.cz>
3321 * pt.c (redeclare_class_template): Group couple of
3322 errors and inform messages with auto_diagnostic_group.
3324 2020-01-28 Martin Liska <mliska@suse.cz>
3327 * pt.c (redeclare_class_template): Use inform
3328 for the second location.
3330 2020-01-27 Jason Merrill <jason@redhat.com>
3333 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
3335 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
3338 * coroutines.cc (morph_fn_to_coro): Check the ramp return
3339 value when it is constructed from the 'get return object'.
3341 2020-01-27 Nathan Sidwell <nathan@acm.org>
3344 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
3346 2020-01-26 Jason Merrill <jason@redhat.com>
3349 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
3350 temporarily enable -Wsystem-headers. Change second warning to
3354 * semantics.c (finish_call_expr): Don't call
3355 instantiate_non_dependent_expr before warn_for_memset.
3357 2020-01-25 Marek Polacek <polacek@redhat.com>
3359 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
3360 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
3361 dynamic_cast diagnostic.
3363 2020-01-24 Jason Merrill <jason@redhat.com>
3365 PR c++/93400 - ICE with constrained friend.
3366 * constraint.cc (maybe_substitute_reqs_for): New.
3367 * decl.c (function_requirements_equivalent_p): Call it.
3368 * pt.c (tsubst_friend_function): Only substitute
3369 TEMPLATE_PARMS_CONSTRAINTS.
3370 (tsubst_template_parms): Copy constraints.
3372 2020-01-24 Jason Merrill <jason@redhat.com>
3374 PR c++/93279 - ICE with lambda in member operator.
3375 * name-lookup.c (maybe_save_operator_binding): Don't remember
3376 class-scope bindings.
3378 2020-01-24 Jason Merrill <jason@redhat.com>
3380 PR c++/93377 - ICE with member alias in constraint.
3381 * pt.c (any_template_parm_r): Look at template arguments for all
3382 aliases, not only alias templates.
3384 2020-01-24 Marek Polacek <polacek@redhat.com>
3386 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
3387 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
3389 2020-01-24 Jason Merrill <jason@redhat.com>
3391 PR c++/92852 - ICE with generic lambda and reference var.
3392 * constexpr.c (maybe_constant_value): Likewise.
3394 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
3397 * parser.c (cp_parser_nested_name_specifier_opt): Properly
3398 diagnose concept-ids.
3400 2020-01-23 Jason Merrill <jason@redhat.com>
3402 PR c++/93331 - ICE with __builtin_strchr.
3403 * constexpr.c (cxx_eval_builtin_function_call): Use the original
3404 argument if we didn't manage to extract a STRING_CST.
3406 PR c++/93345 - ICE with defaulted dtor and template.
3408 * decl.c (cxx_maybe_build_cleanup): Don't try to set
3409 throwing_cleanup in a template.
3411 2020-01-22 Marek Polacek <polacek@redhat.com>
3413 PR c++/92907 - noexcept does not consider "const" in member functions.
3414 * g++.dg/cpp0x/noexcept56.C: New test.
3416 2020-01-22 Marek Polacek <polacek@redhat.com>
3418 PR c++/93324 - ICE with -Wall on constexpr if.
3419 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
3421 2020-01-22 Patrick Palka <ppalka@redhat.com>
3423 * constraint.cc (get_mapped_args): Avoid using auto_vec
3424 as a vector element. Release the vectors inside the lists
3426 * parser.c (cp_literal_operator_id): Free the buffer.
3428 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
3430 * coroutines.cc (finish_co_await_expr): Add error check on return
3431 value of build_co_await.
3432 (finish_co_yield_expr,): Ditto.
3434 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
3436 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
3437 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
3438 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
3440 2020-01-21 Jason Merrill <jason@redhat.com>
3442 PR c++/60855 - ICE with sizeof VLA capture.
3443 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
3445 PR c++/90732 - ICE with VLA capture and generic lambda.
3446 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
3448 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
3449 Bin Cheng <bin.cheng@linux.alibaba.com>
3451 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
3452 from complete_type_or_else.
3453 (register_param_uses): Likewise.
3454 (build_co_await): Do not try to use complete_type_or_else for void
3455 types, otherwise for incomplete types, check for NULL return from
3456 complete_type_or_else.
3458 2020-01-21 Jason Merrill <jason@redhat.com>
3460 PR c++/91476 - anon-namespace reference temp clash between TUs.
3461 * decl2.c (copy_linkage): Factor out of get_guard.
3462 * call.c (make_temporary_var_for_ref_to_temp): Use it.
3463 * decl.c (cp_finish_decomp): Use it.
3464 (cp_finish_decl): determine_visibility sooner.
3466 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
3468 * coroutines.cc (finish_co_await_expr): Set return value flag.
3469 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
3471 2020-01-19 Jason Merrill <jason@redhat.com>
3473 PR c++/33799 - destroy return value, take 2.
3474 * cp-tree.h (current_retval_sentinel): New macro.
3475 (struct language_function): Add throwing_cleanup bitfield.
3476 * decl.c (cxx_maybe_build_cleanup): Set it.
3477 * except.c (maybe_set_retval_sentinel)
3478 (maybe_splice_retval_cleanup): New functions.
3479 * parser.c (cp_parser_compound_statement): Call
3480 maybe_splice_retval_cleanup.
3481 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
3483 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
3485 2020-01-18 Jakub Jelinek <jakub@redhat.com>
3487 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
3488 but non-NO_DOLLAR_IN_LABEL case build.
3490 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
3492 * Make-lang.in: Add coroutines.o.
3493 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
3494 (DECL_COROUTINE_P): New.
3495 * lex.c (init_reswords): Enable keywords when the coroutine flag
3497 * operators.def (co_await): New operator.
3498 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
3499 (op_error): Likewise.
3500 (build_new_op_1): Likewise.
3501 (build_new_function_call): Validate coroutine builtin arguments.
3502 * constexpr.c (potential_constant_expression_1): Handle
3503 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
3504 * coroutines.cc: New file.
3505 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
3506 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
3507 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
3508 * cp-tree.h (coro_validate_builtin_call): New.
3509 * decl.c (emit_coro_helper): New.
3510 (finish_function): Handle the case when a function is found to
3511 be a coroutine, perform the outlining and emit the outlined
3512 functions. Set a bit to signal that this is a coroutine component.
3513 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
3514 (cp_parser_unary_expression): Handle co_await.
3515 (cp_parser_assignment_expression): Handle co_yield.
3516 (cp_parser_statement): Handle RID_CO_RETURN.
3517 (cp_parser_jump_statement): Handle co_return.
3518 (cp_parser_operator): Handle co_await operator.
3519 (cp_parser_yield_expression): New.
3520 (cp_parser_required_error): Handle RT_CO_YIELD.
3521 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
3522 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
3524 * tree.c (cp_walk_subtrees): Likewise.
3526 2020-01-17 Jason Merrill <jason@redhat.com>
3528 PR c++/92531 - ICE with noexcept(lambda).
3529 * pt.c (uses_template_parms): Don't try to enumerate all the
3532 2020-01-17 Jakub Jelinek <jakub@redhat.com>
3535 * parser.c (cp_parser_template_name): Look up deprecated attribute
3536 in DECL_TEMPLATE_RESULT or its type's attributes.
3538 2020-01-16 Jason Merrill <jason@redhat.com>
3540 PR c++/93286 - ICE with __is_constructible and variadic template.
3541 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
3542 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
3544 PR c++/93280 - ICE with aggregate assignment and DMI.
3545 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
3546 * typeck2.c (digest_nsdmi_init): Not here.
3548 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
3551 * cp-tree.h (is_constrained_auto): New.
3552 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
3553 handle concept-check expressions; take a cp_decl_specifier_seq*
3555 (cp_parser_condition): Update call.
3556 (cp_parser_simple_declaration): Likewise.
3557 (cp_parser_placeholder_type_specifier): Correctly handle
3558 concept-check expressions.
3560 2020-01-15 Jason Merrill <jason@redhat.com>
3563 PR c++/33799 - destroy return value if local cleanup throws.
3564 * cp-tree.h (current_retval_sentinel): New macro.
3565 * decl.c (start_preparsed_function): Set up cleanup for retval.
3566 * typeck.c (check_return_expr): Set current_retval_sentinel.
3568 PR c++/93257 - consteval void function.
3569 * constexpr.c (verify_constant): Allow void_node.
3571 PR c++/92871 - bad code with xvalue and GNU ?: extension.
3572 * call.c (prevent_lifetime_extension): New.
3573 (build_conditional_expr_1): Use it.
3575 2020-01-14 Nathan Sidwell <nathan@acm.org>
3578 * pt.c (retrieve_specialization): Use get_template_info, not open
3582 * pt.c (retrieve_specialization): Get the TI from the decl or the
3583 classtype as appropriate.
3585 2020-01-14 David Malcolm <dmalcolm@redhat.com>
3587 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
3588 New static constant.
3589 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
3590 (struct named_label_hash::empty_zero_p): Likewise.
3591 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
3593 2020-01-14 Jason Merrill <jason@redhat.com>
3595 PR c++/92590 - wrong handling of inherited default ctor.
3596 * class.c (add_method): A constrained inherited ctor doesn't hide an
3597 implicit derived ctor.
3599 PR c++/92552 - ICE with inherited constrained default ctor.
3600 * pt.c (instantiate_class_template_1): Copy
3601 TYPE_HAS_USER_CONSTRUCTOR.
3602 PR c++/91930 - ICE with constrained inherited default ctor.
3603 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
3604 for inherited constructor.
3605 PR c++/92594 - ICE with inherited trivial default ctor.
3606 * method.c (trivial_fn_p): Treat an inherited default constructor
3607 like a normal default constructor.
3609 PR c++/92594 - ICE with inherited trivial default ctor.
3610 * method.c (trivial_fn_p): Treat an inherited default constructor
3611 like a normal default constructor.
3613 PR c++/92009 - ICE with punning of typeid.
3614 * rtti.c (get_tinfo_desc): Call xref_basetypes.
3615 * constexpr.c (cxx_fold_indirect_ref): Don't strip
3618 2020-01-13 Jason Merrill <jason@redhat.com>
3620 PR c++/92746 - ICE with noexcept of function concept check.
3621 * except.c (check_noexcept_r): Handle concept-check.
3623 PR c++/92582 - ICE with member template as requirement.
3624 * pt.c (struct find_template_parameter_info): Add ctx_parms.
3625 (any_template_parm_r): Handle TEMPLATE_DECL.
3626 (find_template_parameters): Take parms instead of their depth.
3627 * constraint.cc (build_parameter_mapping): Pass them.
3629 PR c++/33799 - destroy return value if local cleanup throws.
3630 * cp-tree.h (current_retval_sentinel): New macro.
3631 * decl.c (start_preparsed_function): Set up cleanup for retval.
3632 * typeck.c (check_return_expr): Set current_retval_sentinel.
3634 PR c++/93238 - short right-shift with enum.
3635 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
3637 2020-01-10 Jason Merrill <jason@redhat.com>
3639 * typeck.c (cp_build_binary_op): Restore short_shift code.
3641 PR c++/93143 - incorrect tree sharing with constexpr.
3642 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
3643 CONSTRUCTORs are already unshared.
3645 PR c++/93173 - incorrect tree sharing.
3647 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
3648 copy_if_shared after cp_genericize_tree.
3649 * typeck2.c (split_nonconstant_init): Don't unshare here.
3651 2020-01-08 Jason Merrill <jason@redhat.com>
3653 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
3654 TARGET_EXPR_DIRECT_INIT_P.
3655 * constexpr.c (cxx_eval_constant_expression): Likewise.
3657 2020-01-08 Jason Merrill <jason@redhat.com>
3659 PR c++/91369 - constexpr destructor and member initializer.
3660 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
3661 when not preevaluating.
3663 2020-01-08 Jason Merrill <jason@redhat.com>
3665 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
3668 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
3670 * init.c (build_new): Add location_t parameter and use it throughout.
3671 (build_raw_new_expr): Likewise.
3672 * parser.c (cp_parser_new_expression): Pass the combined_loc.
3673 * pt.c (tsubst_copy_and_build): Adjust call.
3674 * cp-tree.h: Update declarations.
3676 2020-01-07 Jason Merrill <jason@redhat.com>
3678 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
3679 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
3680 explicit class visibility for a template.
3682 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
3684 * mangle.c (mangle_type_attribute_p): New function, split out from...
3685 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
3686 that contain a space.
3688 2020-01-07 Jakub Jelinek <jakub@redhat.com>
3691 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
3692 member, initialize it to zero in ctor.
3693 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
3694 a heap object. Don't cache calls to functions which allocate some
3695 heap objects and don't deallocate them or deallocate some heap
3696 objects they didn't allocate.
3698 2020-01-06 Jason Merrill <jason@redhat.com>
3700 PR c++/92552 - ICE with inherited constrained default ctor.
3701 * pt.c (instantiate_class_template_1): Copy
3702 TYPE_HAS_USER_CONSTRUCTOR.
3703 * class.c (one_inherited_ctor): Don't set it here.
3705 2020-01-06 Andrew Sutton <asutton@lock3software.com>
3707 PR c++/92739 - parsing requires clause with attributes.
3708 * parser.c (cp_parser_constraint_requires_parens): Exclude
3709 attributes as postfix expressions.
3711 2020-01-05 Jakub Jelinek <jakub@redhat.com>
3714 * parser.c (cp_parser_check_class_key): Disable access checks for the
3716 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
3717 !warn_redundant_tags.
3719 2010-01-05 Jakub Jelinek <jakub@redhat.com>
3722 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
3723 TARGET_EXPR if it has been gimplified already.
3725 2020-01-03 Jason Merrill <jason@redhat.com>
3727 PR c++/93033 - incorrect tree node sharing with array init.
3728 * typeck2.c (split_nonconstant_init): Unshare non-decl.
3729 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
3731 2020-01-02 Jason Merrill <jason@redhat.com>
3733 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
3736 2020-01-02 Jakub Jelinek <jakub@redhat.com>
3739 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
3740 has not been found, rather than error_mark_node.
3742 2020-01-01 Jakub Jelinek <jakub@redhat.com>
3744 Update copyright years.
3746 Copyright (C) 2020 Free Software Foundation, Inc.
3748 Copying and distribution of this file, with or without modification,
3749 are permitted in any medium without royalty provided the copyright
3750 notice and this notice are preserved.