[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / SemaCXX / lambda-implicit-this-capture.cpp
blobeb1f9e880aec0f42bff911458f43843baab12510
1 // RUN: %clang_cc1 -std=c++03 -verify=cxx11 %s -Wno-c++11-extensions
2 // RUN: %clang_cc1 -std=c++11 -verify=cxx11 %s
3 // RUN: %clang_cc1 -std=c++2a -verify=cxx2a %s
4 // RUN: %clang_cc1 -std=c++2a -verify=cxx2a-no-deprecated %s -Wno-deprecated
5 // cxx11-no-diagnostics
6 // cxx2a-no-deprecated-no-diagnostics
8 struct A {
9 int i;
10 void f() {
11 (void) [=] { // cxx2a-note {{add an explicit capture of 'this'}}
12 return i; // cxx2a-warning {{implicit capture of 'this' with a capture default of '=' is deprecated}}