r/cpp • u/VinnieFalco wg21.org | corosio.org • Sep 06 '20
inline namespace bug in msvc
I went to report this using the IDE and it asked me to "log in" which I tried but Microsoft's browser widget broke my password manager so I said to login with GitHub and when I pressed that button another browser window popped up asking me to log in to GitHub but at the top it said "GitHub does not support this browser (lol)" so I gave up and I am posting this code snippet here:
This fails to compile in latest msvc:
namespace boost {
namespace json {
inline namespace standalone {
namespace detail {
struct V{};
} // detail
} // standalone
namespace detail {
struct T{};
} // detail
struct U : detail::T{};
} // json
} // boostSee: https://godbolt.org/z/qbPesG
It compiles everywhere else
2
Upvotes
4
u/flyingron Sep 06 '20
I couldn't read your code without indentation.
The error is marked above. I think Visual Studio is wrong here. Visual studio sort of acts as if an inline namespace is like defining the namespace and then inserting a using right after it. This is NOT what the language requires, It's supposed to put the inlined namespace definitions in the enclosing scope. The above should be no different than writing: