Skip to content

Commit

Permalink
Update __cpp_concepts macro (#87998)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
erichkeane committed Apr 9, 2024
1 parent d022f6b commit 2875e24
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 15 deletions.
4 changes: 4 additions & 0 deletions clang/docs/ReleaseNotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ C++20 Feature Support
templates (`P1814R0 <https://wg21.link/p1814r0>`_).
(#GH54051).

- We have sufficient confidence and experience with the concepts implementation
to update the ``__cpp_concepts`` macro to `202002L`. This enables
``<expected>`` from libstdc++ to work correctly with Clang.

C++23 Feature Support
^^^^^^^^^^^^^^^^^^^^^

Expand Down
5 changes: 1 addition & 4 deletions clang/lib/Frontend/InitPreprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Lexer/cxx-features.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
12 changes: 2 additions & 10 deletions clang/www/cxx_status.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 2875e24

Please sign in to comment.