Must the declaration of a namespace as inline
be the first one, or can any (reopened) namespace be declard as inline
at any point?
If so, is there a way to prevent someone to declare a namespace as inline
(afterwards)?
#include <iostream>
namespace outer {
//inline
namespace inner {
}}
//inline namespace std {}
namespace outer {
inline
namespace inner {
void foo() {
std::cout << "foo" << std::endl;
//::cout << "foo" << endl;
}
}}
int main() {
outer::foo();
}
edit
It seems that gcc accepts this, as I first tested only on coliru, however clang rejects it
Aucun commentaire:
Enregistrer un commentaire