https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113830
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Probably we just don't instantiate g because nothing needs it. With template<typename T> void f() { struct S { void g(int n = T::unknown){}; }; S s; s.g(); } template void f<int>(); we error: pr113830.C: In instantiation of ‘void f() [with T = int]’: pr113830.C:6:22: required from here 6 | template void f<int>(); | ^ pr113830.C:2:32: error: ‘unknown’ is not a member of ‘int’ 2 | struct S { void g(int n = T::unknown){}; }; | ^~~~~~~ pr113830.C:4:6: note: when instantiating default argument for call to ‘void f()::S::g(int) [with T = int]’ 4 | s.g(); | ~~~^~ but when one uses s.g(0); instead of s.g(); we accept it as well.