1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Bug 520999 - Map PDOM class types to AST before looking up constructors

Change-Id: Iac865cbde8ed4ba2b002eea0da7d943598d33bc1
This commit is contained in:
Nathan Ridge 2017-08-15 19:54:34 -04:00
parent 30c0a1da7c
commit 33a7f1e533
2 changed files with 21 additions and 0 deletions

View file

@ -2480,4 +2480,19 @@ public class IndexCPPBindingResolutionTest extends IndexBindingResolutionTestBas
public void testSelfReferencingVariable_510484() throws Exception {
checkBindings();
}
// class Foo {
// struct Bar;
// void func();
// };
// struct Foo::Bar {
// Bar(int, int);
// };
// void Foo::func() {
// Bar waldo(0, 0);
// }
public void testNestedClassDefinedOutOfLine_502999() throws Exception {
checkBindings();
}
}

View file

@ -3593,6 +3593,12 @@ public class CPPSemantics {
return null;
if (type instanceof ICPPClassTemplate || type instanceof ICPPUnknownType || type instanceof ISemanticProblem)
return null;
// The class type may be declared in a header but defined in the AST.
// In such a case, we want the constructors as AST bindings (since as
// index bindings they would fail declaredBefore() filtering), so map
// the class type to its AST representation.
type = SemanticUtil.mapToAST(type, name);
return findImplicitlyCalledConstructor((ICPPClassType) type, initializer, name);
}