diff options
Diffstat (limited to 'clang/test/SemaCXX/cxx2a-lambda-equals-this.cpp')
-rw-r--r-- | clang/test/SemaCXX/cxx2a-lambda-equals-this.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/clang/test/SemaCXX/cxx2a-lambda-equals-this.cpp b/clang/test/SemaCXX/cxx2a-lambda-equals-this.cpp index ce6916322e5..652fb8da9b6 100644 --- a/clang/test/SemaCXX/cxx2a-lambda-equals-this.cpp +++ b/clang/test/SemaCXX/cxx2a-lambda-equals-this.cpp @@ -1,5 +1,4 @@ -// RUN: %clang_cc1 -std=c++2a -verify %s -// expected-no-diagnostics +// 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. @@ -13,3 +12,12 @@ class A { 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}} + }; + } +}; |