https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97446
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- The template isn't instantiated, so whether you get or don't get diagnostics from the compiler depends really on the compiler. If you instantiate it, such as add S1<int>::S2 s; at the end, you get it properly diagnosed even with g++.