https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84177
Bug ID: 84177 Summary: Attributes on C++17 nested namespaces Product: gcc Version: 7.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: akim.demaille at gmail dot com Target Milestone: --- One would expect this to work: $ cat /tmp/foo.cc namespace a::b __attribute__ ((visibility ("protected")) {} $ g++-mp-7 -std=c++17 /tmp/foo.cc /tmp/foo.cc:1:16: error: expected '{' before '__attribute__' namespace a::b __attribute__ ((visibility ("protected")) {} ^~~~~~~~~~~~~ /tmp/foo.cc:1:58: error: expected ')' before '{' token namespace a::b __attribute__ ((visibility ("protected")) {} ^ /tmp/foo.cc:1:59: error: expected unqualified-id at end of input namespace a::b __attribute__ ((visibility ("protected")) {} ^ /tmp/foo.cc:1:59: error: expected '}' at end of input This is: $ g++-mp-7 --version g++-mp-7 (MacPorts gcc7 7.2.0_0) 7.2.0 Copyright (C) 2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. FWIW, it's quite hard to navigate in the documentation to find information about attributes for namespaces. I have not found clear evidence that this feature had been considered and eliminated, or whether it's just an overlook. Cheers!