https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86491
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic --- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> --- It is not complaining about d in main but rather N::D. The warning is done before it reaches main. Really the warning should be clearer as you are not using an anonymous namespace rather static linkage which is also causes an anonymous namespace issues.