[Bug c++/86233] A tricky code sample
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jun 20 13:53:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86233
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |accepts-invalid
Status|UNCONFIRMED |NEW
Last reconfirmed| |2018-06-20
Ever confirmed|0 |1
--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I can't find the relevant standarese but I think the code should be rejected
because the specialization has a weaker exception-specification.
Reduced:
template<typename T> struct X {
void f() noexcept { }
};
template<> void X<int>::f() { }
EDG says:
"es.cc", line 5: error: allowing all exceptions is incompatible with function
"X<T>::f" (declared at line 2)
template<> void X<int>::f() { }
^
1 error detected in the compilation of "es.cc".
Clang says:
es.cc:5:25: error: 'f' is missing exception specification 'noexcept'
template<> void X<int>::f() { }
^
noexcept
es.cc:2:8: note: previous declaration is here
void f() noexcept { }
^
1 error generated.
More information about the Gcc-bugs
mailing list