1 2020-08-10 Jakub Jelinek <jakub@redhat.com>
4 * constexpr.c (cxx_eval_binary_expression): For SPACESHIP_EXPR, tail
5 call cxx_eval_constant_expression after genericize_spaceship to avoid
6 undesirable further VERIFY_CONSTANT.
8 2020-08-10 Patrick Palka <ppalka@redhat.com>
10 * pt.c (resolve_overloaded_unification): Drop functions with
11 unsatisfied constraints.
12 (resolve_nondeduced_context): Likewise.
14 2020-08-05 Patrick Palka <ppalka@redhat.com>
15 Jason Merrill <jason@redhat.com>
18 * constexpr.c (cxx_eval_vec_init_1): Truncate ctx->ctor and
19 then clear CONSTRUCTOR_NO_CLEARING on each appended element
20 initializer if we're initializing a previously zero-initialized
23 2020-08-04 Marek Polacek <polacek@redhat.com>
26 * parser.c (cp_parser_elaborated_type_specifier): Allow
27 'template' following ::.
29 2020-08-04 Nathan Sidwell <nathan@acm.org>
31 * parser.c (cp_parser_explicit_specialization): Refactor
32 to avoid leak of num_template_parameter_lists value.
34 2020-08-04 Patrick Palka <ppalka@redhat.com>
37 * init.c (sort_mem_initializers): Preserve TREE_TYPE of the
38 member initializer list node.
39 (emit_mem_initializers): Set input_location when performing each
40 member initialization.
41 * parser.c (cp_parser_mem_initializer): Attach the source
42 location of this initializer to a dummy EMPTY_CLASS_EXPR
43 within the TREE_TYPE of the list node.
44 * pt.c (tsubst_initializer_list): Preserve TREE_TYPE of the
45 member initializer list node.
47 2020-08-03 Marek Polacek <polacek@redhat.com>
49 * cp-tree.h (after_nsdmi_defaulted_late_checks): Remove.
51 2020-08-03 Marek Polacek <polacek@redhat.com>
55 * pt.c (check_default_tmpl_args): Also consider variable
58 2020-07-31 Jakub Jelinek <jakub@redhat.com>
61 * decl.c (finish_function): In constexpr functions use for C++14 and
62 later error instead of warning if no return statement is present and
63 diagnose it regardless of warn_return_type. Move the warn_return_type
64 diagnostics earlier in the function.
66 2020-07-31 Martin Sebor <msebor@redhat.com>
69 * class.c (build_base_path): Set no-warning bit on the synthesized
70 conditional expression in static_cast.
72 2020-07-31 Richard Biener <rguenther@suse.de>
75 * cp-objcp-common.h (LANG_HOOKS_FINALIZE_EARLY_DEBUG):
76 Define to c_common_finalize_early_debug.
78 2020-07-31 Patrick Palka <ppalka@redhat.com>
81 * constexpr.c (cxx_eval_constant_expression) <case CONST_DECL>:
82 Pass false to decl_constant_value and decl_really_constant_value
83 so that they don't unshare their result.
84 * cp-tree.h (decl_constant_value): New declaration with an added
86 (decl_really_constant_value): Add bool parameter defaulting to
87 true to existing declaration.
88 * init.c (constant_value_1): Add bool parameter which controls
89 whether to unshare the initializer before returning. Call
90 unshare_expr at most once.
91 (scalar_constant_value): Pass true to constant_value_1's new
93 (decl_really_constant_value): Add bool parameter and forward it
95 (decl_constant_value): Likewise, but instead define a new
96 overload with an added bool parameter.
98 2020-07-30 Patrick Palka <ppalka@redhat.com>
101 * pt.c (resolve_overloaded_unification): If the function
102 template specialization has a placeholder return type,
103 then instantiate it before attempting unification.
105 2020-07-30 Patrick Palka <ppalka@redhat.com>
108 * pt.c (alias_ctad_tweaks): Call remove_constraints before
109 calling set_constraints.
111 2020-07-30 Patrick Palka <ppalka@redhat.com>
114 * pt.c (reduce_template_parm_level): Propagate DECL_VIRTUAL_P
115 from the original TEMPLATE_PARM_DECL to the new lowered one.
117 2020-07-30 Patrick Palka <ppalka@redhat.com>
120 * constraint.cc (constraints_satisfied_p): Return true if
122 * pt.c (do_type_instantiation): Update a paragraph taken from
123 [temp.explicit] to reflect the latest specification. Don't
124 instantiate a member with unsatisfied constraints.
126 2020-07-29 Jason Merrill <jason@redhat.com>
129 * cp-tree.h (IMPLICIT_RVALUE_P): New.
130 (enum cp_lvalue_kind_flags): Add clk_implicit_rval.
131 (implicit_rvalue_p, set_implicit_rvalue_p): New.
132 * call.c (reference_binding): Check clk_implicit_rval.
133 (build_over_call): Adjust C++20 implicit move.
134 * coroutines.cc (finish_co_return_stmt): Simplify implicit move.
135 * except.c (build_throw): Adjust C++20 implicit move.
136 * pt.c (tsubst_copy_and_build) [STATIC_CAST_EXPR]: Propagate
138 * tree.c (lvalue_kind): Set clk_implicit_rval.
139 * typeck.c (treat_lvalue_as_rvalue_p): Overhaul.
140 (maybe_warn_pessimizing_move): Adjust.
141 (check_return_expr): Adjust C++20 implicit move.
143 2020-07-29 Jason Merrill <jason@redhat.com>
146 * call.c (build_over_call): Don't call a const ref
147 overload for implicit move.
149 2020-07-28 Nathan Sidwell <nathan@acm.org>
151 * cp-gimplify.c (cp_genericize_r): Set IMPORTED_DECL's context.
152 * cp-objcp-common.c (cp_pushdecl): Set decl's context.
153 * decl.c (grokfndecl): Make DECL_CONTEXT setting clearer.
155 2020-07-28 Nathan Sidwell <nathan@acm.org>
157 * class.c (fixup_type_variants): Copy TYPE_SIZE and
159 (finish_struct): Call it.
161 2020-07-28 Nathan Sidwell <nathan@acm.org>
163 * ptree.c (cxx_print_decl): Better indentation.
165 2020-07-28 Jakub Jelinek <jakub@redhat.com>
166 Mark Wielaard <mark@klomp.org>
169 * parser.c (cp_lexer_safe_previous_token): Don't call
170 cp_lexer_previous_token, instead inline it by hand and return NULL
171 instead of failing assertion if all previous tokens until the first
173 (cp_parser_error_1): Optimize - only call cp_lexer_safe_previous_token
174 if token->type is CPP_NAME. Use cp_lexer_safe_previous_token instead
175 of cp_lexer_previous_token for the missing_token_desc != RT_NONE
178 2020-07-27 Nathan Sidwell <nathan@acm.org>
180 * cp-tree.h (enum cp_tree_index): Add CPTI_AS_BASE_IDENTIFIER.
181 (as_base_identifier): Define.
182 * decl.c (initialize_predifined_identifiers): Initialize as_base
184 * class.c (layout_class_type): Name the as-base type. Zap
185 NSDMI its fields may have.
187 2020-07-22 Nathan Sidwell <nathan@acm.org>
189 * class.c (maybe_add_class_template_decl_list): Don't add CONST_DECLs.
191 2020-07-22 Nathan Sidwell <nathan@acm.org>
193 * typeck.c (structural_comptypes): [DECLTYPE_TYPE] break
195 [UNDERLYING_TYPE]: Use an if.
198 2020-07-22 Nathan Sidwell <nathan@acm.org>
200 * decl.c (decls_match): Move variables into scopes
202 (duplicate_decls): Use STRIP_TEMPLATE.
203 (build_typename_type): Move var decls to their assignments.
204 (begin_function_body): Likewise.
205 * decl2.c (get_guard): Likewise.
206 (mark_used): Use true for truthiness.
207 * error.c (dump_aggr_type): Hold the decl in a var called
210 2020-07-22 Nathan Sidwell <nathan@acm.org>
212 * cp-tree.h (struct tree_lambda_expr): Shrink
213 default_capture_mode & discriminator.
215 2020-07-22 Nathan Sidwell <nathan@acm.org>
217 * mangle.c (decl_is_template_id): Rename to ...
218 (maybe_template_info): ... here. Return the template info,
219 rather than use a pointer. Adjust all callers.
220 (find_substitution): Use template_args_equal, rather than
223 2020-07-22 Tobias Burnus <tobias@codesourcery.com>
225 * parser.c (cp_parser_omp_clause_hint): Require nonnegative hint.
226 (cp_parser_omp_critical): Permit hint(0) clause without named critical.
227 * pt.c (tsubst_expr): Re-check the latter for templates.
229 2020-07-21 Sunil K Pandey <skpgkp2@gmail.com>
232 * decl.c (cp_finish_decl): Call target hook
233 lower_local_decl_alignment to lower local decl alignment.
235 2020-07-21 Nathan Sidwell <nathan@acm.org>
237 * parser.c (cp_lexer_consume_token): Drop PRAGMA_EOL assert.
238 (cp_parser_skip_to_closing_parenthesis_1): Only pass start token
239 to pragma skipper if recovering.
240 (cp_parser_skip_to_pragma_eol): Only purge and change pragma
241 state when recovering.
243 2020-07-20 Jason Merrill <jason@redhat.com>
245 * pt.c (type_dependent_expression_p): A pseudo-dtor can be
247 * semantics.c (finish_call_expr): Use build_trivial_dtor_call for
249 (finish_pseudo_destructor_expr): Leave type NULL for dependent arg.
251 2020-07-20 Jason Merrill <jason@redhat.com>
253 * mangle.c (write_base_ref): New.
254 (write_expression): Use it for base field COMPONENT_REFs.
255 * pt.c (invalid_tparm_referent_p): Canonicalize the type
256 of array offsets. Allow subobjects.
258 2020-07-20 Jason Merrill <jason@redhat.com>
260 * pt.c (collect_ctor_idx_types): Add 'const' when deducing from
263 2020-07-17 Marek Polacek <polacek@redhat.com>
266 * decl.c (grokdeclarator): Detect cv-qual decltype(auto).
267 * pt.c (do_auto_deduction): Likewise.
269 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
276 * coroutines.cc (struct coro_ret_data): Delete.
277 (coro_maybe_expand_co_return): Delete.
278 (co_return_expander): Delete.
279 (expand_co_returns): Delete.
280 (co_await_find_in_subtree): Remove unused name.
281 (build_actor_fn): Remove unused parm, remove handling
282 for co_return expansion.
283 (register_await_info): Demote duplicate info message to a
285 (coro_make_frame_entry): Move closer to use site.
286 (struct susp_frame_data): Add fields for final suspend label
287 and a flag to indicate await expressions with initializers.
288 (captures_temporary): Delete.
289 (register_awaits): Remove unused code, update comments.
290 (find_any_await): New.
291 (tmp_target_expr_p): New.
292 (struct interesting): New.
293 (find_interesting_subtree): New.
294 (struct var_nest_node): New.
295 (flatten_await_stmt): New.
296 (handle_nested_conditionals): New.
297 (process_conditional): New.
298 (replace_statement_captures): Rename to...
299 (maybe_promote_temps): ... this.
300 (maybe_promote_captured_temps): Delete.
301 (analyze_expression_awaits): Check for await expressions with
302 initializers. Simplify handling for truth-and/or-if.
303 (expand_one_truth_if): Simplify (map cases that need expansion
305 (await_statement_walker): Handle CO_RETURN_EXPR. Simplify the
306 handling for truth-and/or-if expressions.
307 (register_local_var_uses): Ensure that we create names in the
308 implementation namespace.
309 (morph_fn_to_coro): Add final suspend label to suspend frame
310 callback data and remove it from the build_actor_fn call.
312 2020-07-16 Marek Polacek <polacek@redhat.com>
314 * call.c (convert_like): Remove macro and introduce a new
316 (convert_like_with_context): Likewise.
317 (convert_like_real): Rename to convert_like.
318 (convert_like_real_1): Rename to convert_like_internal. Call
319 convert_like instead of convert_like_real therein.
320 (perform_direct_initialization_if_possible): Call convert_like
321 instead of convert_like_real.
323 2020-07-16 Iain Sandoe <iain@sandoe.co.uk>
325 * coroutines.cc: Correct some spelling errors
328 2020-07-15 Nathan Sidwell <nathan@acm.org>
330 * parser.c (cp_parser_declaration): Avoid copying tokens.
331 (cp_parser_block_declaration): RAII token pointer.
333 2020-07-15 Nathan Sidwell <nathan@acm.org>
335 * parser.c (cp_parser_skip_to_closing_parenthesis_1): Deal with
336 meeting a deferred pragma.
337 (cp_parser_skip_to_end_of_statement): Likewise.
338 (cp_parser_skip_to_end_of_block_or_statement): Likewise.
339 (cp_parser_skip_to_pragma_eol): We should never meet EOF.
340 (cp_parser_omp_declare_simd): Likewise.
341 (cp_parser_omp_declare_reduction, cp_parser_oacc_routine)
342 (pragma_lex): Likewise.
344 2020-07-14 Marek Polacek <polacek@redhat.com>
349 * call.c (convert_like_real_1): Renamed from convert_like_real.
350 (convert_like_real): New wrapper for convert_like_real_1.
352 2020-07-14 Nathan Sidwell <nathan@acm.org>
354 * parser.c (cp_lexer_alloc): Do not deal with PCH here.
355 (cp_lexer_new_main): Deal with PCH here. Store the tokens directly
357 (cp_lexer_new_from_tokens): Assert last token isn't purged either.
358 (cp_lexer_get_preprocessor_token): Change first arg to flags, adjust.
359 (cp_parser_new): Pass the lexer in, don't create it here.
360 (cp_parser_translation_unit): Initialize access checks here.
361 (cp_parser_initial_pragma): First token is provided by caller,
362 don't deal with PCH stopping here. Adjust error message.
363 (c_parse_file): Adjust, change error message to avoid C++20 module
366 2020-07-14 Nathan Sidwell <nathan@acm.org>
368 * ptree.c (cxx_print_type): Add TYPEOF_TYPE and BASES.
370 2020-07-14 Nathan Sidwell <nathan@acm.org>
372 * class.c (build_base_field_1): Cache CLASSTYPE_AS_BASE.
373 (build_self_reference): Rename value -> decl.
374 (dump_class_hierarchy_1): Cache CLASSTYPE_AS_BASE.
376 2020-07-14 Marek Polacek <polacek@redhat.com>
379 * decl.c (grokdeclarator) <case cdk_function>: Check also
380 pointers/references/... to functions.
382 2020-07-14 Nathan Sidwell <nathan@acm.org>
384 * cp-tree.h: Correct some tree lang flag comments,
385 reformat some structure definitions. Note some structure
386 sizes. Clarify some comments.
387 (yyungetc): Delete. Not been a thing for some time.
388 * class.c (copy_fndecl_with_name): Comment.
389 (check_bases_and_members): Unnecessary {}.
390 (layout_class_type): Comment.
391 * cp-tree.def (UNBOUND_CLASS_TEMPLATE): Adjust comment.
392 * decl.c: Fix some formatting & whitespace issues.
393 (function_requirements_equivalent_p): Note why
394 substitutions are needed.
395 * decl2.c (no_linkage_error): Note that heroics about
396 'typedef struct { ... };' are no longer needed.
397 * method.c: Whitespace.
398 * name-lookup.c: Whitespace.
399 (add_decl_to_level): Reformat a line.
400 (print_binding_stack): Mark as DEBUG_FUNCTION.
401 (has_using_namespace_std_directive_p): Delete comment.
403 * ptree.c: Whitespace.
404 * rtti.c: Whitespace & comment.
406 * typeck.c (structural_comptypes): Add comment.
408 2020-07-13 Nathan Sidwell <nathan@acm.org>
410 * Make-lang.in (c++.disclean): Likewise.
412 2020-07-13 Marek Polacek <polacek@redhat.com>
415 * parser.c (cp_parser_enum_specifier): Commit to tentative parse
416 after we've seen an opening brace.
418 2020-07-10 Jason Merrill <jason@redhat.com>
420 * tree.c (structural_type_p): Allow unions.
421 * mangle.c (write_expression): Express unions with a designator.
423 2020-07-10 Jason Merrill <jason@redhat.com>
425 * pt.c (convert_nontype_argument): Handle REAL_TYPE.
426 (invalid_nontype_parm_type_p): Allow all structural types.
427 * tree.c (structural_type_p): Use SCALAR_TYPE_P.
429 2020-07-10 Jason Merrill <jason@redhat.com>
434 * class.c (check_field_decls): An array of empty classes is not an
436 (layout_empty_base_or_field): Handle explicit alignment.
439 2020-07-09 Julian Brown <julian@codesourcery.com>
440 Thomas Schwinge <thomas@codesourcery.com>
443 * semantics.c (finish_omp_clauses): Likewise.
445 2020-07-09 Patrick Palka <ppalka@redhat.com>
448 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
449 Restore dependent_type_p check that guarded the call to
450 is_really_empty_class.
452 2020-07-08 Patrick Palka <ppalka@redhat.com>
455 * constexpr.c (potential_constant_expression_1) <case PARM_DECL>:
456 When processing_template_decl, check COMPLETE_TYPE_P before
457 calling is_really_empty_class. Don't check dependent_type_p.
459 2020-07-08 Marek Polacek <polacek@redhat.com>
462 * parser.c (cp_parser_decltype): Print error about using decltype(auto)
463 in C++11. Check that the token following "auto" is ")".
465 2020-07-07 Patrick Palka <ppalka@redhat.com>
468 * cxx-pretty-print.c (pp_cxx_unqualified_id): Check
469 PRIMARY_TEMPLATE_P before printing the innermost template
472 2020-07-07 Martin Sebor <msebor@redhat.com>
475 * parser.c (class_decl_loc_t::diag_mismatched_tags): Print notes only
476 if warning_at returns nonzero.
478 2020-07-06 Martin Sebor <msebor@redhat.com>
481 * call.c (build_over_call): Check calls only when tf_warning is set.
483 2020-07-06 Nathan Sidwell <nathan@acm.org>
485 * decl.c (push_library_fn): Return the decl pushdecl_toplevel returns.
486 * except.c (verify_library_fn): Replace with ...
487 (declare_library_fn_1): ... this fn. Always push the fn.
488 (declare_library_fn): Call it.
489 (build_throw): Call declare_library_fn_1.
491 2020-07-06 Jonathan Wakely <jwakely@redhat.com>
494 * parser.c (cp_parser_toplevel_declaration): Only do pedwarn for
495 empty-declaration in C++98.
497 2020-07-02 Jason Merrill <jason@redhat.com>
498 Jakub Jelinek <jakub@redhat.com>
500 * decl.c (grokfndecl): Allow consteval virtual.
501 * search.c (check_final_overrider): Check consteval mismatch.
502 * constexpr.c (cxx_eval_thunk_call): New.
503 (cxx_eval_call_expression): Call it.
504 * cvt.c (cp_get_fndecl_from_callee): Handle FDESC_EXPR.
505 * decl2.c (mark_vtable_entries): Track vtables with consteval.
506 (maybe_emit_vtables): Pass consteval_vtables through.
507 (clear_consteval_vfns): Replace consteval with nullptr.
508 (c_parse_final_cleanups): Call it.
510 2020-07-01 Nathan Sidwell <nathan@acm.org>
512 * class.c (copy_fndecl_with_name): Add additional predicate args, do
513 not deduce them locally.
514 (copy_operator_fn): Adjust copy_fndecl_with_name call.
515 (build_clone): Add vtt and inherited predicate args. Pass through
516 to copy_fndecl_with_name call.
517 (build_cdtor_clones): Likewise, pass through to build_clone as
519 (build_cdtor): Determine vtt and inherited here.
520 * cp-tree.h (DECL_NEEDS_CTT_PARM_P): Delete.
522 2020-06-30 Nathan Sidwell <nathan@acm.org>
524 * cp-tree.h (copy_fndecl_with_name): Rename to ...
525 (copy_operatorn_fn): ... this. Change arg type.
526 (clone_function_decl): Rename to ...
527 (clone_cdtor): ... this.
528 * class.c (copy_fndecl_with_name): Make static.
529 (copy_operator_fn): New wrapper.
530 (build_clones): Rename to ...
531 (build_cdtor_clones): ... this.
532 (clone_function_decl): Rename to ...
533 (clone_cdtor): ... this. Adjust build_clones calls.
534 (clone_constructors_and_destructors): Adjust clone_function_decl
536 * method.c (implicitly_declare_fn): Adjust copy_fndecl_with_name
538 (lazily_declare_fn): Adjust clone_function_decl call.
539 * pt.c (tsubst_function_decl): Likewise.
540 (instantiate_template_1): Likewise.
542 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
544 * coroutines.cc (morph_fn_to_coro): Remove trailing
545 space in a diagnostic.
547 2020-06-30 Iain Sandoe <iain@sandoe.co.uk>
549 * coroutines.cc (expand_one_await_expression): Remove
550 code dealing with initial suspend.
551 (build_actor_fn): Remove code special-casing initial
552 and final suspend. Handle the final suspend and marking
553 of the coroutine as done.
554 (coro_rewrite_function_body): New.
555 (bind_expr_find_in_subtree): Remove.
556 (coro_body_contains_bind_expr_p): Remove.
557 (morph_fn_to_coro): Split the rewrite of the original
558 function into coro_rewrite_function_body and call it.
560 2020-06-29 Marek Polacek <polacek@redhat.com>
563 * decl.c (duplicate_decls): Make sure a concept or a variable
564 template is unique in its declarative region.
566 2020-06-29 Marek Polacek <polacek@redhat.com>
569 * pt.c (collect_ctor_idx_types): Use TREE_TYPE.
571 2020-06-28 Iain Sandoe <iain@sandoe.co.uk>
574 * coroutines.cc (register_local_var_uses): Skip past
577 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
580 * coroutines.cc (get_awaitable_var): New helper.
581 (build_co_await): Check more carefully before
582 copying an awaitable.
583 (expand_one_await_expression): No initializer
584 is required when the awaitable is not a temp.
585 (register_awaits): Remove handling that is now
586 completed when the await expression is built.
588 2020-06-27 Iain Sandoe <iain@sandoe.co.uk>
590 * coroutines.cc (morph_fn_to_coro): Diagnose unavailable
591 get_return_object_on_allocation_failure.
593 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
596 * coroutines.cc (struct coroutine_info):Add a field
597 to hold computed p.return_void expressions.
598 (coro_build_promise_expression): New.
599 (get_coroutine_return_void_expr): New.
600 (finish_co_yield_expr): Build the promise expression
601 using coro_build_promise_expression.
602 (finish_co_return_stmt): Likewise.
603 (build_init_or_final_await): Likewise.
604 (morph_fn_to_coro): Likewise, for several cases.
606 2020-06-26 Iain Sandoe <iain@sandoe.co.uk>
608 * coroutines.cc (morph_fn_to_coro): Handle error
609 returns in building g-r-o-o-a-f expressions.
611 2020-06-24 Nicholas Krause <xerofoify@gmail.com>
614 * typeck2.c (cxx_incomplete_type_diagnostic): Add missing
615 TYPE_EXPANSION_PACK check for diagnosing incomplete types in
616 cxx_incomplete_type_diagnostic.
618 2020-06-24 Iain Sandoe <iain@sandoe.co.uk>
622 * coroutines.cc (act_des_fn): Copy function
623 attributes onto the outlined coroutine helpers.
625 2020-06-24 Jason Merrill <jason@redhat.com>
627 * call.c (build_over_call): Only call build_base_path once.
629 2020-06-24 Jason Merrill <jason@redhat.com>
632 * call.c (build_over_call): Look up the overrider in base_binfo.
633 * class.c (lookup_vfn_in_binfo): Look through BINFO_PRIMARY_P.
635 2020-06-23 Jason Merrill <jason@redhat.com>
638 Implement C++20 P2082R1, Fixing CTAD for aggregates.
639 * cp-tree.h (TPARMS_PRIMARY_TEMPLATE): Split out from...
640 (DECL_PRIMARY_TEMPLATE): ...here.
641 (builtin_guide_p): Declare.
642 * decl.c (reshape_init_class): Handle bases of a template.
643 (reshape_init_r): An array with dependent bound takes a single
645 * pt.c (tsubst_default_argument): Shortcut {}.
646 (unify_pack_expansion): Allow omitted arguments to trailing pack.
647 (builtin_guide_p): New.
648 (collect_ctor_idx_types): Give a trailing pack a {} default
649 argument. Handle arrays better.
651 2020-06-23 Iain Sandoe <iain@sandoe.co.uk>
654 * coroutines.cc (morph_fn_to_coro): Apply a cleanup to
655 the get return object when the DTOR is non-trivial.
657 2020-06-20 Iain Sandoe <iain@sandoe.co.uk>
660 * coroutines.cc (morph_fn_to_coro): Update handling of
661 get-return-object-on-allocation-fail and diagnose missing
664 2020-06-20 Jason Merrill <jason@redhat.com>
666 * call.c (joust): Only compare constraints for non-template
667 candidates with matching parameters.
668 * pt.c (tsubst_pack_expansion): Fix getting a type parameter
670 (more_specialized_fn): Only compare constraints for candidates with
673 2020-06-19 Jason Merrill <jason@redhat.com>
675 * method.c (early_check_defaulted_comparison): Allow defaulting
676 comparison outside class. Complain if non-member operator isn't a
679 2020-06-18 Jason Merrill <jason@redhat.com>
681 * method.c (early_check_defaulted_comparison): Check for &&.
682 (build_comparison_op): Allow empty union. Diagnose non-category
684 (common_comparison_type): Remove handling for non-category type.
686 2020-06-18 Marek Polacek <polacek@redhat.com>
689 * pt.c (finish_template_variable): Return if
690 coerce_innermost_template_parms return error_mark_node.
692 2020-06-18 Marek Polacek <polacek@redhat.com>
695 * pt.c (tsubst_copy_and_build) <case NEW_EXPR>: Return error_mark_node
696 if placement is erroneous.
698 2020-06-17 Jonathan Wakely <jwakely@redhat.com>
701 * parser.c (cp_parser_elaborated_type_specifier): Do not warn
702 unless in a declaration.
704 2020-06-17 Jason Merrill <jason@redhat.com>
706 * cp-tree.h (copy_fndecl_with_name): Declare.
707 * class.c (copy_fndecl_with_name): Split out from...
708 (build_clone): ...here.
709 (add_implicitly_declared_members): Add op== to TYPE_FIELDS.
710 * method.c (implicitly_declare_fn): Use copy_fndecl_with_name.
712 2020-06-17 Jason Merrill <jason@redhat.com>
714 * call.c (build_new_op_1): Don't look for a CALL_EXPR when
715 calling a consteval function.
717 2020-06-17 Jason Merrill <jason@redhat.com>
719 * decl2.c (grokfield): Pass SD_DEFAULTED and SD_DELETED.
720 * decl.c (duplicate_decls): Reduce error for delete
721 after earlier declaration to pedwarn.
723 2020-06-17 Marek Polacek <polacek@redhat.com>
726 * constexpr.c (maybe_fold_non_dependent_expr): New.
727 * cp-tree.h (maybe_fold_non_dependent_expr): Declare.
728 * typeck.c (cp_build_array_ref): Call maybe_fold_non_dependent_expr
729 instead of maybe_constant_value.
731 2020-06-16 Marek Polacek <polacek@redhat.com>
734 * call.c (add_list_candidates): Return if a designated initializer
735 is used with a non-aggregate.
736 (implicit_conversion_error): Give an error for the case above.
738 2020-06-16 Marek Polacek <polacek@redhat.com>
741 * name-lookup.c (check_local_shadow): Check if types are
742 non-null before calling same_type_p.
744 2020-06-16 Jakub Jelinek <jakub@redhat.com>
746 * semantics.c (handle_omp_for_class_iterator): Adjust
747 c_omp_check_loop_iv_exprs caller.
748 (finish_omp_for): Likewise. Don't call fold_build_cleanup_point_expr
749 before calling c_finish_omp_for and c_omp_check_loop_iv, move it
751 * pt.c (tsubst_omp_for_iterator): Handle non-rectangular loops.
753 2020-06-16 Jakub Jelinek <jakub@redhat.com>
755 * parser.c (cp_parser_omp_clause_schedule): Reject modifier separated
756 from kind by comma rather than colon.
758 2020-06-16 Patrick Palka <ppalka@redhat.com>
760 * pt.c (perform_instantiation_time_access_checks): No need to
762 * semantics.c (enforce_access): Verify that decl is not
765 2020-06-16 Patrick Palka <ppalka@redhat.com>
769 * cp-tree.h (qualified_typedef_usage_s): Delete.
770 (qualified_typedef_usage_t): Delete.
771 (deferred_access_check): Move up in file.
772 (tree_template_info::typedefs_needing_access_checking): Delete.
773 (tree_template_info::deferred_access_checks): New field.
774 (TI_TYPEDEFS_NEEDING_ACCESS_CHECKING): Rename to ...
775 (TI_DEFERRED_ACCESS_CHECKS): ... this, and adjust accordingly.
776 * pt.c (perform_typedefs_access_check): Rename to ...
777 (perform_instantiation_time_access_checks): ... this, and adjust
778 accordingly. Remove unnecessary tree tests.
779 (instantiate_class_template_1): Adjust accordingly.
780 (instantiate_decl): Likewise.
781 * semantics.c (enforce_access): Likewise.
783 2020-06-16 Patrick Palka <ppalka@redhat.com>
787 * call.c (enforce_access): Move to semantics.c.
788 * cp-tree.h (enforce_access): Delete.
789 (get_types_needing_access_check): Delete.
790 (add_typedef_to_current_template_for_access_check): Delete.
791 * decl.c (make_typename_type): Adjust accordingly. Use
792 check_accessibility_of_qualified_id instead of directly using
793 perform_or_defer_access_check.
794 * parser.c (cp_parser_template_declaration_after_parameters):
795 Don't push a dk_no_check access state when parsing a template.
796 * pt.c (get_types_needing_access_check): Delete.
797 (append_type_to_template_for_access_check_1): Delete.
798 (perform_typedefs_access_check): Adjust. If type_decl is a
799 FIELD_DECL, also check its DECL_CONTEXT for dependence. Use
800 tsubst_copy instead of tsubst to substitute into type_decl so
801 that we substitute into the DECL_CONTEXT of a FIELD_DECL.
802 (append_type_to_template_for_access_check): Delete.
803 * search.c (accessible_p): Remove the processing_template_decl
805 * semantics.c (enforce_access): Moved from call.c. If we're
806 parsing a template and the access check failed, add the check to
807 TI_TYPEDEFS_NEEDING_ACCESS_CHECKING.
808 (perform_or_defer_access_check): Adjust comment.
809 (add_typedef_to_current_template_for_access_check): Delete.
810 (check_accessibility_of_qualified_id): Adjust accordingly.
811 Exit early if the scope is dependent.
813 2020-06-11 Patrick Palka <ppalka@redhat.com>
816 * constraint.cc (associate_classtype_constraints): If there is a
817 discrepancy between the current template depth and the template
818 depth of the original declaration, then adjust the template
819 parameter depth within the current constraints appropriately.
820 * pt.c (tsubst_friend_class): Substitute into and set the
821 constraints on the injected declaration.
823 2020-06-11 Iain Sandoe <iain@sandoe.co.uk>
825 * coroutines.cc (instantiate_coro_traits): Pass a reference
826 to lambda closure objects to traits instantiation.
827 (morph_fn_to_coro): Likewise for promise parameter
828 preview and allocator lookup.
830 2020-06-10 Iain Sandoe <iain@sandoe.co.uk>
833 * call.c (add_candidates): Use vec_safe_length() for
834 testing the arguments list.
835 (build_new_method_call_1): Use vec_safe_is_empty() when
836 checking for an empty args list.
838 2020-06-10 Marek Polacek <polacek@redhat.com>
841 * parser.c (cp_parser_direct_declarator): Clear
842 CP_PARSER_FLAGS_DELAY_NOEXCEPT if the declarator kind is not
845 2020-06-09 Iain Sandoe <iain@sandoe.co.uk>
848 * coroutines.cc (expand_one_await_expression): Build separate
849 DTOR trees for the awaitable object on the destroy and resume
852 2020-06-09 Jason Merrill <jason@redhat.com>
855 * cp-gimplify.c (predeclare_vla): Only predeclare a VLA if it's
856 wrapped in a pointer type.
858 2020-06-05 Marek Polacek <polacek@redhat.com>
861 * call.c (build_converted_constant_expr_internal): Allow
864 2020-06-05 Iain Sandoe <iain@sandoe.co.uk>
866 * cp-tree.def (CO_RETURN_EXPR): Correct the class
867 to use tcc_statement.
869 2020-06-05 Jason Merrill <jason@redhat.com>
871 * error.c (dump_binary_op): Handle negative operand to
874 2020-06-04 Jason Merrill <jason@redhat.com>
877 * constexpr.c (cxx_eval_constant_expression) [OBJ_TYPE_REF]:
878 Evaluate OBJ_TYPE_REF_EXPR.
880 2020-06-04 Jason Merrill <jason@redhat.com>
883 * class.c (lookup_vfn_in_binfo): New.
884 * call.c (build_over_call): Use it.
885 * cp-tree.h (resolves_to_fixed_type_p): Add default argument.
886 (lookup_vfn_in_binfo): Declare.
888 2020-06-04 Iain Sandoe <iain@sandoe.co.uk>
891 * coroutines.cc (morph_fn_to_coro): Ensure that the get-
892 return-object is constructed correctly; When it is not the
893 final return value, pass it to the CTOR of the return type
894 as an rvalue, per the standard comment.
896 2020-06-04 Jakub Jelinek <jakub@redhat.com>
900 * constexpr.c (cxx_eval_constant_expression): Diagnose CONVERT_EXPR
901 conversions from pointer types to arithmetic types here...
902 (cxx_eval_outermost_constant_expr): ... instead of here.
904 2020-06-03 Mark Wielaard <mark@klomp.org>
906 * parser.c (cp_lexer_safe_previous_token): New function.
907 (cp_parser_error_1): Add name_hint if the previous token is
908 a string literal and next token is a CPP_NAME and we have a
909 missing header suggestion for the name.
911 2020-06-03 Patrick Palka <ppalka@redhat.com>
913 * pt.c (process_partial_specialization): Pass the full set of
914 generic template arguments to strictly_subsumes.
916 2020-06-03 Patrick Palka <ppalka@redhat.com>
919 * pt.c (most_specialized_partial_spec): Reorganize the loop over
920 DECL_TEMPLATE_SPECIALIZATIONS. Check constraints_satisfied_p on
921 the original template declaration, not on the tsubsted one.
923 2020-06-03 Iain Sandoe <iain@sandoe.co.uk>
926 * coroutines.cc (finish_co_await_expr): Revise to allow for
928 (finish_co_yield_expr): Likewise.
930 2020-06-03 Jason Merrill <jason@redhat.com>
933 * cp-tree.h (predeclare_vla): Declare.
934 * cp-gimplify.c (predeclare_vla): Handle getting a decl.
935 * pt.c (tsubst_expr) [DECL_EXPR]: Use it.
937 2020-06-03 Tobias Burnus <tobias@codesourcery.com>
939 * cp-gimplify.c (cxx_omp_predetermined_mapping): New.
940 * cp-objcp-common.h (LANG_HOOKS_OMP_PREDETERMINED_MAPPING): Redfine.
941 * cp-tree.h (cxx_omp_predetermined_mapping): Declare.
943 2020-06-02 Jason Merrill <jason@redhat.com>
946 * pt.c (tsubst_decl): Relax assert.
948 2020-06-02 Iain Sandoe <iain@sandoe.co.uk>
951 * coroutines.cc (build_co_await): Wrap the co_await expression
952 in a TARGET_EXPR, where needed.
953 (finish_co_yield_expr): Likewise.
955 2020-06-02 Patrick Palka <ppalka@redhat.com>
959 * pt.c (tsubst_function_decl): Don't do set_constraints when
960 regenerating a lambda.
961 (tsubst_lambda_expr): Substitute into the lambda's constraints
962 and do set_constraints here.
964 2020-06-01 Jason Merrill <jason@redhat.com>
969 * class.c (build_vfn_ref): Revert 95311 change.
970 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): Build a
973 2020-06-01 Iain Sandoe <iain@sandoe.co.uk>
976 * coroutines.cc (struct param_info): Remove rv_ref field.
977 (build_actor_fn): Remove specifial rvalue ref handling.
978 (morph_fn_to_coro): Likewise.
980 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
983 * coroutines.cc (morph_fn_to_coro): If we see an
984 early fatal error, drop the erroneous function body.
986 2020-05-31 Iain Sandoe <iain@sandoe.co.uk>
988 * coroutines.cc (build_co_await): Remove unused
990 (finish_co_await_expr): Likewise.
991 (finish_co_yield_expr): Likewise; revise comment.
993 2020-05-30 Iain Sandoe <iain@sandoe.co.uk>
995 * coroutines.cc (morph_fn_to_coro): Revise initialization
996 of the frame pointer to avoid an unused value.
998 2020-05-30 Patrick Palka <ppalka@redhat.com>
1001 * constraint.cc (satisfaction_value): Accept INTEGER_CST of any
1004 2020-05-29 Patrick Palka <ppalka@redhat.com>
1005 Jason Merrill <jason@redhat.com>
1008 * class.c (add_method): Let special member function templates
1009 coexist if they are not equivalently constrained, or in a class
1012 2020-05-29 Jason Merrill <jason@redhat.com>
1015 * pt.c (process_template_parm): Set DECL_TEMPLATE_INFO
1016 on the DECL_TEMPLATE_RESULT.
1018 2020-05-29 Marek Polacek <polacek@redhat.com>
1021 * cp-gimplify.c (cp_fold) <case MODIFY_EXPR>: Don't set
1022 TREE_THIS_VOLATILE here.
1023 (cp_fold): Set it here along with TREE_NO_WARNING.
1025 2020-05-29 Jason Merrill <jason@redhat.com>
1029 * class.c (build_vfn_ref): Don't fold the INDIRECT_REF.
1031 2020-05-29 Patrick Palka <ppalka@redhat.com>
1036 * parser.c (cp_parser_requires_clause_expression): Temporarily
1037 increment processing_template_decl only if it is 0.
1038 (cp_parser_constraint_expression): Likewise.
1039 (cp_parser_requires_expression): Likewise.
1041 2020-05-29 Patrick Palka <ppalka@redhat.com>
1044 * constexpr.c (get_or_insert_ctor_field): Add limited support
1045 for RANGE_EXPR index lookups.
1047 2020-05-28 Jakub Jelinek <jakub@redhat.com>
1050 * decl.c (cp_finish_decomp): Call complete_type before checking
1053 2020-05-28 Jason Merrill <jason@redhat.com>
1056 * decl.c (cp_finish_decl): Revert r9-297 change.
1057 (check_static_variable_definition): Likewise.
1058 * constexpr.c (ensure_literal_type_for_constexpr_object): Likewise.
1059 * pt.c (instantiate_decl): Return early on type error.
1061 2020-05-27 Jason Merrill <jason@redhat.com>
1064 * decl.c (reshape_init_array_1): Don't reuse in overload context.
1066 2020-05-27 Jason Merrill <jason@redhat.com>
1069 * call.c (build_new_op_1): Suppress
1070 warn_zero_as_null_pointer_constant across comparison of <=> result
1073 2020-05-27 Jason Merrill <jason@redhat.com>
1076 * decl.c (grokdeclarator): Don't shift attributes in TYPENAME
1079 2020-05-27 Nathan Sidwell <nathan@acm.org>
1082 * pt.c (lookup_template_class_1): Restore alias template mutation.
1084 2020-05-26 Jakub Jelinek <jakub@redhat.com>
1087 * cp-gimplify.c: Include omp-general.h.
1088 (cp_genericize_r) <case OMP_DISTRIBUTE>: For class iteration
1089 variables in composite distribute parallel for, instantiate copy
1090 ctor of their types.
1092 2020-05-23 Patrick Palka <ppalka@redhat.com>
1095 * constexpr.c (cxx_eval_constant_expression)
1096 <case TEMPLATE_ID_EXPR>: Don't evaluate the concept when
1097 constexpr evaluation is uid-sensitive.
1099 2020-05-22 Jason Merrill <jason@redhat.com>
1101 * cp-gimplify.c (cp_gimplify_expr) [CALL_EXPR]: Don't preevaluate
1102 the function address if the call used operator syntax.
1104 2020-05-21 Jason Merrill <jason@redhat.com>
1107 * cp-ubsan.c (cp_ubsan_maybe_instrument_member_call): For a virtual
1108 call, instrument the OBJ_TYPE_REF.
1110 * decl.c (compute_array_index_type_loc): Diagnose expressions
1111 in a template that can't be constant.
1112 * parser.c (cp_parser_direct_declarator): Don't check
1113 non-constant array bounds here.
1115 * cp-tree.h (is_rvalue_constant_expression): Declare.
1116 * constexpr.c (is_rvalue_constant_expression): New.
1117 * parser.c (cp_parser_constant_expression): Use it.
1118 * decl.c (cp_finish_decl): Try to treat a constexpr initializer in a
1119 template as constant.
1121 * typeck.c (build_x_modify_expr): Handle error_mark_node arguments.
1123 * decl.c (grokparms): Return NULL_TREE if any parms were erroneous.
1125 2020-05-21 Iain Sandoe <iain@sandoe.co.uk>
1127 * coroutines.cc (finish_co_return_stmt): Revert change to use
1130 2020-05-21 Patrick Palka <ppalka@redhat.com>
1133 * constexpr.c (constexpr_ctx::uid_sensitive): Remove field.
1134 (uid_sensitive_constexpr_evaluation_value): Define.
1135 (uid_sensitive_constexpr_evaluation_true_counter): Define.
1136 (uid_sensitive_constexpr_evaluation_p): Define.
1137 (uid_sensitive_constexpr_evaluation_sentinel): Define its
1139 (uid_sensitive_constexpr_evaluation_checker): Define its
1140 constructor and its evaluation_restricted_p method.
1141 (get_fundef_copy): Remove 'ctx' parameter. Use u_s_c_e_p
1142 instead of constexpr_ctx::uid_sensitive.
1143 (cxx_eval_call_expression): Use u_s_c_e_p instead, and test it
1144 last. Adjust call to get_fundef_copy.
1145 (instantiate_cx_fn_r): Test u_s_c_e_p so that we increment the
1146 counter if necessary.
1147 (cxx_eval_outermost_constant_expr): Remove 'uid_sensitive'
1148 parameter. Adjust function body accordingly.
1149 (maybe_constant_value): Remove 'uid_sensitive' parameter and
1150 adjust function body accordingly. Set up a
1151 uid_sensitive_constexpr_evaluation_checker, and use it to
1152 conditionally update the cv_cache.
1153 * cp-gimplify.c (cp_fold): Set up a
1154 uid_sensitive_constexpr_evaluation_checker, and use it to
1155 conditionally update the fold_cache.
1156 * cp-tree.h (maybe_constant_value): Update declaration.
1157 (struct uid_sensitive_constexpr_evaluation_sentinel): Define.
1158 (struct sensitive_constexpr_evaluation_checker): Define.
1159 * expr.c (fold_for_warn): Set up a
1160 uid_sensitive_constexpr_evaluation_sentinel before calling
1161 the folding subroutines. Drop all but the first argument to
1162 maybe_constant_value.
1164 2020-05-20 Marek Polacek <polacek@redhat.com>
1167 * parser.c (cp_parser_unqualified_id): Reject simple-template-id as
1168 the declarator-id of a destructor.
1169 (cp_parser_constructor_declarator_p): Reject simple-template-id as
1170 the declarator-id of a constructor.
1172 2020-05-20 Marek Polacek <polacek@redhat.com>
1176 * cp-tree.h (SD_DECOMPOSITION): New flag.
1177 * decl.c (duplicate_decls): Make sure a structured binding is unique
1178 in its declarative region.
1179 (start_decl): If INITIALIZED is SD_DECOMPOSITION, call
1180 fit_decomposition_lang_decl.
1181 (grokdeclarator): Compare INITIALIZED directly to SD_* flags.
1182 * parser.c (cp_parser_decomposition_declaration): Pass SD_DECOMPOSITION
1185 2020-05-20 Patrick Palka <ppalka@redhat.com>
1188 * typeck.c (structural_comptypes): Don't perform
1189 context-dependent resolution of TYPENAME_TYPEs when
1190 comparing_specializations.
1192 2020-05-19 Nathan Sidwell <nathan@acm.org>
1194 * pt.c (lookup_template_class_1): Do not reinit template_info of an
1197 2020-05-18 Martin Sebor <msebor@redhat.com>
1200 * call.c ((maybe_warn_class_memaccess): Use is_byte_access_type.
1201 * cp-tree.h (is_dummy_object): Return bool.
1202 (is_byte_access_type): Declare new function.
1203 * tree.c (is_dummy_object): Return bool.
1204 (is_byte_access_type): Define new function.
1206 2020-05-19 Patrick Palka <ppalka@redhat.com>
1209 * pt.c (init_template_processing): Enable sanitization for
1210 decl_specializations and type_specializations.
1213 * pt.c (fn_type_unification): Pass 'fn' instead of NULL_TREE as
1214 the 'in_decl' parameter to coerce_template_parms.
1216 2020-05-18 Marek Polacek <polacek@redhat.com>
1219 * typeck.c (cp_build_binary_op): Use fold_for_warn instead of
1222 2020-05-18 Marek Polacek <polacek@redhat.com>
1225 * cvt.c (cp_get_fndecl_from_callee): Return NULL_TREE if the function
1226 type is not INDIRECT_TYPE_P.
1227 * decl.c (omp_declare_variant_finalize_one): Call
1228 cp_get_callee_fndecl_nofold instead of looking for the function decl
1231 2020-05-18 Marek Polacek <polacek@redhat.com>
1234 * parser.c (cp_parser_has_attribute_expression): Sorry on a
1235 type-dependent argument.
1237 2020-05-18 Marek Polacek <polacek@redhat.com>
1241 * call.c (add_builtin_candidate) <case EQ_EXPR>: Create candidate
1242 operator functions when type is std::nullptr_t for ==/!=.
1243 * typeck.c (composite_pointer_type_r): Add a bool * parameter. Use it
1244 to maybe add "const" to the pointer type.
1245 (composite_pointer_type): Update the call to composite_pointer_type_r.
1246 (cp_build_binary_op): Turn two warning_at into error_at. Print the
1249 2020-05-18 Jason Merrill <jason@redhat.com>
1251 * call.c (build_over_call): Remove unnecessary
1252 cp_stabilize_reference.
1254 2020-05-18 Marek Polacek <polacek@redhat.com>
1256 * call.c (add_builtin_candidate): Don't create a builtin overload
1257 candidate for ++ when type is bool in C++17.
1259 2020-05-18 Marek Polacek <polacek@redhat.com>
1261 * cfns.h: Regenerated.
1263 2020-05-17 Iain Sandoe <iain@sandoe.co.uk>
1265 * coroutines.cc (morph_fn_to_coro): Initialize the gro variable.
1267 2020-05-16 Iain Sandoe <iain@sandoe.co.uk>
1269 * coroutines.cc (finish_co_return_stmt): Implement rules
1270 from [class.copy.elision] /3.
1272 2020-05-16 Patrick Palka <ppalka@redhat.com>
1275 * semantics.c (finish_decltype_type): Call
1276 instantiate_non_dependent_expr_sfinae on the expression.
1278 2020-05-15 Patrick Palka <ppalka@redhat.com>
1282 2020-04-07 Patrick Palka <ppalka@redhat.com>
1285 * typeck2.c (process_init_constructor_array): Propagate
1286 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
1287 the array initializer.
1289 2020-05-15 Jason Merrill <jason@redhat.com>
1291 PR c++/93286 - ICE with __is_constructible and variadic template.
1292 * pt.c (tsubst_tree_list): New.
1293 (tsubst, tsubst_copy_and_build): Use it.
1294 * decl2.c (is_late_template_attribute): Handle error_mark_node args.
1296 2020-05-15 Nathan Sidwell <nathan@acm.org>
1298 * pt.c (template_args_equal): Fix thinkos in previous 'cleanup'.
1300 2020-05-14 Jason Merrill <jason@redhat.com>
1303 * pt.c (maybe_instantiate_noexcept): Change clone handling.
1305 2020-05-14 Patrick Palka <ppalka@redhat.com>
1308 * call.c (build_op_call): Pass complain to lookup_fnfields.
1309 (build_special_member_call): Likewise.
1310 * class.c (type_requires_array_cookie): Pass tf_warning_or_error
1312 * cp-tree.h (lookup_fnfields): Add tsubst_flags_t parameter.
1313 * except.c (build_throw): Pass tf_warning_or_error to
1315 * init.c (build_new_1): Pass complain to lookup_fnfields.
1316 * method.c (locate_fn_flags): Likewise.
1317 * name-lookup.c (lookup_name_real_1): Pass tf_warning_or_error
1319 * pt.c (tsubst_baselink): Pass complain to lookup_fnfields.
1320 * search.c (lookup_fnfields): New 'complain' parameter. Pass it
1323 2020-05-14 Nathan Sidwell <nathan@acm.org>
1325 * parser.c (cp_parser_diagnose_invalid_typename): Mention
1326 std=c++20 not 2a, reformat dependent binfo inform loops.
1328 * pt.c (tsubst_template_decl): Reorder and commonize some control
1331 * pt.c (tsubst_friend_function): Simplify control flow.
1333 * pt.c (lookup_template_class_1): Remove unnecessary else by
1334 simply grabbing TYPE_NAME earlier.
1336 * pt.c (push_template_decl_real): Adjust friend pushing logic.
1337 Reinit template type.
1339 * pt.c (build_template_decl): Init DECL_TEMPLATE_RESULT &
1341 (process_partial_specialization): ... not here ...
1342 (push_template_decl_real, add_inherited_template_parms)
1343 (build_deduction_guide): ... or here.
1345 2020-05-14 Jakub Jelinek <jakub@redhat.com>
1347 * cp-gimplify.c (cp_genericize_r): Set cfun->has_omp_target.
1349 2020-05-13 Patrick Palka <ppalka@redhat.com>
1352 * init.c (build_vec_delete_1): Just return error_mark_node if
1353 deallocate_expr is error_mark_node.
1354 (build_delete): Just return error_mark_node if do_delete is
1357 2020-05-13 Patrick Palka <ppalka@redhat.com>
1360 * constraint.cc (tsubst_requires_expr): Produce a new
1361 requires-expression when processing_template_decl, even if
1362 template arguments are not dependent.
1364 2020-05-13 Marek Polacek <polacek@redhat.com>
1367 * decl.c (duplicate_decls): Set DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P.
1369 2020-05-13 Nathan Sidwell <nathan@acm.org>
1371 * pt.c (template_args_equal): Reorder category checking for
1374 * pt.c (perform_typedefs_access_check): Cache expensively
1375 calculated object references.
1376 (check_auto_in_tmpl_args): Just assert we do not get unexpected
1377 nodes, rather than silently do nothing.
1378 (append_type_to_template_for_access): Likewise, cache expensie
1381 * pt.c (canonical_type_parameter): Simplify.
1383 Formatting fixups & some simplifications.
1384 * pt.c (spec_hash_table): New typedef.
1385 (decl_specializations, type_specializations): Use it.
1386 (retrieve_specialization): Likewise.
1387 (register_specialization): Remove unnecessary casts.
1388 (push_template_decl_real): Reformat.
1389 (instantiate_class_template_1): Use more RAII.
1390 (make_argument_pack): Simplify.
1391 (instantiate_template_1): Use gcc_checking_assert for expensive
1393 (instantiate_decl): Likewise.
1394 (resolve_typename_type): Reformat comment.
1395 * semantics.c (struct deferred_access): Remove unnecessary GTY on
1397 (begin_class_definition): Fix formatting.
1399 2020-05-13 Jason Merrill <jason@redhat.com>
1401 * call.c, class.c, constexpr.c, constraint.cc, decl.c, init.c,
1402 lambda.c, lex.c, method.c, name-lookup.c, parser.c, pt.c, tree.c,
1403 typeck2.c: Change cxx2a to cxx20.
1405 2020-05-12 Marek Polacek <polacek@redhat.com>
1408 * parser.c (cp_parser_postfix_expression) <case CPP_OPEN_PAREN>: When
1409 looking for a block-scope function declaration, look through the whole
1410 set, not just the first function in the overload set.
1412 2020-05-12 Jakub Jelinek <jakub@redhat.com>
1415 * pt.c (tsubst_decl): Deal with DECL_OMP_PRIVATIZED_MEMBER for
1418 2020-05-11 Jason Merrill <jason@redhat.com>
1420 Resolve C++20 NB comment CA104
1421 * pt.c (determine_specialization): Compare constraints for
1422 specialization of member template of class instantiation.
1424 2020-05-11 Jason Merrill <jason@redhat.com>
1428 * tree.c (cp_walk_subtrees): Stop at typedefs.
1429 Handle TYPENAME_TYPE here.
1430 * pt.c (find_parameter_packs_r): Not here.
1431 (for_each_template_parm_r): Clear *walk_subtrees.
1432 * decl2.c (min_vis_r): Look through typedefs.
1434 2020-05-11 Jason Merrill <jason@redhat.com>
1436 * call.c (implicit_conversion_error): Split out from...
1437 (perform_implicit_conversion_flags): ...here.
1438 (build_converted_constant_expr_internal): Use it.
1440 2020-05-11 Jason Merrill <jason@redhat.com>
1443 * parser.c (inject_parm_decls): Set current_class_ptr here.
1444 (cp_parser_direct_declarator): And here.
1445 (cp_parser_late_return_type_opt): Not here.
1446 (cp_parser_noexcept_specification_opt): Nor here.
1447 (cp_parser_exception_specification_opt)
1448 (cp_parser_late_noexcept_specifier): Remove unneeded parameters.
1450 2020-05-11 Jason Merrill <jason@redhat.com>
1452 * decl.c (cxx_init_decl_processing): Call declare_weak for
1455 2020-05-11 Jason Merrill <jason@redhat.com>
1457 * pt.c (instantiate_class_template_1): Call tsubst_expr for
1458 STATIC_ASSERT member.
1459 * ptree.c (cxx_print_xnode): Handle STATIC_ASSERT.
1461 2020-05-11 Jason Merrill <jason@redhat.com>
1463 * pt.c (find_parameter_packs_r) [LAMBDA_EXPR]: Remove redundant
1464 walking of capture list.
1466 2020-05-11 Jason Merrill <jason@redhat.com>
1468 * cp-tree.h (LOOKUP_EXPLICIT_TMPL_ARGS): Remove.
1469 * call.c (build_new_function_call): Don't set it.
1470 (build_new_method_call_1): Likewise.
1471 (build_over_call): Check cand->explicit_targs instead.
1473 2020-05-11 Jason Merrill <jason@redhat.com>
1475 * decl.c (compute_array_index_type_loc): Stabilize before building
1478 2020-05-11 Jason Merrill <jason@redhat.com>
1480 * decl.c (grokdeclarator): Adjust deprecated_state here.
1481 (start_decl): Not here.
1483 2020-05-08 Iain Sandoe <iain@sandoe.co.uk>
1486 * coroutines.cc (build_actor_fn): Ensure that bind scopes
1487 are marked as having side-effects where necessary.
1488 (replace_statement_captures): Likewise.
1489 (morph_fn_to_coro): Likewise.
1491 2020-05-08 Nathan Sidwell <nathan@acm.org>
1493 * NEWS: Delete, it is so stale.
1495 * parser.c (cp_lexer_set_source_position_from_token): EOF has a
1498 2020-05-07 Iain Sandoe <iain@sandoe.co.uk>
1502 * coroutines.cc (morph_fn_to_coro): Set unformed outline
1503 functions to error_mark_node. For early error returns suppress
1504 warnings about missing ramp return values. Fix reinstatement
1505 of the function body on pre-existing initial error.
1506 * decl.c (finish_function): Use the normal error path for fails
1507 in the ramp function, do not try to compile the helpers if the
1510 2020-05-07 Marek Polacek <polacek@redhat.com>
1512 PR c++/94590 - Detect long double -> double narrowing.
1513 * typeck2.c (check_narrowing): Detect long double -> double
1514 narrowing even when double and long double have the same
1515 precision. Make it handle conversions to float too.
1517 2020-05-07 Marek Polacek <polacek@redhat.com>
1520 * parser.c (cp_parser_class_specifier_1): Check that the scope is
1521 nested inside current scope before pushing it.
1523 2020-05-07 Marek Polacek <polacek@redhat.com>
1526 * typeck2.c (check_narrowing): Consider T* to bool narrowing
1529 2020-05-07 Marek Polacek <polacek@redhat.com>
1531 * decl.c (grok_op_properties): Fix spelling of non-static.
1532 * typeck.c (build_class_member_access_expr): Likewise.
1534 2020-05-07 Richard Biener <rguenther@suse.de>
1537 * optimize.c (update_cloned_parm): Copy DECL_NOT_GIMPLE_REG_P.
1539 2020-05-06 Marek Polacek <polacek@redhat.com>
1542 * pt.c (tsubst_copy_and_build): Call type_dependent_expression_p_push
1543 instead of uses_template_parms. Move the warning_sentinels after the
1546 2020-05-06 Jakub Jelinek <jakub@redhat.com>
1549 * typeck.c (cp_strict_aliasing_warning): New function.
1550 (cp_build_indirect_ref_1, build_reinterpret_cast_1): Use
1551 it instead of strict_aliasing_warning.
1554 * method.c (defaulted_late_check): Don't call synthesize_method
1555 on constexpr sfk_comparison if it has been called on it already.
1557 2020-05-06 Nathan Sidwell <nathan@acm.org>
1560 * decl.c (grokdeclarator): Don't splice template attributes in
1561 parm context -- they can apply to the parm.
1563 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
1565 * coroutines.cc: Remove references to n4849 throughout.
1567 2020-05-05 Jason Merrill <jason@redhat.com>
1570 * pt.c (more_specialized_fn): Do consider parms with no deducible
1571 template parameters.
1573 2020-05-05 Jason Merrill <jason@redhat.com>
1576 * constexpr.c (potential_constant_expression_1): In a lambda
1577 function, consider a captured variable directly.
1579 2020-05-05 Iain Sandoe <iain@sandoe.co.uk>
1581 * coroutines.cc (transform_await_wrapper): Check that we have
1582 no unlowered co_yields.
1583 (captures_temporary): Likewise.
1584 (register_awaits): Likewise.
1586 2020-05-05 Nathan Sidwell <nathan@acm.org>
1589 * coroutines.cc (morph_fn_to_coro): Just check for
1591 * pt.c (tsubst_function_decl): Update lambda fn's this_ptr name.
1593 2020-05-05 Marek Polacek <polacek@redhat.com>
1594 Jason Merrill <jason@redhat.com>
1597 * parser.c (cp_parser_postfix_dot_deref_expression): If we have
1598 a type-dependent object of class type, stash it to
1599 parser->context->object_type. If the postfix expression doesn't have
1601 (cp_parser_class_name): Consider object scope too.
1602 (cp_parser_lookup_name): Remove code dealing with the case when
1603 object_type is unknown_type_node.
1605 2020-05-04 Patrick Palka <ppalka@redhat.com>
1608 * cp-gimplify.c (cp_fold) <case CALL_EXPR>: Move some variable
1609 declarations closer to their uses. Copy the CALL_EXPR only
1610 when one of its arguments has changed.
1611 <case TREE_VEC>: Instead of first collecting the folded
1612 arguments into a releasing_vec, just make a copy of the TREE_VEC
1613 as soon as folding changes one of its arguments.
1615 2020-05-04 Iain Sandoe <iain@sandoe.co.uk>
1617 * coroutines.cc (morph_fn_to_coro): Mark the coro.gro variable
1618 as artificial and ignored.
1620 2020-05-04 Nathan Sidwell <nathan@acm.org>
1622 pt.c (process_template_parm): Don't walk the template list twice,
1623 remember the final node instead.
1624 (end_template_parm_list): Refactor. Comment on why we do a pop
1627 PR c++/94827 -- don't save parms in nested requirement
1628 * constraint.cc (tsubst_nested_requirement): TYPE directly holds
1629 notmalized requirement.
1630 (finish_nested_requirement): Don't stash current tpl parms into
1632 (diagnose_nested_requirement): TYPE directly holds notmalized
1635 2020-05-01 Patrick Palka <ppalka@redhat.com>
1638 * cp-tree.h (check_accessibility_of_qualified_id): Add
1639 tsubst_flags_t parameter and change return type to bool.
1640 * parser.c (cp_parser_lookup_name): Pass tf_warning_to_error to
1641 check_accessibility_of_qualified_id.
1642 * pt.c (tsubst_qualified_id): Return error_mark_node if
1643 check_accessibility_of_qualified_id returns false.
1644 * semantics.c (check_accessibility_of_qualified_id): Add
1645 complain parameter. Pass complain instead of
1646 tf_warning_or_error to perform_or_defer_access_check. Return
1647 true unless perform_or_defer_access_check returns false.
1649 2020-05-01 Marek Polacek <polacek@redhat.com>
1652 * typeck2.c (process_init_constructor_record): Return PICFLAG_ERRONEOUS
1653 if an initializer element was erroneous.
1655 2020-05-01 Jason Merrill <jason@redhat.com>
1658 * init.c (get_nsdmi): Don't push_to_top_level for a local class.
1660 2020-05-01 Jason Merrill <jason@redhat.com>
1663 * decl.c (cp_finish_decl): Also clear TREE_READONLY if
1664 -fmerge-all-constants.
1666 2020-05-01 Jason Merrill <jason@redhat.com>
1669 * pt.c (tsubst_decl): Make sure DECL_VALUE_EXPR continues to have
1670 the same type as the variable.
1672 2020-04-30 Jason Merrill <jason@redhat.com>
1673 Nathan Sidwell <nathan@acm.org>
1676 * constraint.cc (map_arguments): If ARGS is null, it's a
1677 self-mapping of parms.
1678 (finish_nested_requirement): Do not pass argified
1679 current_template_parms to normalization.
1680 (tsubst_nested_requirement): Don't assert no template parms.
1682 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
1685 * coroutines.cc (transform_local_var_uses): Defer walking
1686 the DECL_INITIALs of BIND_EXPR vars until all the frame
1687 allocations have been made.
1689 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
1692 * coroutines.cc (register_awaits): Update target
1693 expressions for awaitable and suspend handle
1696 2020-04-30 Iain Sandoe <iain@sandoe.co.uk>
1699 * coroutines.cc (build_co_await): Account for variables
1700 with DECL_VALUE_EXPRs.
1701 (captures_temporary): Likewise.
1702 (register_awaits): Likewise.
1704 2020-04-29 Patrick Palka <ppalka@redhat.com>
1707 * pt.c (find_template_parameter_info::parm_list): New field.
1708 (keep_template_parm): Use the new field to build up the
1709 parameter list here instead of ...
1710 (find_template_parameters): ... here. Return ftpi.parm_list.
1712 2020-04-29 Jakub Jelinek <jakub@redhat.com>
1715 * class.c (build_base_field): Set DECL_FIELD_ABI_IGNORED on C++17 empty
1716 base artificial FIELD_DECLs.
1717 (layout_class_type): Set DECL_FIELD_ABI_IGNORED on empty class
1718 field_poverlapping_p FIELD_DECLs.
1720 2020-04-29 Patrick Palka <ppalka@redhat.com>
1723 * constraint.cc (satisfy_declaration_constraints): Use saved_t
1724 instead of t as the key to decl_satisfied_cache.
1727 * error.c (print_requires_expression_info): Print the dependent
1728 form of the parameter list with its template parameter mapping,
1729 rather than printing the substituted form.
1731 2020-04-28 Jason Merrill <jason@redhat.com>
1734 * decl.c (use_eh_spec_block): Check nothrow type after
1736 * pt.c (maybe_instantiate_noexcept): Call synthesize_method for
1737 DECL_MAYBE_DELETED fns here.
1738 * decl2.c (mark_used): Not here.
1739 * method.c (get_defaulted_eh_spec): Reject DECL_MAYBE_DELETED here.
1741 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
1744 * coroutines.cc (instantiate_coro_traits): Pass a reference to
1745 object type rather than a pointer type for 'this', for method
1747 (struct param_info): Add a field to hold that the parm is a lambda
1749 (morph_fn_to_coro): Check for lambda closure pointers in the
1750 args. Use a reference to *this when building the args list for the
1751 promise allocator lookup.
1753 2020-04-28 Iain Sandoe <iain@sandoe.co.uk>
1756 * coroutines.cc (coro_promise_type_found_p): Do not
1757 exclude non-classes here (this needs to be handled in the
1759 (morph_fn_to_coro): Allow for the case where the coroutine
1762 2020-04-27 Iain Sandoe <iain@sandoe.co.uk>
1765 * coroutines.cc (struct local_var_info): Add fields for static
1766 variables and those with DECL_VALUE_EXPR redirection.
1767 (transform_local_var_uses): Skip past typedefs and static vars
1768 and then account for redirected variables.
1769 (register_local_var_uses): Likewise.
1771 2020-04-27 Jason Merrill <jason@redhat.com>
1775 * decl.c (grokdeclarator): Move dependent attribute to decl.
1776 * decl2.c (splice_template_attributes): No longer static.
1778 2020-04-27 Patrick Palka <ppalka@redhat.com>
1781 * constexpr.c (cxx_eval_call_expression): Don't set new_obj if we're
1782 evaluating the target constructor of a delegating constructor.
1783 (cxx_eval_store_expression): Don't set TREE_READONLY if the LHS of the
1784 INIT_EXPR is '*this'.
1786 2020-04-26 Marek Polacek <polacek@redhat.com>
1789 * call.c (struct conversion): Add copy_init_p.
1790 (standard_conversion): Set copy_init_p in ck_base and ck_rvalue
1791 if FLAGS demands LOOKUP_ONLYCONVERTING.
1792 (convert_like_real) <case ck_base>: If copy_init_p is set, or
1793 LOOKUP_ONLYCONVERTING into FLAGS.
1795 2020-04-26 Iain Sandoe <iain@sandoe.co.uk>
1798 * coroutines.cc (morph_fn_to_coro): Ensure that
1799 unnamed function params have a usable and distinct
1802 2020-04-24 Jason Merrill <jason@redhat.com>
1805 * decl.c (redeclaration_error_message): Reject defaulted comparison
1806 operator that has been previously declared.
1808 2020-04-25 Patrick Palka <ppalka@redhat.com>
1810 * parser.c (cp_parser_diagnose_invalid_type_name): Suggest enabling
1811 concepts if the invalid identifier is 'requires'.
1813 2020-04-25 Jakub Jelinek <jakub@redhat.com>
1816 * semantics.c (finish_call_expr): When looking if all overloads
1817 are noreturn, use STRIP_TEMPLATE to look through TEMPLATE_DECLs.
1819 2020-04-24 Martin Liska <mliska@suse.cz>
1821 * coroutines.cc: Fix compilation error for release checking
1822 where we miss declaration of ‘coro_body_contains_bind_expr_p’.
1824 2020-04-23 Patrick Palka <ppalka@redhat.com>
1826 * tree.c (zero_init_expr_p): Use uses_template_parms instead of
1830 * pt.c (template_class_depth): Walk into the DECL_FRIEND_CONTEXT of a
1831 friend declaration rather than into its CP_DECL_CONTEXT.
1833 2020-04-23 Iain Sandoe <iain@sandoe.co.uk>
1836 * coroutines.cc (await_statement_expander): Simplify cases.
1837 (struct susp_frame_data): Add fields for truth and/or if
1838 cases, rename one field.
1839 (analyze_expression_awaits): New.
1840 (expand_one_truth_if): New.
1841 (add_var_to_bind): New helper.
1842 (coro_build_add_if_not_cond_break): New helper.
1843 (await_statement_walker): Handle conditional expressions,
1844 handle expansion of truth-and/or-if cases.
1845 (bind_expr_find_in_subtree): New, checking-only.
1846 (coro_body_contains_bind_expr_p): New, checking-only.
1847 (morph_fn_to_coro): Ensure that we have a top level bind
1850 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
1852 PR translation/94698
1853 * class.c (check_field_decls): Change "define" to "declare" in
1854 -Weffc++ diagnostics.
1856 2020-04-22 Patrick Palka <ppalka@redhat.com>
1860 * constraint.cc (satisfy_declaration_constraints): If the inherited
1861 constructor points to an instantiation of a constructor template,
1862 remember and use its attached template arguments.
1864 2020-04-22 Jonathan Wakely <jwakely@redhat.com>
1866 PR translation/94698
1867 * class.c (check_field_decls): Change "override" to "define" in
1868 -Weffc++ diagnostics.
1870 2020-04-22 Iain Sandoe <iain@sandoe.co.uk>
1873 * coroutines.cc (struct param_info): Add a field to note that
1874 the param is 'this'.
1875 (morph_fn_to_coro): Convert this to a reference before using it
1876 in the promise parameter preview.
1878 2020-04-22 Jason Merrill <jason@redhat.com>
1881 * pt.c (register_parameter_specializations): If the instantiation is
1882 still a parameter pack, don't wrap it in a NONTYPE_ARGUMENT_PACK.
1883 (tsubst_pack_expansion, tsubst_expr): Adjust.
1885 2020-04-22 Martin Sebor <msebor@redhat.com>
1886 Jason Merrill <jason@redhat.com>
1889 * decl.c (reshape_init_array_1): Avoid stripping redundant trailing
1890 zero initializers...
1891 * mangle.c (write_expression): ...and handle them here even for
1892 pointers to members by calling zero_init_expr_p.
1893 * cp-tree.h (zero_init_expr_p): Declare.
1894 * tree.c (zero_init_expr_p): Define.
1895 (type_initializer_zero_p): Remove.
1896 * pt.c (tparm_obj_values): New hash_map.
1897 (get_template_parm_object): Store to it.
1898 (tparm_object_argument): New.
1900 2020-04-22 Patrick Palka <ppalka@redhat.com>
1903 * constraint.cc (diagnose_valid_expression): Check convert_to_void here
1904 as well as in tsubst_valid_expression_requirement.
1906 2020-04-21 Patrick Palka <ppalka@redhat.com>
1909 * constraint.cc (satisfy_declaration_constraints): Don't strip the
1910 inherited constructor if it already has template information.
1913 * pt.c (any_template_parm_r) <case IDENTIFIER_NODE>: New case. If this
1914 is a conversion operator, visit its TREE_TYPE.
1916 2020-04-21 Nathan Sidwell <nathan@acm.org>
1918 * pt.c (tsubst_copy_and_build) [POINTER_PLUS_EXPR]: Check for
1921 2020-04-21 Iain Sandoe <iain@sandoe.co.uk>
1924 * coroutines.cc (morph_fn_to_coro): Simplify return
1927 2020-04-17 Marek Polacek <polacek@redhat.com>
1930 * constexpr.c (cxx_eval_outermost_constant_expr): Return when T is
1931 a BRACE_ENCLOSED_INITIALIZER_P.
1932 (is_nondependent_constant_expression): Don't check
1933 BRACE_ENCLOSED_INITIALIZER_P.
1934 (is_nondependent_static_init_expression): Likewise.
1936 2020-04-20 Patrick Palka <ppalka@redhat.com>
1939 * cp-tree.h (lss_policy::lss_nop): New enumerator.
1940 * pt.c (local_specialization_stack::local_specialization_stack): Handle
1942 (local_specialization_stack::~local_specialization_stack): Likewise.
1943 (tsubst_pack_expansion): Use a local_specialization_stack instead of
1944 manually saving and restoring local_specializations. Conditionally
1945 replace local_specializations sooner, before the handling of the
1946 unsubstituted_packs case.
1948 2020-04-20 Marek Polacek <polacek@redhat.com>
1950 PR c++/94505 - bogus -Wparentheses warning with fold-expression.
1951 * pt.c (fold_expression): Add warning_sentinel for -Wparentheses
1952 before calling build_x_binary_op.
1954 2020-04-20 Marek Polacek <polacek@redhat.com>
1956 * coroutines.cc (captures_temporary): Don't assign the result of
1957 STRIP_NOPS to the same variable.
1959 2020-04-20 Nathan Sidwell <nathan@acm.org>
1961 PR c++/94454 - tpl-tpl-parms are not canonicalizable types
1962 * pt.c (canonical_type_parameter): Assert not a tpl-tpl-parm.
1963 (process_template_parm): tpl-tpl-parms are structural.
1964 (rewrite_template_parm): Propagate structuralness.
1966 PR c++/94454 - Expr pack expansion equality
1967 * tree.c (cp_tree_equal) [TEMPLATE_ID_EXPR, default]: Refactor.
1968 [EXPR_PACK_EXPANSION]: Add.
1970 PR c++/94454 Template Argument Hashing
1971 * pt.c (iterative_hash_template_arg): Strip nodes as
1972 template_args_equal does.
1973 [ARGUMENT_PACK_SELECT, TREE_VEC, CONSTRUCTOR]: Refactor.
1974 [node_class:TEMPLATE_TEMPLATE_PARM]: Hash by level & index.
1975 [node_class:default]: Refactor.
1977 2020-04-18 Patrick Palka <ppalka@redhat.com>
1980 * tree.c (cp_tree_equal) <case PARM_DECL>: Ignore
1981 comparing_specializations if the parameters' contexts are identical.
1984 * pt.c (splice_late_return_type): Propagate cv-qualifiers and
1985 PLACEHOLDER_TYPE_CONSTRAINTS from the original auto node to the new one.
1987 2020-04-17 Patrick Palka <ppalka@redhat.com>
1990 * lambda.c (lambda_capture_field_type): Avoid doing auto deduction if
1991 the explicit initializer has parameter packs.
1994 * parser.c (cp_parser_check_template_parameters): Before issuing a hard
1995 error, first try simulating an error instead.
1997 2020-04-17 Jakub Jelinek <jakub@redhat.com>
2000 * call.c (build_conditional_expr_1): Remove redundant assignment to
2003 2020-04-16 Patrick Palka <ppalka@redhat.com>
2006 * cvt.c (ocp_convert): If the result of scalar_constant_value is
2007 erroneous, ignore it and use the original expression.
2009 2020-04-16 Jakub Jelinek <jakub@redhat.com>
2012 * parser.c (cp_parser_simple_declaration): Fix up a pasto in
2015 2020-04-15 Jakub Jelinek <jakub@redhat.com>
2018 * parser.c (cp_parser_pragma) <case PRAGMA_OMP_REQUIRES>: Reject
2019 requires directive when not at file or namespace scope.
2021 2020-04-14 Iain Sandoe <iain@sandoe.co.uk>
2024 * coroutines.cc (build_actor_fn): Check that the target can
2025 support the resume tailcall before mandating it.
2027 2020-04-14 Patrick Palka <ppalka@redhat.com>
2030 * cxx-pretty-print.c (cxx_pretty_printer:simple_type_specifier)
2031 <case DECLTYPE_TYPE>: Handle DECLTYPE_TYPE here instead of ...
2032 (pp_cxx_type_specifier_seq) <case DECLTYPE_TYPE>: ... here.
2033 (cxx_pretty_printer::direct_abstract_declarator) <case DECLTYPE_TYPE>:
2037 * constexpr.c (replace_result_decl_data): New struct.
2038 (replace_result_decl_data_r): New function.
2039 (replace_result_decl): New function.
2040 (cxx_eval_call_expression): Use it.
2041 * tree.c (build_aggr_init_expr): Set the location of the AGGR_INIT_EXPR
2042 to that of its initializer.
2044 2020-04-13 Marek Polacek <polacek@redhat.com>
2047 * name-lookup.c (check_local_shadow): Add an inform call.
2049 2020-04-13 Patrick Palka <ppalka@redhat.com>
2052 * error.c (dump_scope): Pass TFF_NO_FUNCTION_ARGUMENTS to
2053 dump_function_decl when printing a function template instantiation as a
2057 * constexpr.c (get_or_insert_ctor_field): Set default value of parameter
2059 (cxx_eval_bare_aggregate): Use get_or_insert_ctor_field instead of
2060 assuming the the next index belongs at the end of the new CONSTRUCTOR.
2061 (cxx_eval_store_expression): Revert PR c++/78572 fix.
2063 2020-04-13 Nathan Sidwell <nathan@acm.org>
2065 PR c++/94426 lambdas with internal linkage are different to no-linkage
2066 * decl2.c (determine_visibility): A lambda's visibility is
2067 affected by its extra scope.
2068 * pt.c (instantiate_decl): Determine var's visibility before
2069 instantiating its initializer.
2070 * tree.c (no_linkage_check): Revert code looking at visibility of
2071 lambda's extra scope.
2073 2020-04-10 Iain Sandoe <iain@sandoe.co.uk>
2076 * coroutines.cc (co_await_expander): Remove.
2077 (expand_one_await_expression): New.
2078 (process_one_statement): New.
2079 (await_statement_expander): New.
2080 (build_actor_fn): Revise to use per-statement expander.
2081 (struct susp_frame_data): Reorder and comment.
2082 (register_awaits): Factor code.
2083 (replace_statement_captures): New, factored from...
2084 (maybe_promote_captured_temps):.. here.
2085 (await_statement_walker): Revise to process per statement.
2086 (morph_fn_to_coro): Use revised susp_frame_data layout.
2088 2020-04-10 Marek Polacek <polacek@redhat.com>
2091 * method.c (constructible_expr): In C++20, try using parenthesized
2092 initialization of aggregates to determine the result of
2095 2020-04-10 Bin Cheng <bin.cheng@linux.alibaba.com>
2097 * coroutines.cc (co_await_expander): Simplify.
2099 2020-04-09 Jason Merrill <jason@redhat.com>
2102 * constexpr.c (cxx_eval_constant_expression) [VAR_DECL]: Look at
2103 ctx->object and ctx->global->values first.
2105 2020-04-09 Marek Polacek <polacek@redhat.com>
2108 * call.c (initialize_reference): If the reference binding failed, maybe
2109 try initializing from { }.
2110 * decl.c (grok_reference_init): For T& t(e), set
2111 LOOKUP_AGGREGATE_PAREN_INIT but don't build up a constructor yet.
2113 2020-04-08 Iain Sandoe <iain@sandoe.co.uk>
2114 Jun Ma <JunMa@linux.alibaba.com>
2116 * coroutines.cc (maybe_promote_captured_temps): Add a cleanup
2117 expression, if needed, to any call from which we promoted
2118 temporaries captured by reference.
2120 2020-04-08 Marek Polacek <polacek@redhat.com>
2122 PR c++/94507 - ICE-on-invalid with lambda template.
2123 * pt.c (tsubst_lambda_expr): Cope when tsubst_template_decl or
2124 tsubst_function_decl returns error_mark_node.
2126 2020-04-08 Martin Liska <mliska@suse.cz>
2129 * decl.c (duplicate_decls): Duplicate also DECL_IS_REPLACEABLE_OPERATOR.
2130 (cxx_init_decl_processing): Mark replaceable all implicitly defined
2133 2020-04-08 Patrick Palka <ppalka@redhat.com>
2135 Core issues 1001 and 1322
2137 * pt.c (rebuild_function_or_method_type): Split function out from ...
2138 (tsubst_function_type): ... here.
2139 (maybe_rebuild_function_decl_type): New function.
2140 (tsubst_function_decl): Use it.
2142 2020-04-08 Jakub Jelinek <jakub@redhat.com>
2145 * decl.c (begin_destructor_body): For CLASSTYPE_VBASECLASSES class
2146 dtors, if CLASSTYPE_PRIMARY_BINFO is non-NULL, but not BINFO_VIRTUAL_P,
2147 look at CLASSTYPE_PRIMARY_BINFO of its BINFO_TYPE if it is not
2148 BINFO_VIRTUAL_P, and so on.
2150 2020-04-08 Marek Polacek <polacek@redhat.com>
2152 PR c++/94478 - ICE with defaulted comparison operator
2153 * method.c (early_check_defaulted_comparison): Give an error when the
2156 2020-04-08 Tobias Burnus <tobias@codesourcery.com>
2159 * paser.c (cp_parser_oacc_declare): Add check that variables
2160 are declared in the same scope as the directive.
2162 2020-04-07 Jason Merrill <jason@redhat.com>
2165 * parser.c (cp_parser_requires_expression): Use tentative_firewall.
2168 * parser.c (cp_parser_placeholder_type_specifier): Use
2171 2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
2173 * coroutines.cc (maybe_promote_captured_temps): Ensure that
2174 reference capture placeholder vars are properly declared.
2176 2020-04-07 Patrick Palka <ppalka@redhat.com>
2179 * tree.c (replace_placeholders): Look through all handled components,
2180 not just COMPONENT_REFs.
2181 * typeck2.c (process_init_constructor_array): Propagate
2182 CONSTRUCTOR_PLACEHOLDER_BOUNDARY up from each element initializer to
2183 the array initializer.
2185 2020-04-07 Jakub Jelinek <jakub@redhat.com>
2188 * parser.c (cp_parser_omp_parallel): Set OMP_PARALLEL_COMBINED
2189 if cp_parser_omp_master succeeded.
2191 2020-04-06 Jason Merrill <jason@redhat.com>
2194 * decl.c (duplicate_decls): Fix handling of DECL_HIDDEN_FRIEND_P.
2196 2020-04-04 Marek Polacek <polacek@redhat.com>
2197 Jason Merrill <jason@redhat.com>
2199 PR c++/94155 - crash in gimplifier with paren init of aggregates.
2200 * init.c (build_vec_init): Fill in indexes.
2202 2020-04-04 Jason Merrill <jason@redhat.com>
2205 * mangle.c (write_expression): Skip IMPLICIT_CONV_EXPR.
2207 2020-04-04 Patrick Palka <ppalka@redhat.com>
2211 * constexpr.c (struct constexpr_ctx): New field 'parent'.
2212 (cxx_eval_bare_aggregate): Propagate CONSTRUCTOR_PLACEHOLDER_BOUNDARY
2213 flag from the original constructor to the reduced constructor.
2214 (lookup_placeholder): Prefer to return the outermost matching object
2215 by recursively calling lookup_placeholder on the 'parent' context,
2216 but don't cross CONSTRUCTOR_PLACEHOLDER_BOUNDARY constructors.
2217 (cxx_eval_constant_expression): Link the 'ctx' context to the 'new_ctx'
2218 context via 'new_ctx.parent' when being expanded without an explicit
2219 target. Don't call replace_placeholders.
2220 (cxx_eval_outermost_constant_expr): Initialize 'ctx.parent' to NULL.
2224 * constexpr.c (get_or_insert_ctor_field): Split out (while adding
2225 support for VECTOR_TYPEs, and optimizations for the common case)
2227 (cxx_eval_store_expression): ... here. Rename local variable
2228 'changed_active_union_member_p' to 'activated_union_member_p'. Record
2229 the sequence of indexes into 'indexes' that yields the subobject we're
2230 assigning to. Record the integer offsets of the constructor indexes
2231 we're assigning through into 'index_pos_hints'. After evaluating the
2232 initializer of the store expression, recompute 'valp' using 'indexes'
2233 and using 'index_pos_hints' as hints.
2234 (cxx_eval_bare_aggregate): Tweak comments. Use get_or_insert_ctor_field
2235 to recompute the constructor_elt pointer we're assigning through after
2236 evaluating each initializer.
2238 2020-04-04 Jason Merrill <jason@redhat.com>
2241 * constraint.cc (tsubst_valid_expression_requirement): Call
2244 2020-04-04 Jason Merrill <jason@redhat.com>
2247 * constexpr.c (maybe_constant_value): Use break_out_target_exprs.
2248 * expr.c (mark_use) [VIEW_CONVERT_EXPR]: Don't wrap a TARGET_EXPR in
2251 2020-04-04 Jakub Jelinek <jakub@redhat.com>
2254 * parser.c (cp_parser_omp_for_loop): Use
2255 protected_set_expr_location_if_unset.
2256 * cp-gimplify.c (genericize_if_stmt, genericize_cp_loop): Likewise.
2259 * pt.c (tsubst_expr) <case OMP_MASTER>: Clear
2260 omp_parallel_combined_clauses.
2262 2020-04-03 Jason Merrill <jason@redhat.com>
2265 * pt.c (complex_pack_expansion_r): New.
2266 (complex_alias_template_p): Use it.
2268 2020-03-31 Jason Merrill <jason@redhat.com>
2271 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Call
2272 replace_placeholders.
2273 * typeck2.c (store_init_value): Fix arguments to
2274 fold_non_dependent_expr.
2276 2020-03-31 Jason Merrill <jason@redhat.com>
2278 * constexpr.c (cxx_eval_constant_expression) [TARGET_EXPR]: Use
2281 2020-03-30 Jason Merrill <jason@redhat.com>
2284 * tree.c (cp_tree_equal) [CALL_EXPR]: Compare KOENIG_LOOKUP_P.
2285 (called_fns_equal): Check DECL_CONTEXT.
2287 2020-03-30 Jakub Jelinek <jakub@redhat.com>
2290 * semantics.c (add_stmt): Only set STMT_IS_FULL_EXPR_P on trees with
2291 STATEMENT_CODE_P code.
2293 2020-03-28 Patrick Palka <ppalka@redhat.com>
2296 * parser.c (cp_parser_requires_clause_opt): Diagnose and recover from
2297 "requires {" when "requires requires {" was probably intended.
2300 * constraint.cc (tsubst_compound_requirement): Always suppress errors
2301 from type_deducible_p and expression_convertible_p, as they're not
2302 substitution errors.
2303 (diagnose_atomic_constraint) <case INTEGER_CST>: Remove this case so
2304 that we diagnose INTEGER_CST expressions of non-bool type via the
2306 * cp-gimplify.c (cp_genericize_r) <case REQUIRES_EXPR>: New case.
2307 * parser.c (cp_parser_requires_expression): Always parse the requirement
2308 body as if we're processing a template, by temporarily incrementing
2309 processing_template_decl. Afterwards, if we're not actually in a
2310 template context, perform semantic processing to diagnose any invalid
2311 types and expressions.
2312 * pt.c (tsubst_copy_and_build) <case REQUIRES_EXPR>: Remove dead code.
2313 * semantics.c (finish_static_assert): Explain an assertion failure
2314 when the condition is a REQUIRES_EXPR like we do when it is a concept
2317 * constraint.cc (diagnose_compound_requirement): When diagnosing a
2318 compound requirement, maybe replay the satisfaction failure, subject to
2319 the current diagnosis depth.
2321 * constraint.cc (finish_constraint_binary_op): Set the location of EXPR
2322 as well as its range, because build_x_binary_op doesn't always do so.
2323 (current_constraint_diagnosis_depth): New.
2324 (concepts_diagnostics_max_depth_exceeded_p): New.
2325 (collect_operands_of_disjunction): New.
2326 (satisfy_disjunction): When diagnosing a satisfaction failure, maybe
2327 replay each branch of the disjunction, subject to the current diagnosis
2329 (diagnose_valid_expression): When diagnosing a satisfaction failure,
2330 maybe replay the substitution error, subject to the current diagnosis
2332 (diagnose_valid_type): Likewise.
2333 (diagnose_nested_requiremnet): Likewise.
2334 (diagnosing_failed_constraint::diagnosing_failed_constraint): Increment
2335 current_constraint_diagnosis_depth when diagnosing.
2336 (diagnosing_failed_constraint::~diagnosing_failed_constraint): Decrement
2337 current_constraint_diagnosis_depth when diagnosing.
2338 (diagnosing_failed_constraint::replay_errors_p): New static member
2340 (diagnose_constraints): Don't diagnose if concepts_diagnostics_max_depth
2341 is 0. Emit a one-off note to increase -fconcepts-diagnostics-depth if
2342 the limit was exceeded.
2343 * cp-tree.h (diagnosing_failed_constraint::replay_errors_p): Declare.
2345 2020-03-27 Nathan Sidwell <nathan@acm.org>
2348 * name-lookup.c (do_pushdecl): Look through cleanp levels.
2350 2020-03-27 Martin Sebor <msebor@redhat.com>
2355 * cp-tree.h (most_specialized_partial_spec): Declare.
2356 * parser.c (cp_parser_elaborated_type_specifier): Distinguish alias
2358 (specialization_of): New function.
2359 (cp_parser_check_class_key): Move code...
2360 (class_decl_loc_t::add): ...to here. Add parameters. Avoid issuing
2361 -Wredundant-tags on first-time declarations in other declarators.
2362 Correct handling of template specializations.
2363 (class_decl_loc_t::diag_mismatched_tags): Also expect to be called
2364 when -Wredundant-tags is enabled. Use primary template or partial
2365 specialization as the guide for uses of implicit instantiations.
2366 * pt.c (most_specialized_partial_spec): Declare extern.
2368 2020-03-27 Nathan Sidwell <nathan@acm.org>
2371 * name-lookup.c (push_namespace): Triage ambiguous lookups that
2374 2020-03-27 Jakub Jelinek <jakub@redhat.com>
2377 * call.c (set_flags_from_callee): Don't update
2378 cp_function_chain->can_throw or current_function_returns_abnormally
2379 if cp_unevaluated_operand.
2382 * cvt.c (ocp_convert): Handle COMPOUND_EXPR by recursion on the second
2383 operand and creating a new COMPOUND_EXPR if anything changed.
2385 2020-03-26 Marek Polacek <polacek@redhat.com>
2387 PR c++/94336 - template keyword accepted before destructor names.
2388 * parser.c (cp_parser_unqualified_id): Give an error when 'template'
2389 is followed by a destructor name.
2391 2020-03-27 Patrick Palka <ppalka@redhat.com>
2393 * decl.c (compute_array_index_type_loc): Remove redundant
2394 type_dependent_expression_p check that is subsumed by
2395 value_dependent_expression_p.
2396 * decl2.c (is_late_template_attribute): Likewise.
2397 * pt.c (uses_template_parms): Likewise.
2398 (dependent_template_arg_p): Likewise.
2400 2020-03-26 Marek Polacek <polacek@redhat.com>
2403 PR c++/94057 - template keyword in a typename-specifier.
2404 * parser.c (check_template_keyword_in_nested_name_spec): New.
2405 (cp_parser_nested_name_specifier_opt): Implement DR1710, optional
2406 'template'. Call check_template_keyword_in_nested_name_spec.
2407 (cp_parser_simple_type_specifier): Assume that a <
2408 following a qualified-id in a typename-specifier begins
2409 a template argument list.
2411 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
2413 * coroutines.cc (coro_init_identifiers): Initialize an identifier
2414 for the cororoutine handle 'address' method name.
2415 (struct coro_aw_data): Add fields to cover the continuations.
2416 (co_await_expander): Determine the kind of await_suspend in use.
2417 If we have the case that returns a continuation handle, then save
2418 this and make the target for 'scope exit without cleanup' be the
2419 continuation resume label.
2420 (expand_co_awaits): Remove.
2421 (struct suspend_point_info): Remove fields that kept the returned
2422 await_suspend handle type.
2423 (transform_await_expr): Remove code tracking continuation handles.
2424 (build_actor_fn): Add the continuation handle as an actor-function
2425 scope var. Build the symmetric transfer continuation point. Call
2426 the tree walk for co_await expansion directly, rather than via a
2427 trivial shim function.
2428 (register_await_info): Remove fields tracking continuation handles.
2429 (get_await_suspend_return_type): Remove.
2430 (register_awaits): Remove code tracking continuation handles.
2431 (morph_fn_to_coro): Remove code tracking continuation handles.
2433 2020-03-26 Iain Sandoe <iain@sandoe.co.uk>
2435 * coroutines.cc (co_await_expander): If we are expanding the
2436 initial await expression, set a boolean flag to show that we
2437 have now reached the initial await_resume() method call.
2438 (expand_co_awaits): Handle the 'initial await resume called' flag.
2439 (build_actor_fn): Insert the initial await expression into the
2440 start of the user-authored function-body. Handle the 'initial await
2441 resume called' flag.
2442 (morph_fn_to_coro): Initialise the 'initial await resume called'
2443 flag. Modify the unhandled exception catch clause to recognise
2444 exceptions that occur before the initial await_resume() and re-
2447 2020-03-26 Jakub Jelinek <jakub@redhat.com>
2450 * class.c (user_provided_p): Use STRIP_TEMPLATE instead of returning
2451 true for all TEMPLATE_DECLs.
2454 * cp-gimplify.c (cp_genericize_r): Handle STATEMENT_LIST.
2456 2020-03-25 Patrick Palka <ppalka@redhat.com>
2459 * parser.c (cp_parser_selection_statement) <case RID_IF>: Invalidate the
2460 current condition chain when the if-statement has a non-empty
2463 2020-03-25 Iain Sandoe <iain@sandoe.co.uk>
2466 * coroutines.cc (captures_temporary): Fix a missing dereference.
2468 2020-03-24 Marek Polacek <polacek@redhat.com>
2470 PR c++/94190 - wrong no post-decrement operator error in template.
2471 * call.c (convert_like_real): Use convert_from_reference on the result.
2473 2020-03-24 Jason Merrill <jason@redhat.com>
2476 * constraint.cc (constraint_satisfaction_value): Repeat noisily on
2478 (tsubst_nested_requirement): Likewise.
2479 (get_constraint_error_location): Allow missing context.
2480 (diagnose_atomic_constraint): Diagnose non-bool constraint here.
2481 (satisfy_atom): Not here. Only diagnose non-constant when noisy.
2483 2020-03-24 Jason Merrill <jason@redhat.com>
2485 * pt.c (any_template_parm_r): Look into the type of a non-type
2488 2020-03-24 Jason Merrill <jason@redhat.com>
2490 * cp-tree.h (cp_expr): When constructing from an expr and a
2491 location, call protected_set_expr_location.
2493 2020-03-23 Patrick Palka <ppalka@redhat.com>
2496 * except.c (maybe_noexcept_warning): Add TODO.
2497 * method.c (walk_field_subobs): Pass tf_none to expr_noexcept_p.
2499 2020-03-23 nathans <nathan@acm.org>
2502 * tree.c (cp_tree_equal) [SIZEOF_EXPR]: Detect argument pack
2505 2020-03-21 Patrick Palka <ppalka@redhat.com>
2508 * constexpr.c (reduced_constant_expression_p) [CONSTRUCTOR]: Properly
2509 handle unions without an initializer.
2510 (cxx_eval_component_reference): Emit a different diagnostic when the
2511 constructor element corresponding to a union member is NULL.
2512 (cxx_eval_bare_aggregate): When constructing a union, always set the
2513 active union member before evaluating the initializer. Relax assertion
2514 that verifies the index of the constructor element we're initializing
2515 hasn't been changed.
2516 (cxx_eval_store_expression): Diagnose changing the active union member
2517 while the union is in the process of being initialized. After setting
2518 an active union member, clear CONSTRUCTOR_NO_CLEARING on the underlying
2520 (cxx_eval_constant_expression) [PLACEHOLDER_EXPR]: Don't re-reduce a
2521 CONSTRUCTOR returned by lookup_placeholder.
2523 2020-03-20 Patrick Palka <ppalka@redhat.com>
2525 * cxx-pretty-print.c (pp_cxx_parameter_mapping): Make extern. Move
2526 the "[with ]" bits to here from ...
2527 (pp_cxx_atomic_constraint): ... here.
2528 * cxx-pretty-print.h (pp_cxx_parameter_mapping): Declare.
2529 * error.c (rebuild_concept_check): Delete.
2530 (print_concept_check_info): Print the dependent form of the constraint and the
2531 preferably substituted parameter mapping alongside it.
2533 2020-03-19 Jason Merrill <jason@redhat.com>
2536 * cp-gimplify.c (simple_empty_class_p): Look through
2537 SIMPLE_TARGET_EXPR_P.
2538 (cp_gimplify_expr) [MODIFY_EXPR]: Likewise.
2539 [RETURN_EXPR]: Avoid producing 'return *retval;'.
2540 * call.c (build_call_a): Strip TARGET_EXPR from empty class arg.
2541 * cp-tree.h (SIMPLE_TARGET_EXPR_P): Check that TARGET_EXPR_INITIAL
2544 2020-03-19 Jakub Jelinek <jakub@redhat.com>
2547 * parser.c (cp_parser_omp_var_list_no_open): Call process_outer_var_ref
2548 on outer_automatic_var_p decls.
2549 * cp-gimplify.c (cxx_omp_disregard_value_expr): Return true also for
2550 capture proxy decls.
2552 2020-03-18 Nathan Sidwell <nathan@acm.org>
2554 PR c++/94147 - mangling of lambdas assigned to globals
2555 * parser.c (cp_parser_init_declarator): Namespace-scope variables
2556 provide a lambda scope.
2557 * tree.c (no_linkage_check): Lambdas with a variable for extra
2558 scope have a linkage from the variable.
2560 2020-03-18 Jakub Jelinek <jakub@redhat.com>
2562 * constraint.cc (resolve_function_concept_check, subsumes_constraints,
2563 strictly_subsumes): Fix up duplicated word issue in a comment.
2564 * coroutines.cc (build_init_or_final_await, captures_temporary):
2566 * logic.cc (dnf_size_r, cnf_size_r): Likewise.
2567 * pt.c (append_type_to_template_for_access_check): Likewise.
2570 * decl.c (grokfndecl): Restore old diagnostics about deduction
2571 guide declared in different scope if in_namespace is NULL_TREE.
2573 2020-03-17 Jakub Jelinek <jakub@redhat.com>
2576 * parser.c (cp_parser_enum_specifier): Use temp_override for
2577 parser->colon_corrects_to_scope_p, replace goto out with return.
2578 If scoped enum or enum with underlying type is not followed by
2579 { or ;, call cp_parser_commit_to_tentative_parse before calling
2580 cp_parser_error and make sure to return error_mark_node instead of
2581 NULL_TREE. Formatting fixes.
2583 2020-03-17 Ville Voutilainen <ville.voutilainen@gmail.com>
2586 * method.c (assignable_expr): Use cp_unevaluated.
2587 (is_xible_helper): Push a non-deferred access check for
2588 the stub objects created by assignable_expr and constructible_expr.
2590 2020-03-17 Jakub Jelinek <jakub@redhat.com>
2592 * pt.c (tsubst): Fix up duplicated word issue in a diagnostic message.
2593 (lookup_template_class_1, tsubst_expr): Fix up duplicated word issue
2595 * parser.c (cp_parser_statement, cp_parser_linkage_specification,
2596 cp_parser_placeholder_type_specifier,
2597 cp_parser_constraint_requires_parens): Likewise.
2598 * name-lookup.c (suggest_alternative_in_explicit_scope): Likewise.
2600 2020-03-15 Iain Sandoe <iain@sandoe.co.uk>
2602 * coroutines.cc (co_await_expander): Fix indentation.
2604 2020-03-14 Jason Merrill <jason@redhat.com>
2607 * pt.c (process_partial_specialization): Error rather than crash on
2608 extra pack expansion.
2610 2020-03-14 Jason Merrill <jason@redhat.com>
2613 * pt.c (find_parameter_packs_r): [DECL_EXPR]: Walk
2614 DECL_ORIGINAL_TYPE of a typedef.
2616 2020-03-14 Jason Merrill <jason@redhat.com>
2619 * pt.c (build_deduction_guide): Clear cp_unevaluated_operand for
2620 substituting DECL_ARGUMENTS.
2622 2020-03-14 Jakub Jelinek <jakub@redhat.com>
2624 * logic.cc (formula::formula): Change "a an" to "an" in a comment.
2625 * parser.c (cp_debug_parser): Change "a an" to "an" in a string
2628 2020-03-13 Patrick Palka <ppalka@redhat.com>
2631 * call.c (build_over_call): Use a warning_sentinel to disable
2632 warn_deprecated_decl before calling build_addr_func.
2634 2020-03-12 Jakub Jelinek <jakub@redhat.com>
2637 * decl.c (reshape_init_array_1): Don't unshare constructor if there
2638 aren't any trailing zero elts, otherwise only unshare the first
2641 2020-03-11 Jason Merrill <jason@redhat.com>
2644 * constraint.cc (tsubst_parameter_mapping): Canonicalize type
2647 2020-03-11 Marek Polacek <polacek@redhat.com>
2648 Jason Merrill <jason@redhat.com>
2650 PR c++/94074 - wrong modifying const object error for COMPONENT_REF.
2651 * constexpr.c (cref_has_const_field): New function.
2652 (modifying_const_object_p): Consider a COMPONENT_REF
2653 const only if any of its fields are const.
2654 (cxx_eval_store_expression): Mark a CONSTRUCTOR of a const type
2655 as readonly after its initialization has been done.
2657 2020-03-10 Marek Polacek <polacek@redhat.com>
2659 PR c++/94124 - wrong conversion error with non-viable overload.
2660 * decl.c (reshape_init_array_1): Unshare a constructor if we
2661 stripped trailing zero-initializers.
2663 2020-03-10 Jason Merrill <jason@redhat.com>
2666 * pt.c (maybe_instantiate_noexcept): Always update clones.
2668 2020-03-10 Jason Merrill <jason@redhat.com>
2671 * pt.c (maybe_aggr_guide): Check BRACE_ENCLOSED_INITIALIZER_P.
2673 2020-03-10 Jason Merrill <jason@redhat.com>
2679 * cp-gimplify.c (cp_gimplify_init_expr): Partially revert patch for
2680 66139: Don't split_nonconstant_init. Remove pre_p parameter.
2682 2020-03-09 Marek Polacek <polacek@redhat.com>
2684 PR c++/92031 - bogus taking address of rvalue error.
2685 PR c++/91465 - ICE with template codes in check_narrowing.
2686 PR c++/93870 - wrong error when converting template non-type arg.
2687 PR c++/94068 - ICE with template codes in check_narrowing.
2688 * call.c (convert_like_real): Return IMPLICIT_CONV_EXPR
2689 in a template when not ck_identity and we're dealing with a class.
2690 (convert_like_real) <case ck_ref_bind>: Return IMPLICIT_CONV_EXPR
2691 in a template if we need a temporary.
2692 * decl.c (compute_array_index_type_loc): Remove
2693 instantiate_non_dependent_expr_sfinae call. Call
2694 fold_non_dependent_expr instead of maybe_constant_value.
2695 (build_explicit_specifier): Don't instantiate or create a sentinel
2696 before converting the expression.
2697 * except.c (build_noexcept_spec): Likewise.
2698 * pt.c (convert_nontype_argument): Don't build IMPLICIT_CONV_EXPR.
2699 Set IMPLICIT_CONV_EXPR_NONTYPE_ARG if that's what
2700 build_converted_constant_expr returned.
2701 * typeck2.c (check_narrowing): Call fold_non_dependent_expr instead
2702 of maybe_constant_value.
2704 2020-03-09 Jakub Jelinek <jakub@redhat.com>
2708 2019-10-11 Paolo Carlini <paolo.carlini@oracle.com>
2710 * constexpr.c (cxx_eval_constant_expression): Do not handle
2711 RROTATE_EXPR and LROTATE_EXPR.
2713 2020-03-09 Marek Polacek <polacek@redhat.com>
2715 PR c++/94050 - ABI issue with alignas on armv7hl.
2716 * class.c (layout_class_type): Don't replace a class's
2717 CLASSTYPE_AS_BASE if their TYPE_USER_ALIGN don't match.
2719 2020-03-09 Bin Cheng <bin.cheng@linux.alibaba.com>
2721 * coroutines.cc (build_actor_fn): Factor out code inserting the
2722 default return_void call to...
2723 (morph_fn_to_coro): ...here, also hoist local var declarations.
2725 2020-03-08 Patrick Palka <ppalka@redhat.com>
2728 * call.c (convert_like_real): Check complain before emitting an error
2729 about binding a bit-field to a reference.
2731 * cxx-pretty-print.c (cxx_pretty_printer::simple_type_specifier)
2732 [TYPENAME_TYPE]: Print the TYPENAME_TYPE_FULLNAME instead of the
2735 2020-03-06 Nathan Sidwell <nathan@acm.org>
2738 * mangle.c (find_substitution): Don't call same_type_p on template
2739 args that cannot match.
2741 2020-03-04 Martin Sebor <msebor@redhat.com>
2744 * tree.c (type_initializer_zero_p): Fail for structs initialized
2747 2020-03-04 Jason Merrill <jason@redhat.com>
2750 * init.c (perform_member_init): Don't do aggregate initialization of
2752 * constexpr.c (cx_check_missing_mem_inits): Don't enforce
2753 initialization of empty field.
2755 2020-03-04 Martin Liska <mliska@suse.cz>
2757 * method.c: Wrap array in ctor with braces in order
2758 to silent clang warnings.
2760 2020-03-03 Jason Merrill <jason@redhat.com>
2761 Marek Polacek <polacek@redhat.com>
2763 PR c++/90505 - mismatch in template argument deduction.
2764 * pt.c (tsubst): Don't reduce the template level of template
2765 parameters when tf_partial.
2767 2020-03-03 Jakub Jelinek <jakub@redhat.com>
2770 * constexpr.c (cxx_eval_constant_expression)
2771 <case TARGET_EXPR, case SAVE_EXPR>: Don't record anything if
2772 *non_constant_p is true.
2774 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
2776 * coroutines.cc (captures_temporary): Strip component_ref
2779 2020-03-03 Jun Ma <JunMa@linux.alibaba.com>
2781 * coroutines.cc (finish_co_await_expr): Build co_await_expr
2782 with unknown_type_node.
2783 (finish_co_yield_expr): Ditto.
2784 *pt.c (type_dependent_expression_p): Set co_await/yield_expr
2785 with unknown type as dependent.
2787 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
2789 * coroutines.cc (struct local_var_info): Adjust to remove the
2790 reference to the captured var, and just to note that this is a
2791 lambda capture proxy.
2792 (transform_local_var_uses): Handle lambda captures specially.
2793 (struct param_frame_data): Add a visited set.
2794 (register_param_uses): Also check for param uses in lambda
2796 (struct local_vars_frame_data): Remove captures list.
2797 (register_local_var_uses): Handle lambda capture proxies by
2798 noting and bypassing them.
2799 (morph_fn_to_coro): Update to remove lifetime extension of
2800 lambda capture-by-copy vars.
2802 2020-03-02 Iain Sandoe <iain@sandoe.co.uk>
2804 * coroutines.cc (build_co_await): Do not build frame
2805 awaitable proxy vars when the co_await expression is
2806 a function parameter or local var.
2807 (co_await_expander): Do not initialise a frame var with
2809 (transform_await_expr): Only substitute the awaitable
2810 frame var if it's needed.
2811 (register_awaits): Do not make frame copies for param
2812 or local vars that are awaitables.
2814 2020-02-28 Jason Merrill <jason@redhat.com>
2816 Implement P2092R0, Disambiguating Nested-Requirements
2817 * parser.c (cp_parser_requirement_parameter_list): Pass
2818 CP_PARSER_FLAGS_TYPENAME_OPTIONAL.
2820 * call.c (build_user_type_conversion_1): Don't look at the second
2821 conversion of a non-viable candidate.
2823 2020-02-28 Jakub Jelinek <jakub@redhat.com>
2825 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
2826 * typeck.c (cp_build_addr_expr_1): Allow taking address of immediate
2827 functions in unevaluated contexts.
2829 2020-02-27 Nathan Sidwell <nathan@acm.org>
2832 * pt.c (template_args_equal): Pass ARGUMENT_PACKS through to
2834 * tree.c (cp_tree_equal): Compare ARGUMENT_PACKS here,
2835 * typeck.c (comptypes): Assert we don't get any argument packs.
2837 * class.c (adjust_clone_args): Correct arg-checking assert.
2838 * typeck.c (comptypes): Assert not nulls.
2840 2020-02-26 Marek Polacek <polacek@redhat.com>
2842 PR c++/93789 - ICE with invalid array bounds.
2843 * decl.c (compute_array_index_type_loc): Don't use the folded
2844 size when folding cleared TREE_CONSTANT.
2846 2020-02-26 Iain Sandoe <iain@sandoe.co.uk>
2848 * class.c (classtype_has_non_deleted_copy_ctor): New.
2849 * coroutines.cc (struct param_info): Keep track of params
2850 that are references, and cache the original type and whether
2851 the DTOR is trivial.
2852 (build_actor_fn): Handle param copies always, and adjust the
2853 handling for references.
2854 (register_param_uses): Only handle uses here.
2855 (classtype_has_non_deleted_copy_ctor): New.
2856 (morph_fn_to_coro): Adjust param copy handling to match n4849
2857 by reordering ahead of the promise CTOR and always making a
2858 frame copy, even if the param is unused in the coroutine body.
2859 * cp-tree.h (classtype_has_non_deleted_copy_ctor): New.
2861 2020-02-26 Patrick Palka <ppalka@redhat.com>
2863 * constraint.cc (finish_constraint_binary_op): Set expr's location range
2864 to the range of its operands.
2865 (satisfy_atom): Pass MAP instead of ARGS to diagnose_atomic_constraint.
2866 (diagnose_trait_expr): Take the instantiated parameter mapping MAP
2867 instead of the corresponding template arguments ARGS and adjust body
2869 (diagnose_requires_expr): Likewise.
2870 (diagnose_atomic_constraint): Likewise. When printing an atomic
2871 constraint expression, print the instantiated parameter mapping
2873 * cxx-pretty-print.cc (cxx_pretty_printer::expression)
2874 [NONTYPE_ARGUMENT_PACK]: Print braces around a NONTYPE_ARGUMENT_PACK.
2875 (cxx_pretty_printer::type_id): Handle TYPE_ARGUMENT_PACK.
2877 2020-02-26 Marek Polacek <polacek@redhat.com>
2879 PR c++/93676 - value-init crash in template.
2880 * init.c (build_new_1): Don't call build_vec_init in a template.
2882 2020-02-26 Marek Polacek <polacek@redhat.com>
2884 PR c++/93862 - ICE with static_cast when converting from int[].
2885 * call.c (reference_compatible_p): No longer static.
2886 * cp-tree.h (reference_compatible_p): Declare.
2887 * typeck.c (build_static_cast_1): Use reference_compatible_p instead
2888 of reference_related_p.
2890 2020-02-26 Marek Polacek <polacek@redhat.com>
2892 PR c++/93803 - ICE with constexpr init and [[no_unique_address]].
2893 * constexpr.c (reduced_constant_expression_p): Don't crash on a null
2896 2020-02-24 Martin Sebor <msebor@redhat.com>
2899 * parser.c (cp_parser_check_class_key): Avoid issuing -Wredundant-tags
2900 in shared C/C++ code in headers.
2901 Remove a duplicate hunk of code.
2903 2020-02-24 Marek Polacek <polacek@redhat.com>
2905 PR c++/93869 - ICE with -Wmismatched-tags.
2906 * parser.c (cp_parser_check_class_key): Check class_key earlier.
2908 2020-02-24 Marek Polacek <polacek@redhat.com>
2910 PR c++/93712 - ICE with ill-formed array list-initialization.
2911 * call.c (next_conversion): Return NULL for ck_aggr.
2912 (build_aggr_conv): Set u.expr instead of u.next.
2913 (build_array_conv): Likewise.
2914 (build_complex_conv): Likewise.
2915 (conv_get_original_expr): Handle ck_aggr.
2917 2020-02-24 Jakub Jelinek <jakub@redhat.com>
2919 P1937R2 - Fixing inconsistencies between const{expr,eval} functions
2920 * call.c (build_over_call): Don't evaluate immediate functions in
2921 unevaluated operands.
2923 2020-02-24 Jason Merrill <jason@redhat.com>
2925 P0780R2: Resolve lambda init-capture pack grammar.
2926 * parser.c (cp_parser_lambda_introducer): Expect &...x=y rather than
2929 2020-02-22 Marek Polacek <polacek@redhat.com>
2932 * decl.c (grokdeclarator): Use %qs in a diagnostic message.
2934 2020-02-21 Martin Sebor <msebor@redhat.com>
2936 PR gcov-profile/93753
2937 * class.c (check_flexarrays): Tighten up a test for potential members
2938 of anonymous structs or unions.
2940 2020-02-20 Martin Sebor <msebor@redhat.com>
2943 * parser.c (cp_parser_check_class_key): Only handle true C++ class-keys.
2945 2020-02-20 Martin Liska <mliska@suse.cz>
2947 PR translation/93841
2948 * config/or1k/or1k.opt: Remove superfluous word.
2949 * doc/invoke.texi: Likewise.
2951 2020-02-20 Martin Liska <mliska@suse.cz>
2953 PR translation/93838
2954 * parser.c (cp_parser_decl_specifier_seq): Remove trailing space.
2956 2020-02-19 Marek Polacek <polacek@redhat.com>
2958 PR c++/93169 - wrong-code with a non-constexpr constructor.
2959 * constexpr.c (cxx_eval_call_expression): Only set TREE_READONLY
2960 on constant CONSTRUCTORs.
2962 2020-02-15 Marek Polacek <polacek@redhat.com>
2964 PR c++/93710 - poor diagnostic for array initializer.
2965 * call.c (build_user_type_conversion_1): Use cp_expr_loc_or_input_loc
2968 2020-02-15 Jason Merrill <jason@redhat.com>
2971 * pt.c (any_template_parm_r): Look into lambda body.
2974 * pt.c (any_template_parm_r): Remove CONSTRUCTOR handling.
2976 2020-02-14 Jakub Jelinek <jakub@redhat.com>
2979 * class.c (enum_min_precision): Change prec type from int to int &.
2982 * cp-tree.h (enum cp_tree_index): Add CPTI_FALLBACK_DFLOAT32_TYPE,
2983 CPTI_FALLBACK_DFLOAT64_TYPE and CPTI_FALLBACK_DFLOAT128_TYPE.
2984 (fallback_dfloat32_type, fallback_dfloat64_type,
2985 fallback_dfloat128_type): Define.
2986 * mangle.c (write_builtin_type): Handle fallback_dfloat*_type like
2988 * rtti.c (emit_support_tinfos): Emit DFP typeinfos even when dfp
2989 is disabled for compatibility.
2991 2020-02-13 Jason Merrill <jason@redhat.com>
2994 * name-lookup.c (matching_fn_p): A function does not match a
2999 * tree.c (decl_linkage): Always lk_none for locals.
3001 2020-02-12 Jason Merrill <jason@redhat.com>
3005 * tree.c (cp_walk_subtrees): Walk CONSTRUCTOR types here.
3006 * pt.c (find_parameter_packs_r): Not here.
3008 2020-02-12 Iain Sandoe <iain@sandoe.co.uk>
3010 * coroutines.cc (build_actor_fn): Implement deallocation function
3011 selection per n4849, dcl.fct.def.coroutine bullet 12.
3012 (morph_fn_to_coro): Implement allocation function selection per
3013 n4849, dcl.fct.def.coroutine bullets 9 and 10.
3015 2020-02-12 Marek Polacek <polacek@redhat.com>
3017 PR c++/93684 - ICE-on-invalid with broken attribute.
3018 * parser.c (cp_parser_std_attribute): Peek a token first before
3021 2020-02-11 Jason Merrill <jason@redhat.com>
3024 * class.c (add_implicitly_declared_members): Use do_friend.
3025 * method.c (implicitly_declare_fn): Fix friend handling.
3026 (decl_remember_implicit_trigger_p): New.
3027 (synthesize_method): Use it.
3028 * decl2.c (mark_used): Use it.
3030 2020-02-11 Jason Merrill <jason@redhat.com>
3034 * constexpr.c (maybe_constant_value): Correct earlier change.
3035 (cxx_eval_binary_expression) [SPACESHIP_EXPR]: Pass lval through.
3036 * method.c (genericize_spaceship): Wrap result in TARGET_EXPR.
3038 2020-02-12 Patrick Palka <ppalka@redhat.com>
3042 * type-utils.h (find_type_usage): Refactor to take a tree * and to
3043 return a tree *, and update documentation accordingly.
3044 * pt.c (make_auto_1): Set AUTO_IS_DECLTYPE when building a
3045 decltype(auto) node.
3046 (make_constrained_decltype_auto): No need to explicitly set
3047 AUTO_IS_DECLTYPE anymore.
3048 (splice_late_return_type): Use find_type_usage to find and
3049 replace a possibly nested auto node instead of using is_auto.
3050 Check test for is_auto into an assert when deciding whether
3051 to late_return_type.
3052 (type_uses_auto): Adjust the call to find_type_usage.
3053 * parser.c (cp_parser_decltype): No need to explicitly set
3054 AUTO_IS_DECLTYPE anymore.
3056 * error.c (dump_decl) [CONCEPT_DECL]: Use dump_simple_decl.
3057 (dump_simple_decl): Handle standard concept definitions as well as
3058 variable concept definitions.
3060 2020-02-10 Jakub Jelinek <jakub@redhat.com>
3063 * error.c (dump_decl_name): Fix up last argument to strncmp.
3065 2020-02-10 Jason Merrill <jason@redhat.com>
3068 * tree.c (array_of_unknown_bound_p): New.
3069 * init.c (perform_member_init): Do nothing for flexible arrays.
3071 2020-02-09 Jakub Jelinek <jakub@redhat.com>
3074 * constexpr.c (cxx_eval_constant_expression): If obj is heap var with
3075 ARRAY_TYPE, use the element type. Punt if objtype after that is not
3078 2020-02-08 Jason Merrill <jason@redhat.com>
3081 * expr.c (fold_for_warn): Call maybe_constant_value.
3082 * constexpr.c (struct constexpr_ctx): Add uid_sensitive bit-field.
3083 (maybe_constant_value): Add uid_sensitive parm.
3084 (get_fundef_copy): Don't copy if it's true.
3085 (cxx_eval_call_expression): Don't instantiate if it's true.
3086 (cxx_eval_outermost_constant_expr): Likewise.
3089 * constexpr.c (maybe_constant_value): Don't unshare if the cached
3090 value is the same as the argument.
3092 * typeck.c (maybe_warn_about_returning_address_of_local): Add
3095 * typeck2.c (process_init_constructor): Also clear TREE_SIDE_EFFECTS
3098 2020-02-08 Jakub Jelinek <jakub@redhat.com>
3101 * constexpr.c (find_array_ctor_elt): If last element has no index,
3102 for flag_checking verify all elts have no index. If i is within the
3103 elts, return it directly, if it is right after the last elt, append
3104 if NULL index, otherwise force indexes on all elts.
3105 (cxx_eval_store_expression): Allow cep->index to be NULL.
3107 2020-02-07 Marek Polacek <polacek@redhat.com>
3109 PR c++/92947 - Paren init of aggregates in unevaluated context.
3110 * call.c (build_new_method_call_1): Don't check
3111 cp_unevaluated_operand. Check the return value of digest_init.
3113 2020-02-06 Jason Merrill <jason@redhat.com>
3116 * tree.c (cp_walk_subtrees): Walk into type template arguments.
3117 * cp-tree.h (TYPE_TEMPLATE_INFO_MAYBE_ALIAS): Use typedef_variant_p
3118 instead of TYPE_ALIAS_P.
3119 * pt.c (push_template_decl_real): Likewise.
3120 (find_parameter_packs_r): Likewise. Remove dead code.
3121 * error.c (find_typenames_r): Remove dead code.
3123 2020-02-06 Jason Merrill <jason@redhat.com>
3126 * parser.c (cp_parser_constraint_primary_expression): Do the main
3127 parse non-tentatively.
3129 2020-02-06 Marek Polacek <polacek@redhat.com>
3131 PR c++/93597 - ICE with lambda in operator function.
3132 * name-lookup.c (maybe_save_operator_binding): Check is_overloaded_fn.
3134 2020-02-05 Jason Merrill <jason@redhat.com>
3137 * pt.c (tsubst_decl) [PARM_DECL]: Check cp_unevaluated_operand in
3138 handling of TREE_CHAIN for empty pack.
3140 2020-02-05 Jakub Jelinek <jakub@redhat.com>
3143 * semantics.c (cp_build_vec_convert): Call decay_conversion on arg
3144 prior to passing it to c_build_vec_convert.
3146 2020-02-05 Marek Polacek <polacek@redhat.com>
3148 PR c++/93559 - ICE with CONSTRUCTOR flags verification.
3149 * decl.c (reshape_init_array_1): Don't reuse a CONSTRUCTOR with
3152 2020-02-05 Jason Merrill <jason@redhat.com>
3155 * decl.c (grokdeclarator): Reject field of current class type even
3158 2020-02-05 Bin Cheng <bin.cheng@linux.alibaba.com>
3160 * coroutines.cc (maybe_promote_captured_temps): Increase the index
3161 number for temporary variables' name.
3163 2020-02-05 Jun Ma <JunMa@linux.alibaba.com>
3165 * coroutines.cc (build_co_await): Call convert_from_reference
3166 to wrap co_await_expr with indirect_ref which avoid
3167 reference/non-reference type confusion.
3169 (co_await_expander): Sink to call_expr if await_resume
3170 is wrapped by indirect_ref.
3172 2020-02-04 Jason Merrill <jason@redhat.com>
3175 * constraint.cc (satisfy_declaration_constraints): Check return
3176 value of push_tinst_level.
3179 * constexpr.c (cxx_eval_array_reference): {}-initialize missing
3180 elements instead of value-initializing them.
3183 * init.c (perform_member_init): Simplify.
3184 * constexpr.c (cx_check_missing_mem_inits): Allow uninitialized
3186 (cxx_eval_vec_init_1): Handle CONSTRUCTOR.
3188 2020-02-04 Iain Sandoe <iain@sandoe.co.uk>
3190 * coroutines.cc (find_promise_type): Delete unused forward
3192 (struct coroutine_info): Add a bool for no promise type error.
3193 (coro_promise_type_found_p): Only emit the error for a missing
3194 promise once in each affected coroutine.
3196 2020-02-03 Jason Merrill <jason@redhat.com>
3199 * constexpr.c (cxx_eval_constant_expression) [PARM_DECL]: Don't
3200 defer loading the value of a reference.
3202 2020-02-03 Jason Merrill <jason@redhat.com>
3205 * constexpr.c (potential_constant_expression_1) [PARM_DECL]: Allow
3207 [COMPONENT_REF]: A member function reference doesn't use the object
3210 2020-02-03 Iain Sandoe <iain@sandoe.co.uk>
3213 * coroutines.cc (struct coroutine_info): Add a bool flag to note
3214 that we emitted an error for a bad function return type.
3215 (get_coroutine_info): Tolerate an unset info table in case of
3217 (find_coro_traits_template_decl): In case of error or if we didn't
3218 find a type template, note we emitted the error and suppress
3220 (find_coro_handle_template_decl): Likewise.
3221 (instantiate_coro_traits): Only check for error_mark_node in the
3222 return from lookup_qualified_name.
3223 (coro_promise_type_found_p): Reorder initialization so that we check
3224 for the traits and their usability before allocation of the info
3225 table. Check for a suitable return type and emit a diagnostic for
3226 here instead of relying on the lookup machinery. This allows the
3227 error to have a better location, and means we can suppress multiple
3229 (coro_function_valid_p): Re-check for a valid promise (and thus the
3230 traits) before proceeding. Tolerate missing info as a fatal error.
3232 2020-02-03 Jason Merrill <jason@redhat.com>
3235 * cp-gimplify.c (predeclare_vla): New.
3236 (cp_genericize_r) [NOP_EXPR]: Call it.
3238 2020-02-03 Jun Ma <JunMa@linux.alibaba.com>
3240 * coroutines.cc (transform_await_wrapper): Set actor funcion as
3241 new context of label_decl.
3242 (build_actor_fn): Fill new field of await_xform_data.
3244 2020-02-02 Marek Polacek <polacek@redhat.com>
3246 PR c++/93530 - ICE on invalid alignas in a template.
3247 * decl.c (grokdeclarator): Call cplus_decl_attributes instead of
3250 2020-01-31 Jason Merrill <jason@redhat.com>
3253 * semantics.c (process_outer_var_ref): Capture VLAs even in
3254 unevaluated context.
3257 * decl.c (reshape_init_array_1): Reuse a single CONSTRUCTOR with
3258 non-aggregate elements.
3259 (reshape_init_array): Add first_initializer_p parm.
3260 (reshape_init_r): Change first_initializer_p from bool to tree.
3261 (reshape_init): Pass init to it.
3264 * parser.c (cp_parser_initializer_list): Suppress location wrappers
3267 2020-01-29 Jason Merrill <jason@redhat.com>
3270 * pt.c (tsubst_copy_and_build) [EQ_EXPR]: Only suppress warnings if
3271 the expression was dependent before substitution.
3273 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
3275 * coroutines.cc (act_des_fn): New.
3276 (morph_fn_to_coro): Call act_des_fn to build actor/destroy decls.
3277 Access promise via actor function's frame pointer argument.
3278 (build_actor_fn, build_destroy_fn): Use frame pointer argument.
3280 2020-01-30 Bin Cheng <bin.cheng@linux.alibaba.com>
3282 * coroutines.cc (co_await_expander): Handle type conversion case.
3284 2020-01-29 Jason Merrill <jason@redhat.com>
3289 * parser.c (cp_parser_type_specifier_seq): Don't parse attributes in
3290 a trailing return type.
3291 (cp_parser_lambda_declarator_opt): Parse C++11 attributes before
3294 2020-01-29 Marek Polacek <polacek@redhat.com>
3296 PR c++/91754 - Fix template arguments comparison with class NTTP.
3297 * pt.c (class_nttp_const_wrapper_p): New.
3298 (template_args_equal): See through class_nttp_const_wrapper_p
3301 2020-01-29 Marek Polacek <polacek@redhat.com>
3303 PR c++/92948 - Fix class NTTP with template arguments.
3304 * pt.c (convert_nontype_argument): Use IMPLICIT_CONV_EXPR when
3305 converting a value-dependent expression to a class type.
3306 (tsubst_copy) <case VIEW_CONVERT_EXPR>: Allow IMPLICIT_CONV_EXPR
3307 as the result of the tsubst_copy call.
3309 2020-01-29 Jakub Jelinek <jakub@redhat.com>
3312 * cp-gimplify.c (cxx_omp_predetermined_sharing): Return
3313 OMP_CLAUSE_DEFAULT_SHARED for typeinfo decls.
3315 2020-01-28 Jason Merrill <jason@redhat.com>
3318 * parser.c (cp_parser_lambda_expression): Clear in_discarded_stmt.
3322 * decl2.c (copy_linkage): Do copy DECL_ONE_ONLY and DECL_WEAK.
3325 * call.c (build_user_type_conversion_1): Allow a template conversion
3326 returning an rvalue reference to bind directly to an lvalue.
3329 * decl.c (grokdeclarator): Propagate eh spec from typedef.
3331 2020-01-28 Martin Liska <mliska@suse.cz>
3334 * pt.c (redeclare_class_template): Group couple of
3335 errors and inform messages with auto_diagnostic_group.
3337 2020-01-28 Martin Liska <mliska@suse.cz>
3340 * pt.c (redeclare_class_template): Use inform
3341 for the second location.
3343 2020-01-27 Jason Merrill <jason@redhat.com>
3346 * pt.c (tsubst_copy) [STRING_CST]: Don't use fold_convert.
3348 2020-01-27 Iain Sandoe <iain@sandoe.co.uk>
3351 * coroutines.cc (morph_fn_to_coro): Check the ramp return
3352 value when it is constructed from the 'get return object'.
3354 2020-01-27 Nathan Sidwell <nathan@acm.org>
3357 * name-lookup.c (is_ancestor): Allow CHILD to be a namespace alias.
3359 2020-01-26 Jason Merrill <jason@redhat.com>
3362 * except.c (maybe_noexcept_warning): Check DECL_IN_SYSTEM_HEADER and
3363 temporarily enable -Wsystem-headers. Change second warning to
3367 * semantics.c (finish_call_expr): Don't call
3368 instantiate_non_dependent_expr before warn_for_memset.
3370 2020-01-25 Marek Polacek <polacek@redhat.com>
3372 PR c++/93414 - poor diagnostic for dynamic_cast in constexpr context.
3373 * constexpr.c (cxx_eval_dynamic_cast_fn): Add a reference
3374 dynamic_cast diagnostic.
3376 2020-01-24 Jason Merrill <jason@redhat.com>
3378 PR c++/93400 - ICE with constrained friend.
3379 * constraint.cc (maybe_substitute_reqs_for): New.
3380 * decl.c (function_requirements_equivalent_p): Call it.
3381 * pt.c (tsubst_friend_function): Only substitute
3382 TEMPLATE_PARMS_CONSTRAINTS.
3383 (tsubst_template_parms): Copy constraints.
3385 2020-01-24 Jason Merrill <jason@redhat.com>
3387 PR c++/93279 - ICE with lambda in member operator.
3388 * name-lookup.c (maybe_save_operator_binding): Don't remember
3389 class-scope bindings.
3391 2020-01-24 Jason Merrill <jason@redhat.com>
3393 PR c++/93377 - ICE with member alias in constraint.
3394 * pt.c (any_template_parm_r): Look at template arguments for all
3395 aliases, not only alias templates.
3397 2020-01-24 Marek Polacek <polacek@redhat.com>
3399 PR c++/93299 - ICE in tsubst_copy with parenthesized expression.
3400 * pt.c (tsubst_copy): Handle a REF_PARENTHESIZED_P VIEW_CONVERT_EXPR.
3402 2020-01-24 Jason Merrill <jason@redhat.com>
3404 PR c++/92852 - ICE with generic lambda and reference var.
3405 * constexpr.c (maybe_constant_value): Likewise.
3407 2020-01-23 Paolo Carlini <paolo.carlini@oracle.com>
3410 * parser.c (cp_parser_nested_name_specifier_opt): Properly
3411 diagnose concept-ids.
3413 2020-01-23 Jason Merrill <jason@redhat.com>
3415 PR c++/93331 - ICE with __builtin_strchr.
3416 * constexpr.c (cxx_eval_builtin_function_call): Use the original
3417 argument if we didn't manage to extract a STRING_CST.
3419 PR c++/93345 - ICE with defaulted dtor and template.
3421 * decl.c (cxx_maybe_build_cleanup): Don't try to set
3422 throwing_cleanup in a template.
3424 2020-01-22 Marek Polacek <polacek@redhat.com>
3426 PR c++/92907 - noexcept does not consider "const" in member functions.
3427 * g++.dg/cpp0x/noexcept56.C: New test.
3429 2020-01-22 Marek Polacek <polacek@redhat.com>
3431 PR c++/93324 - ICE with -Wall on constexpr if.
3432 * semantics.c (is_std_constant_evaluated_p): Check fndecl.
3434 2020-01-22 Patrick Palka <ppalka@redhat.com>
3436 * constraint.cc (get_mapped_args): Avoid using auto_vec
3437 as a vector element. Release the vectors inside the lists
3439 * parser.c (cp_literal_operator_id): Free the buffer.
3441 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
3443 * coroutines.cc (finish_co_await_expr): Add error check on return
3444 value of build_co_await.
3445 (finish_co_yield_expr,): Ditto.
3447 2020-01-22 Jun Ma <JunMa@linux.alibaba.com>
3449 * coroutines.cc (lookup_awaitable_member): Lookup an awaitable member.
3450 (lookup_promise_method): Emit diagnostic when get NULL_TREE back only.
3451 (build_co_await): Use lookup_awaitable_member instead of lookup_member.
3453 2020-01-21 Jason Merrill <jason@redhat.com>
3455 PR c++/60855 - ICE with sizeof VLA capture.
3456 * lambda.c (is_lambda_ignored_entity): Don't look past VLA capture.
3458 PR c++/90732 - ICE with VLA capture and generic lambda.
3459 * pt.c (tsubst_lambda_expr): Repeat add_capture for VLAs.
3461 2020-01-21 Iain Sandoe <iain@sandoe.co.uk>
3462 Bin Cheng <bin.cheng@linux.alibaba.com>
3464 * coroutines.cc (coro_promise_type_found_p): Check for NULL return
3465 from complete_type_or_else.
3466 (register_param_uses): Likewise.
3467 (build_co_await): Do not try to use complete_type_or_else for void
3468 types, otherwise for incomplete types, check for NULL return from
3469 complete_type_or_else.
3471 2020-01-21 Jason Merrill <jason@redhat.com>
3473 PR c++/91476 - anon-namespace reference temp clash between TUs.
3474 * decl2.c (copy_linkage): Factor out of get_guard.
3475 * call.c (make_temporary_var_for_ref_to_temp): Use it.
3476 * decl.c (cp_finish_decomp): Use it.
3477 (cp_finish_decl): determine_visibility sooner.
3479 2020-01-21 Bin Cheng <bin.cheng@linux.alibaba.com>
3481 * coroutines.cc (finish_co_await_expr): Set return value flag.
3482 (finish_co_yield_expr, morph_fn_to_coro): Ditto.
3484 2020-01-19 Jason Merrill <jason@redhat.com>
3486 PR c++/33799 - destroy return value, take 2.
3487 * cp-tree.h (current_retval_sentinel): New macro.
3488 (struct language_function): Add throwing_cleanup bitfield.
3489 * decl.c (cxx_maybe_build_cleanup): Set it.
3490 * except.c (maybe_set_retval_sentinel)
3491 (maybe_splice_retval_cleanup): New functions.
3492 * parser.c (cp_parser_compound_statement): Call
3493 maybe_splice_retval_cleanup.
3494 * typeck.c (check_return_expr): Call maybe_set_retval_sentinel.
3496 * parser.c (cp_parser_lambda_body): Use cp_parser_function_body.
3498 2020-01-18 Jakub Jelinek <jakub@redhat.com>
3500 * coroutines.cc (get_fn_local_identifier): Fix NO_DOT_IN_LABEL
3501 but non-NO_DOLLAR_IN_LABEL case build.
3503 2020-01-18 Iain Sandoe <iain@sandoe.co.uk>
3505 * Make-lang.in: Add coroutines.o.
3506 * cp-tree.h (lang_decl-fn): coroutine_p, new bit.
3507 (DECL_COROUTINE_P): New.
3508 * lex.c (init_reswords): Enable keywords when the coroutine flag
3510 * operators.def (co_await): New operator.
3511 * call.c (add_builtin_candidates): Handle CO_AWAIT_EXPR.
3512 (op_error): Likewise.
3513 (build_new_op_1): Likewise.
3514 (build_new_function_call): Validate coroutine builtin arguments.
3515 * constexpr.c (potential_constant_expression_1): Handle
3516 CO_AWAIT_EXPR, CO_YIELD_EXPR, CO_RETURN_EXPR.
3517 * coroutines.cc: New file.
3518 * cp-objcp-common.c (cp_common_init_ts): Add CO_AWAIT_EXPR,
3519 CO_YIELD_EXPR, CO_RETRN_EXPR as TS expressions.
3520 * cp-tree.def (CO_AWAIT_EXPR, CO_YIELD_EXPR, (CO_RETURN_EXPR): New.
3521 * cp-tree.h (coro_validate_builtin_call): New.
3522 * decl.c (emit_coro_helper): New.
3523 (finish_function): Handle the case when a function is found to
3524 be a coroutine, perform the outlining and emit the outlined
3525 functions. Set a bit to signal that this is a coroutine component.
3526 * parser.c (enum required_token): New enumeration RT_CO_YIELD.
3527 (cp_parser_unary_expression): Handle co_await.
3528 (cp_parser_assignment_expression): Handle co_yield.
3529 (cp_parser_statement): Handle RID_CO_RETURN.
3530 (cp_parser_jump_statement): Handle co_return.
3531 (cp_parser_operator): Handle co_await operator.
3532 (cp_parser_yield_expression): New.
3533 (cp_parser_required_error): Handle RT_CO_YIELD.
3534 * pt.c (tsubst_copy): Handle CO_AWAIT_EXPR.
3535 (tsubst_expr): Handle CO_AWAIT_EXPR, CO_YIELD_EXPR and
3537 * tree.c (cp_walk_subtrees): Likewise.
3539 2020-01-17 Jason Merrill <jason@redhat.com>
3541 PR c++/92531 - ICE with noexcept(lambda).
3542 * pt.c (uses_template_parms): Don't try to enumerate all the
3545 2020-01-17 Jakub Jelinek <jakub@redhat.com>
3548 * parser.c (cp_parser_template_name): Look up deprecated attribute
3549 in DECL_TEMPLATE_RESULT or its type's attributes.
3551 2020-01-16 Jason Merrill <jason@redhat.com>
3553 PR c++/93286 - ICE with __is_constructible and variadic template.
3554 * pt.c (tsubst) [TREE_LIST]: Handle pack expansion.
3555 (tsubst_copy_and_build) [TRAIT_EXPR]: Always use tsubst for type2.
3557 PR c++/93280 - ICE with aggregate assignment and DMI.
3558 * init.c (get_nsdmi): Set TARGET_EXPR_DIRECT_INIT_P here.
3559 * typeck2.c (digest_nsdmi_init): Not here.
3561 2020-01-15 Paolo Carlini <paolo.carlini@oracle.com>
3564 * cp-tree.h (is_constrained_auto): New.
3565 * parser.c (cp_parser_maybe_commit_to_declaration): Correctly
3566 handle concept-check expressions; take a cp_decl_specifier_seq*
3568 (cp_parser_condition): Update call.
3569 (cp_parser_simple_declaration): Likewise.
3570 (cp_parser_placeholder_type_specifier): Correctly handle
3571 concept-check expressions.
3573 2020-01-15 Jason Merrill <jason@redhat.com>
3576 PR c++/33799 - destroy return value if local cleanup throws.
3577 * cp-tree.h (current_retval_sentinel): New macro.
3578 * decl.c (start_preparsed_function): Set up cleanup for retval.
3579 * typeck.c (check_return_expr): Set current_retval_sentinel.
3581 PR c++/93257 - consteval void function.
3582 * constexpr.c (verify_constant): Allow void_node.
3584 PR c++/92871 - bad code with xvalue and GNU ?: extension.
3585 * call.c (prevent_lifetime_extension): New.
3586 (build_conditional_expr_1): Use it.
3588 2020-01-14 Nathan Sidwell <nathan@acm.org>
3591 * pt.c (retrieve_specialization): Use get_template_info, not open
3595 * pt.c (retrieve_specialization): Get the TI from the decl or the
3596 classtype as appropriate.
3598 2020-01-14 David Malcolm <dmalcolm@redhat.com>
3600 * cp-gimplify.c (source_location_table_entry_hash::empty_zero_p):
3601 New static constant.
3602 * cp-tree.h (named_decl_hash::empty_zero_p): Likewise.
3603 (struct named_label_hash::empty_zero_p): Likewise.
3604 * decl2.c (mangled_decl_hash::empty_zero_p): Likewise.
3606 2020-01-14 Jason Merrill <jason@redhat.com>
3608 PR c++/92590 - wrong handling of inherited default ctor.
3609 * class.c (add_method): A constrained inherited ctor doesn't hide an
3610 implicit derived ctor.
3612 PR c++/92552 - ICE with inherited constrained default ctor.
3613 * pt.c (instantiate_class_template_1): Copy
3614 TYPE_HAS_USER_CONSTRUCTOR.
3615 PR c++/91930 - ICE with constrained inherited default ctor.
3616 * name-lookup.c (do_class_using_decl): Set TYPE_HAS_USER_CONSTRUCTOR
3617 for inherited constructor.
3618 PR c++/92594 - ICE with inherited trivial default ctor.
3619 * method.c (trivial_fn_p): Treat an inherited default constructor
3620 like a normal default constructor.
3622 PR c++/92594 - ICE with inherited trivial default ctor.
3623 * method.c (trivial_fn_p): Treat an inherited default constructor
3624 like a normal default constructor.
3626 PR c++/92009 - ICE with punning of typeid.
3627 * rtti.c (get_tinfo_desc): Call xref_basetypes.
3628 * constexpr.c (cxx_fold_indirect_ref): Don't strip
3631 2020-01-13 Jason Merrill <jason@redhat.com>
3633 PR c++/92746 - ICE with noexcept of function concept check.
3634 * except.c (check_noexcept_r): Handle concept-check.
3636 PR c++/92582 - ICE with member template as requirement.
3637 * pt.c (struct find_template_parameter_info): Add ctx_parms.
3638 (any_template_parm_r): Handle TEMPLATE_DECL.
3639 (find_template_parameters): Take parms instead of their depth.
3640 * constraint.cc (build_parameter_mapping): Pass them.
3642 PR c++/33799 - destroy return value if local cleanup throws.
3643 * cp-tree.h (current_retval_sentinel): New macro.
3644 * decl.c (start_preparsed_function): Set up cleanup for retval.
3645 * typeck.c (check_return_expr): Set current_retval_sentinel.
3647 PR c++/93238 - short right-shift with enum.
3648 * typeck.c (cp_build_binary_op): Use folded op1 for short_shift.
3650 2020-01-10 Jason Merrill <jason@redhat.com>
3652 * typeck.c (cp_build_binary_op): Restore short_shift code.
3654 PR c++/93143 - incorrect tree sharing with constexpr.
3655 * constexpr.c (cxx_eval_outermost_constant_expr): Don't assume
3656 CONSTRUCTORs are already unshared.
3658 PR c++/93173 - incorrect tree sharing.
3660 * cp-gimplify.c (cp_gimplify_init_expr, cp_gimplify_expr): Use
3661 copy_if_shared after cp_genericize_tree.
3662 * typeck2.c (split_nonconstant_init): Don't unshare here.
3664 2020-01-08 Jason Merrill <jason@redhat.com>
3666 * cp-gimplify.c (cp_gimplify_expr) [TARGET_EXPR]: Check
3667 TARGET_EXPR_DIRECT_INIT_P.
3668 * constexpr.c (cxx_eval_constant_expression): Likewise.
3670 2020-01-08 Jason Merrill <jason@redhat.com>
3672 PR c++/91369 - constexpr destructor and member initializer.
3673 * constexpr.c (cxx_eval_store_expression): Look through TARGET_EXPR
3674 when not preevaluating.
3676 2020-01-08 Jason Merrill <jason@redhat.com>
3678 * constexpr.c (cxx_eval_call_expression): Remove DECL_BY_REFERENCE
3681 2020-01-07 Paolo Carlini <paolo.carlini@oracle.com>
3683 * init.c (build_new): Add location_t parameter and use it throughout.
3684 (build_raw_new_expr): Likewise.
3685 * parser.c (cp_parser_new_expression): Pass the combined_loc.
3686 * pt.c (tsubst_copy_and_build): Adjust call.
3687 * cp-tree.h: Update declarations.
3689 2020-01-07 Jason Merrill <jason@redhat.com>
3691 PR c++/47877 - -fvisibility-inlines-hidden and member templates.
3692 * decl2.c (determine_visibility): -fvisibility-inlines-hidden beats
3693 explicit class visibility for a template.
3695 2020-01-07 Richard Sandiford <richard.sandiford@arm.com>
3697 * mangle.c (mangle_type_attribute_p): New function, split out from...
3698 (write_CV_qualifiers_for_type): ...here. Don't mangle attributes
3699 that contain a space.
3701 2020-01-07 Jakub Jelinek <jakub@redhat.com>
3704 * constexpr.c (struct constexpr_global_ctx): Add heap_alloc_count
3705 member, initialize it to zero in ctor.
3706 (cxx_eval_call_expression): Bump heap_dealloc_count when deleting
3707 a heap object. Don't cache calls to functions which allocate some
3708 heap objects and don't deallocate them or deallocate some heap
3709 objects they didn't allocate.
3711 2020-01-06 Jason Merrill <jason@redhat.com>
3713 PR c++/92552 - ICE with inherited constrained default ctor.
3714 * pt.c (instantiate_class_template_1): Copy
3715 TYPE_HAS_USER_CONSTRUCTOR.
3716 * class.c (one_inherited_ctor): Don't set it here.
3718 2020-01-06 Andrew Sutton <asutton@lock3software.com>
3720 PR c++/92739 - parsing requires clause with attributes.
3721 * parser.c (cp_parser_constraint_requires_parens): Exclude
3722 attributes as postfix expressions.
3724 2020-01-05 Jakub Jelinek <jakub@redhat.com>
3727 * parser.c (cp_parser_check_class_key): Disable access checks for the
3729 (cp_parser_maybe_warn_enum_key): Likewise. Return early if
3730 !warn_redundant_tags.
3732 2010-01-05 Jakub Jelinek <jakub@redhat.com>
3735 * cp-gimplify.c (cp_gimplify_init_expr): Don't look through
3736 TARGET_EXPR if it has been gimplified already.
3738 2020-01-03 Jason Merrill <jason@redhat.com>
3740 PR c++/93033 - incorrect tree node sharing with array init.
3741 * typeck2.c (split_nonconstant_init): Unshare non-decl.
3742 * cp-gimplify.c (cp_gimplify_init_expr): Only split if -fexceptions.
3744 2020-01-02 Jason Merrill <jason@redhat.com>
3746 * pt.c (invalid_nontype_parm_type_p): Reject class placeholder in
3749 2020-01-02 Jakub Jelinek <jakub@redhat.com>
3752 * cp-objcp-common.c (identifier_global_tag): Return NULL_TREE if name
3753 has not been found, rather than error_mark_node.
3755 2020-01-01 Jakub Jelinek <jakub@redhat.com>
3757 Update copyright years.
3759 Copyright (C) 2020 Free Software Foundation, Inc.
3761 Copying and distribution of this file, with or without modification,
3762 are permitted in any medium without royalty provided the copyright
3763 notice and this notice are preserved.