Open ebdd6ebc-1612-4e9b-aee1-f7d2b6361d5f opened 9 years ago
This should also be ill-formed, but clang accepts it too (it an even simpler test-case):
struct S;
namespace N { using ::S; }
struct N::S {};
Disregard the previous comment. It was indented for the same bug in GCC.
This bug seems to be more general than struct definitions. It also exists for variable declarations like this:
namespace X { extern int i; }
namespace N { using X::i; }
int N::i = 1;
int main() {}
The above program is ill-formed by [dcl.meaning]p1, but no error message is given.
Extended Description
Consider the following program:
But clang compiles it without any error messages. The expected behaviour is to get an error message.
The program is ill-formed by the following clauses in the c++ standard:
[class]p11 ( http://eel.is/c++draft/class#11 ): Note especially the sentence "i.e., not merely inherited or introduced by a using-declaration"
[dcl.meaning]p1 ( http://eel.is/c++draft/dcl.meaning#1 ): Not especially the sentence "the member shall not merely have been introduced by a using-declaration in the scope of the class or namespace nominated by the nested-name-specifier of the declarator-id."