diff options
author | Roberto Raggi <roberto.raggi@nokia.com> | 2009-02-19 13:52:05 +0100 |
---|---|---|
committer | Roberto Raggi <roberto.raggi@nokia.com> | 2009-02-19 13:52:05 +0100 |
commit | 6178a44fc20411235b5403d867e69dfadb2852f5 (patch) | |
tree | f93c755d8ff6557bc1ec44d18d67cc8cfc527f9d /src/shared/cplusplus/CheckDeclaration.cpp | |
parent | 7e10664e6adf34a3280eb765feaad5e36213c9d1 (diff) | |
download | qt-creator-6178a44fc20411235b5403d867e69dfadb2852f5.tar.gz |
Warning for using-directive in class scope.
Diffstat (limited to 'src/shared/cplusplus/CheckDeclaration.cpp')
-rw-r--r-- | src/shared/cplusplus/CheckDeclaration.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/shared/cplusplus/CheckDeclaration.cpp b/src/shared/cplusplus/CheckDeclaration.cpp index f8ddde8b48..038583c27d 100644 --- a/src/shared/cplusplus/CheckDeclaration.cpp +++ b/src/shared/cplusplus/CheckDeclaration.cpp @@ -389,6 +389,11 @@ bool CheckDeclaration::visit(UsingDirectiveAST *ast) UsingNamespaceDirective *u = control()->newUsingNamespaceDirective(ast->firstToken(), name); ast->symbol = u; _scope->enterSymbol(u); + + if (! (_scope->isBlockScope() || _scope->isNamespaceScope())) + translationUnit()->error(ast->firstToken(), + "using-directive not within namespace or block scope"); + return false; } |