diff options
Diffstat (limited to 'src/plugins/cpptools/cppchecksymbols.cpp')
| -rw-r--r-- | src/plugins/cpptools/cppchecksymbols.cpp | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/plugins/cpptools/cppchecksymbols.cpp b/src/plugins/cpptools/cppchecksymbols.cpp index dfba5f9c99..d4cc6b7b59 100644 --- a/src/plugins/cpptools/cppchecksymbols.cpp +++ b/src/plugins/cpptools/cppchecksymbols.cpp @@ -408,6 +408,14 @@ Scope *CheckSymbols::enclosingScope() const if (funDef->symbol) return funDef->symbol; + } else if (TemplateDeclarationAST *templateDeclaration = ast->asTemplateDeclaration()) { + if (DeclarationAST *decl = templateDeclaration->declaration) { + if (FunctionDefinitionAST *funDef = decl->asFunctionDefinition()) { + if (funDef->symbol) + return funDef->symbol; + } + } + } else if (CompoundStatementAST *blockStmt = ast->asCompoundStatement()) { if (blockStmt->symbol) return blockStmt->symbol; @@ -869,7 +877,12 @@ ClassOrNamespace *CheckSymbols::checkNestedName(QualifiedNameAST *ast) const Name *name = class_or_namespace_name->name; binding = _context.lookupType(name, enclosingScope()); - addType(binding, class_or_namespace_name); + if (binding) + addType(binding, class_or_namespace_name); + else + // for the case when we use template parameter as qualifier + // e.g.: template <typename T> void fun() { T::type type; } + accept(nested_name_specifier->class_or_namespace_name); for (it = it->next; it; it = it->next) { NestedNameSpecifierAST *nested_name_specifier = it->value; |
