Skip to content

Commit 14ed120

Browse files
AaronBallmantru
authored andcommitted
No longer issue static lambda pedantic warning for pre-c++2b compat
We were accidentally issuing "static lambdas are incompatible with C++ standards before C++2b" with -pedantic because it was an ExtWarn diagnostic rather than a Warning. This corrects the diagnostic category and adds some test coverage. Fixes #61582 (cherry picked from commit b904e68)
1 parent 32b8cc7 commit 14ed120

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -779,8 +779,8 @@ Bug Fixes to Attribute Support
779779
Bug Fixes to C++ Support
780780
^^^^^^^^^^^^^^^^^^^^^^^^
781781
- No longer issue a pre-C++2b compatibility warning in ``-pedantic`` mode
782-
regading overloaded `operator[]` with more than one parmeter. (`#61582
783-
<https://github.com/llvm/llvm-project/issues/61582>`_)
782+
regading overloaded `operator[]` with more than one parmeter or for static
783+
lambdas. (`#61582 <https://github.com/llvm/llvm-project/issues/61582>`_)
784784

785785
- Address the thread identification problems in coroutines.
786786
(`#47177 <https://github.com/llvm/llvm-project/issues/47177>`_,

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ def err_lambda_template_parameter_list_empty : Error<
10521052
// C++2b static lambdas
10531053
def err_static_lambda: ExtWarn<
10541054
"static lambdas are a C++2b extension">, InGroup<CXX2b>;
1055-
def warn_cxx20_compat_static_lambda: ExtWarn<
1055+
def warn_cxx20_compat_static_lambda : Warning<
10561056
"static lambdas are incompatible with C++ standards before C++2b">,
10571057
InGroup<CXXPre2bCompat>, DefaultIgnore;
10581058
def err_static_mutable_lambda : Error<

clang/test/Parser/cxx2b-lambdas-ext-warns.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %clang_cc1 -std=c++20 %s -verify=cxx20
22
// RUN: %clang_cc1 -std=c++2b %s -verify=cxx2b
33
// RUN: %clang_cc1 -std=c++2b -Wpre-c++2b-compat %s -verify=precxx2b
4+
// RUN: %clang_cc1 -std=c++2b -pedantic %s -verify=cxx2b
45

56
//cxx2b-no-diagnostics
67

0 commit comments

Comments
 (0)