mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
Bug 449099 - IllegalArgumentException: waldo is not a member of A
This commit is contained in:
parent
c28c3c5aab
commit
653d74eceb
3 changed files with 36 additions and 28 deletions
|
@ -414,7 +414,7 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
testData = TestSourceReader.getContentsForTest(b, "parser", IndexBindingResolutionTestBase.this.getClass(), getName(), 2);
|
||||
|
||||
if (testData.length < 2)
|
||||
return;
|
||||
fail("Insufficient test data");
|
||||
IFile file = TestSourceReader.createFile(cproject.getProject(), new Path("header.h"), testData[0].toString());
|
||||
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
|
||||
waitForIndexer(cproject);
|
||||
|
@ -500,6 +500,8 @@ public abstract class IndexBindingResolutionTestBase extends BaseTestCase {
|
|||
Bundle b = CTestPlugin.getDefault().getBundle();
|
||||
testData = TestSourceReader.getContentsForTest(b, "parser", IndexBindingResolutionTestBase.this.getClass(), getName(), 2);
|
||||
|
||||
if (testData.length < 2)
|
||||
fail("Insufficient test data");
|
||||
IFile file = TestSourceReader.createFile(cproject.getProject(), new Path("header.h"), testData[0].toString());
|
||||
CCorePlugin.getIndexManager().setIndexerId(cproject, IPDOMManager.ID_FAST_INDEXER);
|
||||
waitForIndexer(cproject);
|
||||
|
|
|
@ -1854,12 +1854,21 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
|||
//
|
||||
// struct test {
|
||||
// // These lambdas have the class 'test' as their owner.
|
||||
// test(function f = [](int c){ return c; });
|
||||
// function member = [](int c){ return c; };
|
||||
// test(function f = [](int c) { return c; });
|
||||
// function member = [](int c) { return c; };
|
||||
// };
|
||||
|
||||
// int z;
|
||||
public void testLambdaOwnedByClass() throws Exception {
|
||||
public void testLambdaOwnedByClass_409882() throws Exception {
|
||||
checkBindings();
|
||||
}
|
||||
|
||||
// struct A {
|
||||
// auto a = [](int p) { int waldo = p; return waldo; };
|
||||
// };
|
||||
|
||||
// // No code in this file.
|
||||
public void testLambdaOwnedByClass_449099() throws Exception {
|
||||
checkBindings();
|
||||
}
|
||||
|
||||
|
|
|
@ -2614,36 +2614,33 @@ public class CPPVisitor extends ASTQueries {
|
|||
|
||||
boolean isFriend= isFriendDeclaration(node);
|
||||
|
||||
// Search for enclosing binding
|
||||
IASTName name= null;
|
||||
node= node.getParent();
|
||||
for (; node != null; node= node.getParent()) {
|
||||
// Search for enclosing binding.
|
||||
for (node= node.getParent(); node != null; node= node.getParent()) {
|
||||
if (node instanceof IASTFunctionDefinition) {
|
||||
if (!allowFunction)
|
||||
return null;
|
||||
|
||||
if (allowFunction) {
|
||||
IASTDeclarator dtor= findInnermostDeclarator(((IASTFunctionDefinition) node).getDeclarator());
|
||||
if (dtor != null) {
|
||||
name= dtor.getName();
|
||||
return dtor.getName();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
if (node instanceof IASTCompositeTypeSpecifier) {
|
||||
if (isFriend || isNonSimpleElabDecl)
|
||||
continue;
|
||||
name= ((IASTCompositeTypeSpecifier) node).getName();
|
||||
break;
|
||||
return ((IASTCompositeTypeSpecifier) node).getName();
|
||||
}
|
||||
if (node instanceof ICPPASTNamespaceDefinition) {
|
||||
name= ((ICPPASTNamespaceDefinition) node).getName();
|
||||
break;
|
||||
return ((ICPPASTNamespaceDefinition) node).getName();
|
||||
}
|
||||
if (node instanceof ICPPASTEnumerationSpecifier) {
|
||||
name= ((ICPPASTEnumerationSpecifier) node).getName();
|
||||
break;
|
||||
return ((ICPPASTEnumerationSpecifier) node).getName();
|
||||
}
|
||||
if (node instanceof ICPPASTLambdaExpression) {
|
||||
return ((ICPPASTLambdaExpression) node).getClosureTypeName();
|
||||
}
|
||||
}
|
||||
return name;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean doesNotSpecifyType(IASTDeclSpecifier declspec) {
|
||||
|
|
Loading…
Add table
Reference in a new issue