[Bug c++/87155] [8/9 Regression] unnamed namespace redeclaration error when inline namespace is present

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Aug 30 13:21:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87155

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Yes but it would conflict with n1::n2::bob because n2 is an inline namespace.

It seems like the diagnostic is misleading, it suggests n1::bob conflicts with
itself, but actually it conflicts with n1::n2::bob:

namespace n1 {
    namespace bob {}

    inline namespace n2 {
        namespace bob {}
    } 

    namespace bob {}
} 

anon.cc:8:15: error: 'namespace n1::bob { }' conflicts with a previous
declaration
8 |     namespace bob {}
  |               ^~~
anon.cc:2:15: note: previous declaration 'namespace n1::bob { }'
2 |     namespace bob {}
  |               ^~~


More information about the Gcc-bugs mailing list