[clang] [clang] Add test for CWG1341 (PR #67965)

Vlad Serebrennikov via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 2 03:18:39 PDT 2023


https://github.com/Endilll created https://github.com/llvm/llvm-project/pull/67965

https://cplusplus.github.io/CWG/issues/1341.html
https://wg21.link/p0683r1

>From 92fec6fe49de0392596e7f7d4a1c5524dd436747 Mon Sep 17 00:00:00 2001
From: Vlad Serebrennikov <serebrennikov.vladislav at gmail.com>
Date: Mon, 2 Oct 2023 13:17:40 +0300
Subject: [PATCH] [clang] Add test for CWG1341

---
 clang/test/CXX/drs/dr13xx.cpp | 17 +++++++++++++++++
 clang/www/cxx_dr_status.html  |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/clang/test/CXX/drs/dr13xx.cpp b/clang/test/CXX/drs/dr13xx.cpp
index feaf523c44fc27c..3510695954e27c1 100644
--- a/clang/test/CXX/drs/dr13xx.cpp
+++ b/clang/test/CXX/drs/dr13xx.cpp
@@ -254,6 +254,23 @@ namespace dr1330 { // dr1330: 4 c++11
 #endif
 }
 
+namespace dr1341 { // dr1341: sup P0683R1
+#if __cplusplus >= 202002L
+int a;
+const int b = 0; // #dr1341-b-decl
+struct S {
+  int x1 : 8 = 42;
+  int x2 : 8 { 42 };
+  int y1 : true ? 8 : a = 42;
+  int y2 : true ? 8 : b = 42;
+  // expected-error at -1            {{cannot assign to variable 'b' with const-qualified type 'const int'}}
+  // expected-note@#dr1341-b-decl {{variable 'b' declared const here}}
+  int y3 : (true ? 8 : b) = 42;
+  int z : 1 || new int { 0 };
+};
+#endif
+}
+
 namespace dr1346 { // dr1346: 3.5
   auto a(1); // expected-error 0-1{{extension}}
   auto b(1, 2); // expected-error {{multiple expressions}} expected-error 0-1{{extension}}
diff --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index ee9712e9bab9949..6b351a3eb72f3d1 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -7853,7 +7853,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td><a href="https://cplusplus.github.io/CWG/issues/1341.html">1341</a></td>
     <td>NAD</td>
     <td>Bit-field initializers</td>
-    <td class="none" align="center">Unknown</td>
+    <td class="na" align="center">Superseded by <a href="https://wg21.link/P0683R1">P0683R1</a></td>
   </tr>
   <tr id="1342">
     <td><a href="https://cplusplus.github.io/CWG/issues/1342.html">1342</a></td>



More information about the cfe-commits mailing list