C++: Fix instantiation of typedefed type in block

Use-case:
template<typename T>
struct Temp { T t; };

struct Foo { int bar; };

void func()
{
    typedef Foo *pointer;
    Temp<pointer> temp;
    temp.t->bar; // bar not highlighted
}

Task-number: QTCREATORBUG-14351
Change-Id: I13ca6145a0069bbc7a7207f69b43011c69ec72c7
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Orgad Shaneh
2015-04-24 09:29:27 +03:00
committed by Orgad Shaneh
parent ad4cb444fb
commit 6a9bd957cb
2 changed files with 1 additions and 5 deletions

View File

@@ -993,7 +993,7 @@ LookupScope *LookupScope::lookupType(const Name *name, Block *block)
= nestedBlock->d->lookupType_helper(name,
&processed,
/*searchInEnclosingScope = */ true,
d)) {
nestedBlock->d)) {
return foundInNestedBlock;
}
}
@@ -1339,9 +1339,6 @@ LookupScopePrivate *LookupScopePrivate::nestedType(const Name *name, LookupScope
_alreadyConsideredTemplates.insert(templId);
LookupScopePrivate *instantiation = baseTemplateClassReference->allocateChild(templId);
while (!origin->_symbols.isEmpty() && origin->_symbols[0]->isBlock())
origin = origin->_parent;
instantiation->_instantiationOrigin = origin;
// The instantiation should have all symbols, enums, and usings from the reference.

View File

@@ -1204,7 +1204,6 @@ void tst_CheckSymbols::findField()
Use use = tc.findUse(line, column);
QEXPECT_FAIL("pointer_indirect_specialization_typedef", "QTCREATORBUG-14141", Abort);
QEXPECT_FAIL("pointer_indirect_specialization_double_indirection", "QTCREATORBUG-14141", Abort);
QEXPECT_FAIL("instantiation_of_pointer_typedef_in_block", "QTCREATORBUG-14141", Abort);
QEXPECT_FAIL("pointer_indirect_specialization_double_indirection_with_base", "QTCREATORBUG-14141", Abort);
QEXPECT_FAIL("recursive_instantiation_of_template_type", "QTCREATORBUG-14237", Abort);
QVERIFY(use.isValid());