https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113830
--- Comment #3 from Bo Wang <wangbopku15 at gmail dot com> --- (In reply to Jonathan Wakely from comment #1) > (In reply to Bo Wang from comment #0) > > It appears that if a template function has an internally defined local class > > that uses a dependent name in its member function, it can cause the > > compiler's name-binding process to get into trouble. > > Or GCC just doesn't check the default argument because it's not used? Please check this one in Godbolt: https://godbolt.org/z/ffj8Pr5n1 It does exist if we use `T::unknow`: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ template<typename T> void f() { struct S { void g(int n = T::unknown) noexcept(T::unknown); }; } template void f<int>(); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Also, Clang could reject it.