[clang] b904e68 - No longer issue static lambda pedantic warning for pre-c++2b compat

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 21 09:49:55 PDT 2023


Author: Aaron Ballman
Date: 2023-03-21T12:49:45-04:00
New Revision: b904e68f13ba7d4f4aa86a3495e2441c99247671

URL: https://github.com/llvm/llvm-project/commit/b904e68f13ba7d4f4aa86a3495e2441c99247671
DIFF: https://github.com/llvm/llvm-project/commit/b904e68f13ba7d4f4aa86a3495e2441c99247671.diff

LOG: 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

Added: 
    

Modified: 
    clang/docs/ReleaseNotes.rst
    clang/include/clang/Basic/DiagnosticParseKinds.td
    clang/test/Parser/cxx2b-lambdas-ext-warns.cpp

Removed: 
    


################################################################################
diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 6ae71683804d4..c0162cf506cbc 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -241,8 +241,8 @@ Bug Fixes to C++ Support
 - Fix incorrect deletion of the default constructor of unions in some
   cases. (`#48416 <https://github.com/llvm/llvm-project/issues/48416>`_)
 - 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>`_)
 
 Bug Fixes to AST Handling
 ^^^^^^^^^^^^^^^^^^^^^^^^^

diff  --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
index 243c69a551650..2ad4d98f0ed88 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -1049,7 +1049,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<

diff  --git a/clang/test/Parser/cxx2b-lambdas-ext-warns.cpp b/clang/test/Parser/cxx2b-lambdas-ext-warns.cpp
index bcb5574a2fe10..3a80f59aba565 100644
--- a/clang/test/Parser/cxx2b-lambdas-ext-warns.cpp
+++ b/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
 


        


More information about the cfe-commits mailing list