diff options
author | Patrick Palka <ppalka@redhat.com> | 2022-02-06 10:47:48 -0500 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2022-02-06 10:47:48 -0500 |
commit | 8eb329e963593342855b6072e5692659107337b7 (patch) | |
tree | b861c67b6cd3240eb26404f2152626924f5cbbf9 /gcc/gimple-expr.cc | |
parent | f9e900ce9b17dc7d3a3809d0b0648ebe529a87c5 (diff) | |
download | gcc-8eb329e963593342855b6072e5692659107337b7.zip gcc-8eb329e963593342855b6072e5692659107337b7.tar.gz gcc-8eb329e963593342855b6072e5692659107337b7.tar.bz2 |
c++: dependent noexcept-spec on defaulted comparison op [PR96242]
Here we're failing to instantiate the defaulted comparison op's
explicit dependent noexcept-spec. The problem is ultimately that
mark_used relies on maybe_instantiate_noexcept to synthesize a defaulted
comparison op, but the relevant DECL_MAYBE_DELETED fn handling in m_i_n
is intended for such functions whose noexcept-spec wasn't explicitly
provided (and is therefore determined via synthesis), so m_i_n just
exits early afterwards, without considering that the synthesized fn may
have an explicit noexcept-spec that needs instantiating.
This patch fixes this issue by making mark_used directly synthesize a
DECL_MAYBE_DELETED fn before calling maybe_instantiate_noexcept. And
in turn, we can properly restrict the DECL_MAYBE_DELETED fn synthesis
in m_i_n to only those without an explicit noexcept-spec.
PR c++/96242
gcc/cp/ChangeLog:
* decl2.cc (mark_used): Directly synthesize a DECL_MAYBE_DELETED
fn by calling maybe_synthesize_method instead of relying on
maybe_instantiate_noexcept. Move call to m_i_n after the
DECL_DELETED_FN handling.
* pt.cc (maybe_instantiate_noexcept): Restrict DECL_MAYBE_DELETED
fn synthesis to only those with an implicit noexcept-spec, and
return !DECL_DELETED_FN instead of !DECL_MAYBE_DELETED afterwards.
gcc/testsuite/ChangeLog:
* g++.dg/cpp2a/spaceship-synth15.C: New test.
Diffstat (limited to 'gcc/gimple-expr.cc')
0 files changed, 0 insertions, 0 deletions