diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-12-18 20:11:37 +0000 |
| commit | 461a67fa15370a9ec88f8f8a240bf7c123bb2029 (patch) | |
| tree | 6942083d7d56bba40ec790a453ca58ad3baf6832 /test/SemaCXX/cxx2a-lambda-equals-this.cpp | |
| parent | 75c3240472ba6ac2669ee72ca67eb72d4e2851fc (diff) | |
Notes
Diffstat (limited to 'test/SemaCXX/cxx2a-lambda-equals-this.cpp')
| -rw-r--r-- | test/SemaCXX/cxx2a-lambda-equals-this.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/SemaCXX/cxx2a-lambda-equals-this.cpp b/test/SemaCXX/cxx2a-lambda-equals-this.cpp new file mode 100644 index 000000000000..ce6916322e5d --- /dev/null +++ b/test/SemaCXX/cxx2a-lambda-equals-this.cpp @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -std=c++2a -verify %s +// expected-no-diagnostics + +// This test does two things. +// Deleting the copy constructor ensures that an [=, this] capture doesn't copy the object. +// Accessing a member variable from the lambda ensures that the capture actually works. +class A { + A(const A &) = delete; + int i; + + void func() { + auto L = [=, this]() -> int { return i; }; + L(); + } +}; |
