Skip to content

Commit 2875e24

Browse files
authored
Update __cpp_concepts macro (#87998)
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.
1 parent d022f6b commit 2875e24

File tree

4 files changed

+8
-15
lines changed

4 files changed

+8
-15
lines changed

clang/docs/ReleaseNotes.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ C++20 Feature Support
110110
templates (`P1814R0 <https://wg21.link/p1814r0>`_).
111111
(#GH54051).
112112

113+
- We have sufficient confidence and experience with the concepts implementation
114+
to update the ``__cpp_concepts`` macro to `202002L`. This enables
115+
``<expected>`` from libstdc++ to work correctly with Clang.
116+
113117
C++23 Feature Support
114118
^^^^^^^^^^^^^^^^^^^^^
115119

clang/lib/Frontend/InitPreprocessor.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -720,10 +720,7 @@ static void InitializeCPlusPlusFeatureTestMacros(const LangOptions &LangOpts,
720720
if (LangOpts.CPlusPlus20) {
721721
Builder.defineMacro("__cpp_aggregate_paren_init", "201902L");
722722

723-
// P0848 is implemented, but we're still waiting for other concepts
724-
// issues to be addressed before bumping __cpp_concepts up to 202002L.
725-
// Refer to the discussion of this at https://reviews.llvm.org/D128619.
726-
Builder.defineMacro("__cpp_concepts", "201907L");
723+
Builder.defineMacro("__cpp_concepts", "202002");
727724
Builder.defineMacro("__cpp_conditional_explicit", "201806L");
728725
Builder.defineMacro("__cpp_consteval", "202211L");
729726
Builder.defineMacro("__cpp_constexpr_dynamic_alloc", "201907L");

clang/test/Lexer/cxx-features.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
#error "wrong value for __cpp_char8_t"
8686
#endif
8787

88-
#if check(concepts, 0, 0, 0, 0, 201907, 201907, 201907)
88+
#if check(concepts, 0, 0, 0, 0, 202002, 202002, 202002)
8989
#error "wrong value for __cpp_concepts"
9090
#endif
9191

clang/www/cxx_status.html

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -544,16 +544,8 @@ <h2 id="cxx20">C++20 implementation status</h2>
544544
</tr>
545545
<tr> <!-- from Cologne -->
546546
<td><a href="https://wg21.link/p0848r3">P0848R3</a></td>
547-
<td rowspan="1" class="partial" align="center">
548-
<details>
549-
<summary>Clang 16 (Partial)</summary>
550-
Because of other concepts implementation deficits, the __cpp_concepts macro is not yet set to 202002L.
551-
Also, the related defect reports <a href="https://wg21.link/cwg1496">DR1496</a> and
552-
<a href="https://wg21.link/cwg1734">DR1734</a> are not yet implemented. Accordingly, deleted
553-
special member functions are treated as eligible even though they shouldn't be.
554-
</details>
555-
</td>
556-
</tr>
547+
<td rowspan="1" class="full" align="center">Clang 19</td>
548+
</tr>
557549
<tr>
558550
<td><a href="https://wg21.link/p1616r1">P1616R1</a></td>
559551
<td rowspan="2" class="full" align="center">Clang 10</td>

0 commit comments

Comments
 (0)