mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Lookup in class scope for template ids, bug 294904.
This commit is contained in:
parent
c3d24bd1b4
commit
688c9b4aac
2 changed files with 16 additions and 2 deletions
|
@ -7688,5 +7688,16 @@ public class AST2CPPTests extends AST2BaseTest {
|
||||||
final String code = getAboveComment();
|
final String code = getAboveComment();
|
||||||
parseAndCheckBindings(code, ParserLanguage.CPP);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -322,6 +322,11 @@ public class LookupData {
|
||||||
|
|
||||||
boolean inInitializer= false;
|
boolean inInitializer= false;
|
||||||
IASTNode parent = name.getParent();
|
IASTNode parent = name.getParent();
|
||||||
|
while (parent instanceof IASTName) {
|
||||||
|
name= (IASTName) parent;
|
||||||
|
parent= name.getParent();
|
||||||
|
}
|
||||||
|
|
||||||
while (parent != null && !(parent instanceof IASTFunctionDefinition)) {
|
while (parent != null && !(parent instanceof IASTFunctionDefinition)) {
|
||||||
if (parent instanceof IASTInitializer) {
|
if (parent instanceof IASTInitializer) {
|
||||||
inInitializer= true;
|
inInitializer= true;
|
||||||
|
@ -342,8 +347,6 @@ public class LookupData {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
ASTNodeProperty prop = name.getPropertyInParent();
|
ASTNodeProperty prop = name.getPropertyInParent();
|
||||||
if (prop == ICPPASTQualifiedName.SEGMENT_NAME)
|
|
||||||
prop = name.getParent().getPropertyInParent();
|
|
||||||
if (prop == IASTIdExpression.ID_NAME ||
|
if (prop == IASTIdExpression.ID_NAME ||
|
||||||
prop == IASTFieldReference.FIELD_NAME ||
|
prop == IASTFieldReference.FIELD_NAME ||
|
||||||
prop == ICASTFieldDesignator.FIELD_NAME ||
|
prop == ICASTFieldDesignator.FIELD_NAME ||
|
||||||
|
|
Loading…
Add table
Reference in a new issue