diff options
author | Patrick Palka <ppalka@redhat.com> | 2024-09-05 14:31:00 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2024-09-05 14:31:00 -0400 |
commit | 37977343ff4f9dcb047d966d8cbaa222964763f9 (patch) | |
tree | aacb3a3af08fa566f09f425f0900b3b9f5d5ccdd /gcc/cp/parser.cc | |
parent | c880fca6cdb16c5efe3a12ee7ecdb2435f5e7105 (diff) | |
download | gcc-37977343ff4f9dcb047d966d8cbaa222964763f9.zip gcc-37977343ff4f9dcb047d966d8cbaa222964763f9.tar.gz gcc-37977343ff4f9dcb047d966d8cbaa222964763f9.tar.bz2 |
c++: local class memfn synth from noexcept context [PR113063]
Extending the PR113063 testcase to additionally constant evaluate the <=>
expression causes us to trip over the assert in cxx_eval_call_expression
/* We used to shortcut trivial constructor/op= here, but nowadays
we can only get a trivial function here with -fno-elide-constructors. */
gcc_checking_assert (!trivial_fn_p (fun)
|| !flag_elide_constructors
/* We don't elide constructors when processing
a noexcept-expression. */
|| cp_noexcept_operand);
since the local class's <=> was first used and therefore synthesized in
a noexcept context and so its definition contains unelided trivial
constructors.
This patch fixes this by clearing cp_noexcept_operand alongside
cp_unevaluated_context in the function-local case of
maybe_push_to_top_level.
PR c++/113063
gcc/cp/ChangeLog:
* name-lookup.cc (local_state_t): Clear and restore
cp_noexcept_operand as well.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/spaceship-synth16.C: Also constant evaluate
the <=> expression.
* g++.dg/cpp2a/spaceship-synth16a.C: Likewise.
Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/cp/parser.cc')
0 files changed, 0 insertions, 0 deletions