[clang] [clang][docs] Reflect the implementation status for P2280R4 (PR #127166)
A. Jiang via cfe-commits
cfe-commits at lists.llvm.org
Fri Mar 14 06:57:23 PDT 2025
https://github.com/frederick-vs-ja updated https://github.com/llvm/llvm-project/pull/127166
>From a2fc3d0550ab22e1a4273dc2debfda23df7cad6f Mon Sep 17 00:00:00 2001
From: "A. Jiang" <de34 at live.cn>
Date: Fri, 14 Feb 2025 14:03:23 +0800
Subject: [PATCH 1/4] [clang][docs] Fix DR staus for P2280R4
P2280R4 is officially a defect report. Although Clang 20 only implementated it
for C++23 and later. I think we should mention that it is a DR but not backported yet.
---
clang/www/cxx_status.html | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index 0fc3b1d314698..70490b2e4331f 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -439,8 +439,8 @@ <h2 id="cxx23">C++23 implementation status</h2>
</tr>
<tr>
<td>Using unknown pointers and references in constant expressions</td>
- <td><a href="https://wg21.link/P2280R4">P2280R4</a></td>
- <td class="unreleased" align="center">Clang 20</td>
+ <td><a href="https://wg21.link/P2280R4">P2280R4</a> (<a href="#dr">DR</a>)</td>
+ <td class="unreleased" align="center">Clang 20 <a href="#p2280">(12)</a></td>
</tr>
<tr>
<td>static <code>operator()</code></td>
@@ -510,6 +510,12 @@ <h2 id="cxx23">C++23 implementation status</h2>
<td class="full" align="center">Yes</td>
</tr>
</table>
+
+<p>
+<span id="p2280">(12): In Clang 20, this change is not yet retroactively
+applied to pre-C++23 modes.
+</span>
+</p>
</details>
>From cc9eac55a7a9fc6faf4f7d2eb623710ac1afbe43 Mon Sep 17 00:00:00 2001
From: "A. Jiang" <de34 at live.cn>
Date: Fri, 14 Feb 2025 18:37:16 +0800
Subject: [PATCH 2/4] Adopt @Endilll's suggestion
Co-authored-by: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
---
clang/www/cxx_status.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index 70490b2e4331f..0ac625d547935 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -512,7 +512,7 @@ <h2 id="cxx23">C++23 implementation status</h2>
</table>
<p>
-<span id="p2280">(12): In Clang 20, this change is not yet retroactively
+<span id="p2280">(12): This feature is not yet available in C++20 and earlier modes.
applied to pre-C++23 modes.
</span>
</p>
>From 8ae351b5c70ca8279b44963727b0e741ca83d0cb Mon Sep 17 00:00:00 2001
From: "A. Jiang" <de34 at live.cn>
Date: Tue, 4 Mar 2025 20:09:35 +0800
Subject: [PATCH 3/4] Fix bad application of suggestion
---
clang/www/cxx_status.html | 1 -
1 file changed, 1 deletion(-)
diff --git a/clang/www/cxx_status.html b/clang/www/cxx_status.html
index eb6eacc58caf5..4b1718f51391a 100755
--- a/clang/www/cxx_status.html
+++ b/clang/www/cxx_status.html
@@ -549,7 +549,6 @@ <h2 id="cxx23">C++23 implementation status</h2>
<p>
<span id="p2280">(12): This feature is not yet available in C++20 and earlier modes.
-applied to pre-C++23 modes.
</span>
</p>
</details>
>From 20adf1b4ad4fef1dd2a3d445a31691294604db02 Mon Sep 17 00:00:00 2001
From: "A. Jiang" <de34 at live.cn>
Date: Fri, 14 Mar 2025 21:57:07 +0800
Subject: [PATCH 4/4] Add FIXME comments
---
clang/test/SemaCXX/constant-expression-cxx11.cpp | 4 ++--
clang/test/SemaCXX/constant-expression-p2280r4.cpp | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/clang/test/SemaCXX/constant-expression-cxx11.cpp b/clang/test/SemaCXX/constant-expression-cxx11.cpp
index c35f3a5632a05..df789a999c0b6 100644
--- a/clang/test/SemaCXX/constant-expression-cxx11.cpp
+++ b/clang/test/SemaCXX/constant-expression-cxx11.cpp
@@ -2005,7 +2005,7 @@ namespace ConstexprConstructorRecovery {
constexpr X x{}; // cxx11-error {{constant expression}} cxx11-note {{not initialized}}
}
-namespace Lifetime {
+namespace Lifetime { // FIXME: Fix the error messages quality regression introduced by GH95474.
void f() {
constexpr int &n = n; // expected-error {{constant expression}} cxx23-note {{reference to 'n' is not a constant expression}} cxx23-note {{address of non-static constexpr variable 'n' may differ}} expected-warning {{not yet bound to a value}}
// cxx11_20-note at -1 {{use of reference outside its lifetime is not allowed in a constant expression}}
@@ -2421,7 +2421,7 @@ namespace PR41854 {
unsigned b = d.c;
}
-namespace array_size {
+namespace array_size { // FIXME: P2280R4 should be backported, and these cases should be accepted in C++11 and later.
template<int N> struct array {
static constexpr int size() { return N; }
};
diff --git a/clang/test/SemaCXX/constant-expression-p2280r4.cpp b/clang/test/SemaCXX/constant-expression-p2280r4.cpp
index f22430a0e88a2..c88e625b8bb33 100644
--- a/clang/test/SemaCXX/constant-expression-p2280r4.cpp
+++ b/clang/test/SemaCXX/constant-expression-p2280r4.cpp
@@ -1,6 +1,8 @@
// RUN: %clang_cc1 -std=c++23 -verify=expected,nointerpreter %s
// RUN: %clang_cc1 -std=c++23 -verify %s -fexperimental-new-constant-interpreter
+// FIXME: P2280R4 should be backported. Run this in C++11 and later modes.
+
using size_t = decltype(sizeof(0));
namespace std {
More information about the cfe-commits
mailing list