Skip to content

Commit

Permalink
No longer issue static lambda pedantic warning for pre-c++2b compat
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
AaronBallman authored and tru committed Mar 24, 2023
1 parent 32b8cc7 commit 14ed120
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions clang/docs/ReleaseNotes.rst
Expand Up @@ -779,8 +779,8 @@ Bug Fixes to Attribute Support
Bug Fixes to C++ Support
^^^^^^^^^^^^^^^^^^^^^^^^
- No longer issue a pre-C++2b compatibility warning in ``-pedantic`` mode
regading overloaded `operator[]` with more than one parmeter. (`#61582
<https://github.com/llvm/llvm-project/issues/61582>`_)
regading overloaded `operator[]` with more than one parmeter or for static
lambdas. (`#61582 <https://github.com/llvm/llvm-project/issues/61582>`_)

- Address the thread identification problems in coroutines.
(`#47177 <https://github.com/llvm/llvm-project/issues/47177>`_,
Expand Down
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/DiagnosticParseKinds.td
Expand Up @@ -1052,7 +1052,7 @@ def err_lambda_template_parameter_list_empty : Error<
// C++2b static lambdas
def err_static_lambda: ExtWarn<
"static lambdas are a C++2b extension">, InGroup<CXX2b>;
def warn_cxx20_compat_static_lambda: ExtWarn<
def warn_cxx20_compat_static_lambda : Warning<
"static lambdas are incompatible with C++ standards before C++2b">,
InGroup<CXXPre2bCompat>, DefaultIgnore;
def err_static_mutable_lambda : Error<
Expand Down
1 change: 1 addition & 0 deletions clang/test/Parser/cxx2b-lambdas-ext-warns.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -std=c++20 %s -verify=cxx20
// RUN: %clang_cc1 -std=c++2b %s -verify=cxx2b
// RUN: %clang_cc1 -std=c++2b -Wpre-c++2b-compat %s -verify=precxx2b
// RUN: %clang_cc1 -std=c++2b -pedantic %s -verify=cxx2b

//cxx2b-no-diagnostics

Expand Down

0 comments on commit 14ed120

Please sign in to comment.