Mercurial > hg > CbC > CbC_llvm
view clang/test/SemaCXX/cxx2a-lambda-equals-this.cpp @ 221:79ff65ed7e25
LLVM12 Original
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 15 Jun 2021 19:15:29 +0900 |
parents | 1d019706d866 |
children | 1f2b6ac9f198 |
line wrap: on
line source
// RUN: %clang_cc1 -std=c++2a -verify %s -Wdeprecated // 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(); } }; struct B { int i; void f() { (void) [=] { // expected-note {{add an explicit capture of 'this'}} return i; // expected-warning {{implicit capture of 'this' with a capture default of '=' is deprecated}} }; } };