Previously, a warning that C++20 deprecated implicit capture of 'this' for lambda captures specified with a capture default of '=' was only issued when '-Wdeprecated' or '-Wdeprecated-this-capture' was specified. This change enables the warning by default (it is still only issued when compiling for C++20 or later). This is consistent with gcc which warns by default (MSVC requires '/Wall'). Reviewed By: erichkeane, shafik Differential Revision: https://reviews.llvm.org/D142639
15 lines
458 B
C++
15 lines
458 B
C++
// RUN: %clang_cc1 -std=c++11 -verify=cxx11 %s
|
|
// RUN: %clang_cc1 -std=c++2a -verify=cxx2a %s
|
|
// RUN: %clang_cc1 -std=c++2a -verify=cxx2a-no-deprecated %s -Wno-deprecated
|
|
// cxx11-no-diagnostics
|
|
// cxx2a-no-deprecated-no-diagnostics
|
|
|
|
struct A {
|
|
int i;
|
|
void f() {
|
|
(void) [=] { // cxx2a-note {{add an explicit capture of 'this'}}
|
|
return i; // cxx2a-warning {{implicit capture of 'this' with a capture default of '=' is deprecated}}
|
|
};
|
|
}
|
|
};
|