Faisal Vali | 8194a3e | 2017-08-19 03:43:07 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -std=c++2a -verify %s |
2 | // expected-no-diagnostics | ||||
3 | |||||
4 | // This test does two things. | ||||
5 | // Deleting the copy constructor ensures that an [=, this] capture doesn't copy the object. | ||||
6 | // Accessing a member variable from the lambda ensures that the capture actually works. | ||||
7 | class A { | ||||
8 | A(const A &) = delete; | ||||
9 | int i; | ||||
10 | |||||
11 | void func() { | ||||
12 | auto L = [=, this]() -> int { return i; }; | ||||
13 | L(); | ||||
14 | } | ||||
15 | }; |