https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115223
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Patrick Palka <ppa...@gcc.gnu.org>: https://gcc.gnu.org/g:58b8c87b7fb281e35a6817cc91a292096fdc02dc commit r15-892-g58b8c87b7fb281e35a6817cc91a292096fdc02dc Author: Patrick Palka <ppa...@redhat.com> Date: Wed May 29 04:49:37 2024 -0400 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 <ja...@redhat.com>