diff options
author | Patrick Palka <ppalka@redhat.com> | 2024-05-29 04:49:37 -0400 |
---|---|---|
committer | Patrick Palka <ppalka@redhat.com> | 2024-05-29 04:49:37 -0400 |
commit | 58b8c87b7fb281e35a6817cc91a292096fdc02dc (patch) | |
tree | 363938a2a68eb8ced18394711caf18ce18bed647 /gcc/testsuite/g++.dg | |
parent | 2f97d98d174e3ef9f3a9a83c179d787abde5e066 (diff) | |
download | gcc-58b8c87b7fb281e35a6817cc91a292096fdc02dc.zip gcc-58b8c87b7fb281e35a6817cc91a292096fdc02dc.tar.gz gcc-58b8c87b7fb281e35a6817cc91a292096fdc02dc.tar.bz2 |
c++: canonicity of fn types w/ instantiated eh specs [PR115223]
When propagating structural equality in build_cp_fntype_variant, we
should consider structural equality of the exception-less variant, not
of the given type which might use structural equality only because it
has a (complex) noexcept-spec that we're intending to replace, as in
maybe_instantiate_noexcept which calls build_exception_variant using
the deferred-noexcept function type. Otherwise we might pessimistically
use structural equality for a function type with a simple instantiated
noexcept-spec, leading to a LTO-triggered type verification failure if we
later use that (structural-equality) type as the canonical version of
some other variant.
PR c++/115223
gcc/cp/ChangeLog:
* tree.cc (build_cp_fntype_variant): Propagate structural
equality of the exception-less variant.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/noexcept87.C: New test.
Reviewed-by: Jason Merrill <jason@redhat.com>
Diffstat (limited to 'gcc/testsuite/g++.dg')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/noexcept87.C | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept87.C b/gcc/testsuite/g++.dg/cpp0x/noexcept87.C new file mode 100644 index 0000000..339569d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept87.C @@ -0,0 +1,11 @@ +// PR c++/115223 +// { dg-do compile { target c++11 } } +// { dg-additional-options -flto } + +template<class T> +void f() noexcept(bool(T() || true)); + +void g() { f<int>(); } + +using type = void; +type callDestructorIfNecessary() noexcept {} |