1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 08:46:02 +02:00

Lookup in class scope for template ids, bug 294904.

This commit is contained in:
Markus Schorn 2009-11-12 18:46:26 +00:00
parent c3d24bd1b4
commit 688c9b4aac
2 changed files with 16 additions and 2 deletions

View file

@ -7688,5 +7688,16 @@ public class AST2CPPTests extends AST2BaseTest {
final String code = getAboveComment();
parseAndCheckBindings(code, ParserLanguage.CPP);
}
// struct A {
// template<typename T> void m() {
// C<T> c;
// }
// template<typename T> struct C {};
// };
public void testLookupInClassScopeForTemplateIDs_294904() throws Exception {
final String code = getAboveComment();
parseAndCheckBindings(code, ParserLanguage.CPP);
}
}

View file

@ -322,6 +322,11 @@ public class LookupData {
boolean inInitializer= false;
IASTNode parent = name.getParent();
while (parent instanceof IASTName) {
name= (IASTName) parent;
parent= name.getParent();
}
while (parent != null && !(parent instanceof IASTFunctionDefinition)) {
if (parent instanceof IASTInitializer) {
inInitializer= true;
@ -342,8 +347,6 @@ public class LookupData {
return false;
ASTNodeProperty prop = name.getPropertyInParent();
if (prop == ICPPASTQualifiedName.SEGMENT_NAME)
prop = name.getParent().getPropertyInParent();
if (prop == IASTIdExpression.ID_NAME ||
prop == IASTFieldReference.FIELD_NAME ||
prop == ICASTFieldDesignator.FIELD_NAME ||