https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92198
Bug ID: 92198 Summary: error "different exception specifier" with forward referring noexcept condition Product: gcc Version: 9.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: gccbugbjorn at fahller dot se Target Milestone: --- Created attachment 47095 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=47095&action=edit Failing test program The below code fails to compile: bjorn@TS-PC11H6ST:/tmp$ cat t.cpp template <typename T> class C { public: C(const C& e) noexcept( noexcept(T(e.value())) ); T& value() & noexcept; // move above copy-ctor to make code compile }; template <typename T> C<T>::C(const C& e) noexcept( noexcept(T(e.value())) ) { } bjorn@TS-PC11H6ST:/tmp$ g++-9 t.cpp t.cpp:11:1: error: declaration of ‘C<T>::C(const C<T>&) noexcept (noexcept ((T)(e.C<T>::value())))’ has a different exception specifier 11 | C<T>::C(const C& e) noexcept( noexcept(T(e.value())) ) | ^~~~ t.cpp:6:5: note: from previous declaration ‘C<T>::C(const C<T>&) noexcept (noexcept ((T)(e.value())))’ 6 | C(const C& e) noexcept( noexcept(T(e.value())) ); | ^ bjorn@TS-PC11H6ST:/tmp$ g++-9 --version g++-9 (Ubuntu 9.2.1-9ubuntu2~18.04.1) 9.2.1 20191008 Copyright (C) 2019 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Obligatory godbolt link : https://godbolt.org/z/uB44Oo