1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-19 23:15:24 +02:00

Bug 519819 - Correctly classify unknown member binding as an unknown member class when it appears in a nested-name-specifier

Change-Id: I2d153e8676403709d4d674d3dcead6896ff9cafe
This commit is contained in:
Nathan Ridge 2017-07-18 18:13:15 -04:00
parent 862cf70fa3
commit 10ef1f11b0
2 changed files with 21 additions and 1 deletions

View file

@ -10328,4 +10328,21 @@ public class AST2TemplateTests extends AST2CPPTestBase {
// Check that the TypeOfDependentExpression instantiated to the correct type.
helper.assertVariableValue("waldo", 42);
}
// template <class>
// struct A {
// template <class>
// struct B {
// enum { val = 0 };
// };
// };
//
// template <class X>
// struct C {
// struct D : A<X> {};
// enum { val = D::template B<X>::val };
// };
public void testMemberOfUnknownMemberClass_519819() throws Exception {
parseAndCheckBindings();
}
}

View file

@ -498,10 +498,13 @@ public class CPPSemantics {
name= (ICPPASTTemplateId) nameParent;
nameParent= name.getParent();
}
boolean isNestedNameSpecifier = false;
if (nameParent instanceof ICPPASTQualifiedName) {
if (name == ((ICPPASTQualifiedName) nameParent).getLastName()) {
name= (IASTName) nameParent;
nameParent= name.getParent();
} else {
isNestedNameSpecifier = true;
}
}
@ -509,7 +512,7 @@ public class CPPSemantics {
// binding.
final ASTNodeProperty namePropertyInParent = name.getPropertyInParent();
if (binding == null && data.skippedScope != null) {
if (namePropertyInParent == IASTNamedTypeSpecifier.NAME) {
if (isNestedNameSpecifier || namePropertyInParent == IASTNamedTypeSpecifier.NAME) {
binding= new CPPUnknownMemberClass(data.skippedScope, name.getSimpleID());
} else if (data.isFunctionCall()) {
binding= new CPPUnknownMethod(data.skippedScope, name.getSimpleID());