std
or posix
is an undefined behavior CXX-W2017In C++, one can limit a declaration to the namespace to avoid name resolution conflicts. Also, a namespace declaration is not limited to a single file. This opens up the opportunity to modify the namespace introduced by the standard C++ library namely std
and posix
. According to the standard, such a modification is an undefined behavior.
Avoid adding declaration or definition to namespace std
or namespace posix
.
namespace std {
class User;
}
namespace local {
class User;
}