blob: ce6916322e5d1c797356f901a4f394ddb557241c [file] [log] [blame]
Faisal Vali8194a3e2017-08-19 03:43:07 +00001// 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.
7class A {
8 A(const A &) = delete;
9 int i;
10
11 void func() {
12 auto L = [=, this]() -> int { return i; };
13 L();
14 }
15};