summaryrefslogtreecommitdiff
path: root/test/SemaCXX/cxx2a-lambda-equals-this.cpp
blob: ce6916322e5d1c797356f901a4f394ddb557241c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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();
  }
};