brintos

brintos / llvm-project-archived public Read only

0
0
Text · 403 B · ce69163 Raw
16 lines · cpp
1// RUN: %clang_cc1 -std=c++2a -verify %s2// expected-no-diagnostics3 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};16