https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115670
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> --- (In reply to Andrew Pinski from comment #5) > So at -O1, foo0, foo5, foo6 are the only ones left. > > at -O0, foo1, foo2, foo3, foo4 are also emitted but that is expected since > GCC emits static unused functions always at -O0. > > > So let's keep this for foo0/foo5. I will file one for foo6 in a second. Note if the definition of the anonymous namespace is in a header, then GCC does warn for s2 (not for foo6 though).