Skip to content

Commit ef59534

Browse files
committed
Add a test case with nested lambda
1 parent 45f751e commit ef59534

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

clang/test/SemaSYCL/lambda_implicit_capture_this.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,18 @@ void Class::function() {
7878
h.single_task<class CapturedOnHost1>([Lambda]() {
7979
});
8080
});
81+
auto InnerLambda = [=]() {
82+
int A = 2 + member; // expected-error {{implicit capture of 'this' is not allowed for kernel functions}}
83+
};
84+
auto ExternalLambda = [=]() {
85+
InnerLambda();
86+
};
87+
q.submit([&](handler &h) {
88+
// expected-note@+1 {{in instantiation of function template specialization}}
89+
h.single_task<class CapturedOnHost2>([=]() {
90+
NestedLambda();
91+
});
92+
});
8193
}
8294

8395
int main(int argc, char *argv[]) {

0 commit comments

Comments
 (0)