diff options
author | Orgad Shaneh <[email protected]> | 2015-05-22 15:39:55 +0300 |
---|---|---|
committer | Orgad Shaneh <[email protected]> | 2015-06-01 16:30:47 +0000 |
commit | 07f8c474be629de75780d235df62a50ae6f27870 (patch) | |
tree | 464595fff1332ebe0fa229a5f4e1fc587cb4f486 /src/plugins/cpptools/cppchecksymbols.cpp | |
parent | a429ef3d50242e871237402a2a70da9b77bb1509 (diff) |
C++: Fix decltype resolving for template function
The last nail for std::unique_ptr (GCC variant, MSVC still doesn't work).
Use-case:
template<typename T>
static T f();
struct Foo { int bar; };
void fun()
{
decltype(f<Foo>()) s;
s.bar; // bar not highlighted
}
Task-number: QTCREATORBUG-14483
Task-number: QTCREATORBUG-8937
Change-Id: I5bab757400b070cf9dbb688a44fd8eafe95ddc61
Reviewed-by: Nikolai Kosjar <[email protected]>
Diffstat (limited to 'src/plugins/cpptools/cppchecksymbols.cpp')
-rw-r--r-- | src/plugins/cpptools/cppchecksymbols.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/plugins/cpptools/cppchecksymbols.cpp b/src/plugins/cpptools/cppchecksymbols.cpp index 860d849e8d2..585c2c16616 100644 --- a/src/plugins/cpptools/cppchecksymbols.cpp +++ b/src/plugins/cpptools/cppchecksymbols.cpp @@ -1300,12 +1300,8 @@ bool CheckSymbols::maybeAddFunction(const QList<LookupItem> &candidates, NameAST isConstructor = isConstructorDeclaration(c); Function *funTy = c->type()->asFunctionType(); - if (!funTy) { - //Try to find a template function - if (Template * t = r.type()->asTemplateType()) - if ((c = t->declaration())) - funTy = c->type()->asFunctionType(); - } + if (!funTy) // Template function has an overridden type + funTy = r.type()->asFunctionType(); if (!funTy) continue; // TODO: add diagnostic messages and color call-operators calls too? |