mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-03-28 14:56:28 +01:00
Issue #254: Constructors of inner classes not resolved properly
- add test case to reproduce #254 - add special case to detect constructors which were declared in the index file set of the tu
This commit is contained in:
parent
34f1736317
commit
22ee440b88
2 changed files with 25 additions and 1 deletions
|
@ -1397,4 +1397,21 @@ public abstract class IndexCPPBindingResolutionBugsTest extends IndexBindingReso
|
|||
ast = workingCopy.getAST(strategy.getIndex(), ITranslationUnit.AST_SKIP_INDEXED_HEADERS);
|
||||
checkBindings(ast);
|
||||
}
|
||||
|
||||
// struct MyClass {
|
||||
// MyClass();
|
||||
// struct MyInnerClass;
|
||||
// };
|
||||
|
||||
// struct MyClass::MyInnerClass {
|
||||
// MyInnerClass(bool a, bool b) {
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// MyClass::MyClass() {
|
||||
// new MyInnerClass(true, true);
|
||||
// }
|
||||
public void testIssue_254() throws Exception {
|
||||
checkBindings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2125,7 +2125,14 @@ public class CPPSemantics {
|
|||
}
|
||||
IASTTranslationUnit tu = node.getTranslationUnit();
|
||||
IIndexFileSet indexFileSet = tu.getIndexFileSet();
|
||||
return (indexFileSet != null && indexFileSet.containsDeclaration(indexBinding));
|
||||
if (indexFileSet != null && indexFileSet.containsDeclaration(indexBinding)) {
|
||||
return true;
|
||||
} else if (indexBinding instanceof ICPPConstructor) {
|
||||
IIndexFileSet astFileSet = tu.getASTFileSet();
|
||||
return astFileSet != null && astFileSet.containsDeclaration(indexBinding);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return pointOfDecl < pointOfRef;
|
||||
|
|
Loading…
Add table
Reference in a new issue