https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96982
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- And the reason it isn't diagnosed with -O2 etc. is only that it is inlined and not emitted out of line. Try -O2 -fkeep-inline-functions or take the address of the static data member function. section ("") name is like any other invalid section, consider section ("foo bar baz") or section ("+_*/%^") etc.