https://gcc.gnu.org/bugzilla/show_bug.cgi?id=125613
Bug ID: 125613
Summary: explicit instantiation and noexcept-specifier
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mpolacek at gcc dot gnu.org
Target Milestone: ---
In
```
template<typename T>
void fn1 (T) {}
template void fn1<int>(int); // OK
template<typename T>
void fn2 (T) noexcept {}
template void fn2<int>(int) noexcept; // OK
template<typename T>
void fn3 (T) {}
template void fn3<int>(int) noexcept; // error
template<typename T>
void fn4 (T) noexcept {}
template void fn4<int>(int); // OK
```
we don't emit the error but all the other compilers do.
This is [except.spec]: In an explicit instantiation a noexcept-specifier may be
specified, but is not required.
If a noexcept-specifier is specified in an explicit instantiation, the
exception specification shall be the same as the exception specification of all
other declarations of that function.