Skip to content

Update __cpp_concepts macro #87998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 9, 2024
Merged

Conversation

erichkeane
Copy link
Collaborator

@erichkeane erichkeane commented Apr 8, 2024

After discussion with a few others, and seeing the state of our concepts support, I believe it is worth trying to see if we can update this for Clang19. The forcing function is that libstdc++'s <expected> header is guarded by this macro, so we need to update it to support that.

Closes #57524.

After discussion with a few others, and seeing the state of our concepts
support, I believe it is worth trying to see if we can update this for
Clang19.  The forcing function is that libstdc++'s <expected> header is
guarded by this macro, so we need to update it to support that.
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Apr 8, 2024
@llvmbot
Copy link
Member

llvmbot commented Apr 8, 2024

@llvm/pr-subscribers-clang

Author: Erich Keane (erichkeane)

Changes

After discussion with a few others, and seeing the state of our concepts support, I believe it is worth trying to see if we can update this for Clang19. The forcing function is that libstdc++'s <expected> header is guarded by this macro, so we need to update it to support that.


Full diff: https://github.com/llvm/llvm-project/pull/87998.diff

4 Files Affected:

  • (modified) clang/docs/ReleaseNotes.rst (+5)
  • (modified) clang/lib/Frontend/InitPreprocessor.cpp (+1-4)
  • (modified) clang/test/Lexer/cxx-features.cpp (+1-1)
  • (modified) clang/www/cxx_status.html (+2-10)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 28e8ddb3c41c3e..4f02459ca1f09f 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -110,6 +110,11 @@ C++20 Feature Support
   templates (`P1814R0 <https://wg21.link/p1814r0>`_).
   (#GH54051).
 
+- __cpp_concepts macro now updated to `202002L`, as we are confident that,
+  modulo a handful of bugs and core issues, that our concepts implementation is
+  sufficient. This should enable libstdc++'s `<expected>` to work correctly in
+  clang.
+
 C++23 Feature Support
 ^^^^^^^^^^^^^^^^^^^^^
 
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 48ad92063bd461..84069e96f41464 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -720,10 +720,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
   if (LangOpts.CPlusPlus20) {
     Builder.defineMacro("__cpp_aggregate_paren_init", "201902L");
 
-    // P0848 is implemented, but we're still waiting for other concepts
-    // issues to be addressed before bumping __cpp_concepts up to 202002L.
-    // Refer to the discussion of this at https://reviews.llvm.org/D128619.
-    Builder.defineMacro("__cpp_concepts", "201907L");
+    Builder.defineMacro("__cpp_concepts", "202002");
     Builder.defineMacro("__cpp_conditional_explicit", "201806L");
     Builder.defineMacro("__cpp_consteval", "202211L");
     Builder.defineMacro("__cpp_constexpr_dynamic_alloc", "201907L");
diff --git a/clang/test/Lexer/cxx-features.cpp b/clang/test/Lexer/cxx-features.cpp
index 9496746c6fd663..1de32498cd345b 100644
--- a/clang/test/Lexer/cxx-features.cpp
+++ b/clang/test/Lexer/cxx-features.cpp
@@ -85,7 +85,7 @@
 #error "wrong value for __cpp_char8_t"
 #endif
 
-#if check(concepts, 0, 0, 0, 0, 201907, 201907, 201907)
+#if check(concepts, 0, 0, 0, 0, 202002, 202002, 202002)
 #error "wrong value for __cpp_concepts"
 #endif
 
diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index c1d95dadbb27e2..130148c7420fa1 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -544,16 +544,8 @@ <h2 id="cxx20">C++20 implementation status</h2>
       </tr>
       <tr> <!-- from Cologne -->
         <td><a href="https://wg21.link/p0848r3">P0848R3</a></td>
-        <td rowspan="1" class="partial" align="center">
-          <details>
-            <summary>Clang 16 (Partial)</summary>
-            Because of other concepts implementation deficits, the __cpp_concepts macro is not yet set to 202002L.
-            Also, the related defect reports <a href="https://wg21.link/cwg1496">DR1496</a> and
-            <a href="https://wg21.link/cwg1734">DR1734</a> are not yet implemented. Accordingly, deleted
-            special member functions are treated as eligible even though they shouldn't be.
-          </details>
-        </td>
-        </tr>
+        <td rowspan="1" class="full" align="center">Clang 19</td>
+      </tr>
       <tr>
         <td><a href="https://wg21.link/p1616r1">P1616R1</a></td>
         <td rowspan="2" class="full" align="center">Clang 10</td>

Comment on lines -551 to -553
Also, the related defect reports <a href="https://wg21.link/cwg1496">DR1496</a> and
<a href="https://wg21.link/cwg1734">DR1734</a> are not yet implemented. Accordingly, deleted
special member functions are treated as eligible even though they shouldn't be.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is that not true any more?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those aren't implemented, and that IS true, but it is kind of orthogonal to concepts. Those issues pre-date concepts, and are only somewhat more visible thanks to concepts, but are not 'worse' nor 'caused' by it.

@@ -110,6 +110,11 @@ C++20 Feature Support
templates (`P1814R0 <https://wg21.link/p1814r0>`_).
(#GH54051).

- __cpp_concepts macro now updated to `202002L`, as we are confident that,
modulo a handful of bugs and core issues, that our concepts implementation is
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have fairly large hands concepts C++20 concepts - but i agree doing that early in the 19 cycle makes sense

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, feel free to take or leave my suggestion on the release note.

Comment on lines 113 to 116
- __cpp_concepts macro now updated to `202002L`, as we are confident that,
modulo a handful of bugs and core issues, that our concepts implementation is
sufficient. This should enable libstdc++'s `<expected>` to work correctly in
clang.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- __cpp_concepts macro now updated to `202002L`, as we are confident that,
modulo a handful of bugs and core issues, that our concepts implementation is
sufficient. This should enable libstdc++'s `<expected>` to work correctly in
clang.
- We have sufficient confidence in the concepts implementation to update the
``__cpp_concepts`` macro to `202002L`. This enables ``<expected>`` from
libstdc++ to work correctly with Clang.

??

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

std::variant cannot be used in constexpr functions with non trivially destructible types
4 participants