[clang] 9061928 - Stop accepting 'bool' in a concept declaration as an extension.

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 28 10:22:59 PST 2022


Author: Erich Keane
Date: 2022-11-28T10:22:54-08:00
New Revision: 9061928ebbb1a9d002583ede2700429100305d6a

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

LOG: Stop accepting 'bool' in a concept declaration as an extension.

We no longer support the concepts-ts flag for this release, so stop
supporting this concepts-ts compat extension as well.

Added: 
    

Modified: 
    clang/docs/ReleaseNotes.rst
    clang/include/clang/Basic/DiagnosticParseKinds.td
    clang/lib/Parse/ParseTemplate.cpp
    clang/test/Parser/cxx2a-concept-declaration.cpp

Removed: 
    


################################################################################
diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index e9280cac12ff2..ab7334e483282 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -401,6 +401,8 @@ Improvements to Clang's diagnostics
   PCH or modules. When Clang hits this limit, it now produces notes mentioning
   which header and source files are consuming large amounts of this space.
   ``#pragma clang __debug sloc_usage`` can also be used to request this report.
+- Clang no longer permits the keyword 'bool' in a concept declaration as a
+  concepts-ts compatibility extension.
 
 Non-comprehensive list of changes in this release
 -------------------------------------------------

diff  --git a/clang/include/clang/Basic/DiagnosticParseKinds.td b/clang/include/clang/Basic/DiagnosticParseKinds.td
index ffbc859162270..79035b4de163f 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -1633,9 +1633,8 @@ def warn_deprecated_for_co_await : Warning<
 let CategoryName = "Concepts Issue" in {
 def err_concept_definition_not_identifier : Error<
   "name defined in concept definition must be an identifier">;
-def ext_concept_legacy_bool_keyword : ExtWarn<
-  "ISO C++20 does not permit the 'bool' keyword after 'concept'">,
-  InGroup<DiagGroup<"concepts-ts-compat">>;
+def err_concept_legacy_bool_keyword : Error<
+  "ISO C++ does not permit the 'bool' keyword after 'concept'">;
 def err_placeholder_expected_auto_or_decltype_auto : Error<
   "expected 'auto' or 'decltype(auto)' after concept name">;
 }

diff  --git a/clang/lib/Parse/ParseTemplate.cpp b/clang/lib/Parse/ParseTemplate.cpp
index 03f5d0b5a5f1c..a93edfa29664e 100644
--- a/clang/lib/Parse/ParseTemplate.cpp
+++ b/clang/lib/Parse/ParseTemplate.cpp
@@ -392,7 +392,7 @@ Parser::ParseConceptDefinition(const ParsedTemplateInfo &TemplateInfo,
 
   SourceLocation BoolKWLoc;
   if (TryConsumeToken(tok::kw_bool, BoolKWLoc))
-    Diag(Tok.getLocation(), diag::ext_concept_legacy_bool_keyword) <<
+    Diag(Tok.getLocation(), diag::err_concept_legacy_bool_keyword) <<
         FixItHint::CreateRemoval(SourceLocation(BoolKWLoc));
 
   DiagnoseAndSkipCXX11Attributes();

diff  --git a/clang/test/Parser/cxx2a-concept-declaration.cpp b/clang/test/Parser/cxx2a-concept-declaration.cpp
index 25c44122d7f82..0a7af847112de 100644
--- a/clang/test/Parser/cxx2a-concept-declaration.cpp
+++ b/clang/test/Parser/cxx2a-concept-declaration.cpp
@@ -50,7 +50,7 @@ template <bool word> concept C6 = integral_constant<bool, wor>::value;
 // expected-note at -2{{'word' declared here}}
 
 template<typename T> concept bool C7 = true;
-// expected-warning at -1{{ISO C++20 does not permit the 'bool' keyword after 'concept'}}
+// expected-error at -1{{ISO C++ does not permit the 'bool' keyword after 'concept'}}
 
 template<> concept C8 = false;
 // expected-error at -1{{concept template parameter list must have at least one parameter; explicit specialization of concepts is not allowed}}


        


More information about the cfe-commits mailing list