https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56643
--- Comment #2 from Casey Carter <Casey at Carter dot net> --- For future readers, I believe the simplest workaround is to make the friend function a static member function of a new class, friend that class instead of the function, and introduce a simple forwarding function in the original function's place: template <int N> struct Test { friend struct workaround_56643; }; struct workaround_56643 { template <int N> static void test(Test<N>&) noexcept(N == 0) {} }; template <int N> auto test(Test<N>& arg) noexcept(noexcept(workaround_56643::test(arg))) -> decltype(workaround_56643::test(arg)) { return workaround_56643::test(arg); } int main() { Test<0> t; test(t); }