https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87155
Bug ID: 87155 Summary: unnamed namespace redeclaration error when inline namespace is present Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: artiom.yurol at ya dot ru Target Milestone: --- Created attachment 44631 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=44631&action=edit preprocessed file namespace n1 { namespace {} inline namespace n2 { namespace {} } namespace {} } This should compile just fine, but it doesn't. G++ rejects it reporting that the extension of unnamed namespace at line 8 conflicts with the declaration at line 2. $ gcc ../playground.cpp ../playground.cpp:8:5: error: ‘namespace n1:: { }’ conflicts with a previous declaration namespace {} ^~~~~~~~~ ../playground.cpp:2:5: note: previous declaration ‘namespace n1:: { }’ namespace {} ^~~~~~~~~ Clang-6.0 doesn't reject the code. Removing nested namespace n2 also fixes the problem