mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 19:25:38 +02:00
Bug 409882 - Visibility of lambda with class owner
Change-Id: Ia16221cb441de535cad0b22786e2878e084fca3d Signed-off-by: Nathan Ridge <zeratul976@hotmail.com> Reviewed-on: https://git.eclipse.org/r/26783 Tested-by: Hudson CI Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
This commit is contained in:
parent
10f84fd94b
commit
17900f3f59
2 changed files with 23 additions and 0 deletions
|
@ -1834,4 +1834,20 @@ public abstract class IndexCPPBindingResolutionTest extends IndexBindingResoluti
|
|||
IVariable waldo = getBindingFromASTName("waldo", 5);
|
||||
assertEquals(42, waldo.getInitialValue().numericalValue().longValue());
|
||||
}
|
||||
|
||||
// struct function {
|
||||
// template <typename T>
|
||||
// function(T);
|
||||
// };
|
||||
//
|
||||
// struct test {
|
||||
// // These lambdas have the class 'test' as their owner.
|
||||
// test(function f = [](int c){ return c; });
|
||||
// function member = [](int c){ return c; };
|
||||
// };
|
||||
|
||||
// int z;
|
||||
public void testLambdaOwnedByClass() throws Exception {
|
||||
checkBindings();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -902,6 +902,13 @@ public class ClassTypeHelper {
|
|||
}
|
||||
}
|
||||
|
||||
// The concept of visibility does not apply to a lambda, which can end
|
||||
// up having a class as its owner if they are used in the initializer
|
||||
// of a field or a member function parameter.
|
||||
if (member instanceof CPPClosureType) {
|
||||
return ICPPClassType.v_public;
|
||||
}
|
||||
|
||||
ICPPASTCompositeTypeSpecifier classDeclSpec = classType.getCompositeTypeSpecifier();
|
||||
int visibility = getVisibility(classDeclSpec, member);
|
||||
if (visibility >= 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue