mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Bug 494182 - Lambda in default member initializer
Change-Id: I92bbfaff34a08952d3f17f6a9b982a10d4e2bf03
This commit is contained in:
parent
abcedff7d7
commit
e6ed5e4037
2 changed files with 20 additions and 0 deletions
|
@ -9572,6 +9572,18 @@ public class AST2CPPTests extends AST2TestBase {
|
|||
public void testLambdaExpression_316307b() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// struct function {
|
||||
// template <typename T>
|
||||
// function(T);
|
||||
// };
|
||||
// struct S {
|
||||
// void waldo();
|
||||
// function f = [this](){ waldo(); };
|
||||
// };
|
||||
public void testLambdaInDefaultMemberInitializer_494182() throws Exception {
|
||||
parseAndCheckBindings();
|
||||
}
|
||||
|
||||
// typedef int MyType;
|
||||
//
|
||||
|
|
|
@ -2378,6 +2378,14 @@ public class CPPVisitor extends ASTQueries {
|
|||
break;
|
||||
if (node.getParent() instanceof IASTFunctionDefinition)
|
||||
break;
|
||||
} else if (scope instanceof ICPPClassScope) {
|
||||
// Reached a class scope without a function scope in between.
|
||||
// Might be in the default member initializer on a field.
|
||||
IType type = ((ICPPClassScope) scope).getClassType();
|
||||
if (type instanceof ICPPClassTemplate) {
|
||||
type= (ICPPClassType) ((ICPPClassTemplate) type).asDeferredInstance();
|
||||
}
|
||||
return type;
|
||||
}
|
||||
scope = scope.getParent();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue