forked from qt-creator/qt-creator
Warning for using-directive in class scope.
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user