[clang] 7608c5f - [clang][NFC] Mark CWG2629 as implemented and add a test (#195490)

via cfe-commits cfe-commits at lists.llvm.org
Sun May 3 13:21:28 PDT 2026


Author: Victor Chernyakin
Date: 2026-05-03T13:21:24-07:00
New Revision: 7608c5f25b270968f4122957b8a8df6a53764608

URL: https://github.com/llvm/llvm-project/commit/7608c5f25b270968f4122957b8a8df6a53764608
DIFF: https://github.com/llvm/llvm-project/commit/7608c5f25b270968f4122957b8a8df6a53764608.diff

LOG: [clang][NFC] Mark CWG2629 as implemented and add a test (#195490)

This is ill-formed:
```cpp
switch (0.0) {}
```
Before [CWG2629](https://wg21.link/cwg2629) though, this was allowed:
```cpp
switch (double d = 0.0) {} // Value of 'd' is implicitly converted to an integer
```
Clang however has always rejected both: https://godbolt.org/z/GYc4hhrnz

Added: 
    

Modified: 
    clang/test/CXX/drs/cwg26xx.cpp
    clang/www/cxx_dr_status.html

Removed: 
    


################################################################################
diff  --git a/clang/test/CXX/drs/cwg26xx.cpp b/clang/test/CXX/drs/cwg26xx.cpp
index 5fe409a3b2905..27ad8c0636a50 100644
--- a/clang/test/CXX/drs/cwg26xx.cpp
+++ b/clang/test/CXX/drs/cwg26xx.cpp
@@ -148,6 +148,13 @@ void f() {
 #endif
 } // namespace cwg2628
 
+namespace cwg2629 { // cwg2629: 2.7
+void f() {
+  switch (double d = 0.0) {}
+  // expected-error at -1 {{statement requires expression of integer type ('double' invalid)}}
+}
+} // namespace cwg2629
+
 // cwg2630 is in cwg2630.cpp
 
 namespace cwg2631 { // cwg2631: 16

diff  --git a/clang/www/cxx_dr_status.html b/clang/www/cxx_dr_status.html
index feef0c3770f64..cc290eabd943b 100755
--- a/clang/www/cxx_dr_status.html
+++ b/clang/www/cxx_dr_status.html
@@ -18208,7 +18208,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
     <td>[<a href="https://wg21.link/stmt.switch">stmt.switch</a>]</td>
     <td>C++23</td>
     <td>Variables of floating-point type as <TT>switch</TT> conditions</td>
-    <td class="unknown" align="center">Unknown</td>
+    <td class="full" align="center">Clang 2.7</td>
   </tr>
   <tr id="2630">
     <td><a href="https://cplusplus.github.io/CWG/issues/2630.html">2630</a></td>


        


More information about the cfe-commits mailing list