Warning for using-directive in class scope.

This commit is contained in:
Roberto Raggi
2009-02-19 13:52:05 +01:00
parent 7e10664e6a
commit 6178a44fc2

View File

@@ -389,6 +389,11 @@ bool CheckDeclaration::visit(UsingDirectiveAST *ast)
UsingNamespaceDirective *u = control()->newUsingNamespaceDirective(ast->firstToken(), name); UsingNamespaceDirective *u = control()->newUsingNamespaceDirective(ast->firstToken(), name);
ast->symbol = u; ast->symbol = u;
_scope->enterSymbol(u); _scope->enterSymbol(u);
if (! (_scope->isBlockScope() || _scope->isNamespaceScope()))
translationUnit()->error(ast->firstToken(),
"using-directive not within namespace or block scope");
return false; return false;
} }