Skip to content

Commit 7608c5f

Browse files
authored
[clang][NFC] Mark CWG2629 as implemented and add a test (llvm#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
1 parent e8a85b2 commit 7608c5f

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

clang/test/CXX/drs/cwg26xx.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,13 @@ void f() {
148148
#endif
149149
} // namespace cwg2628
150150

151+
namespace cwg2629 { // cwg2629: 2.7
152+
void f() {
153+
switch (double d = 0.0) {}
154+
// expected-error@-1 {{statement requires expression of integer type ('double' invalid)}}
155+
}
156+
} // namespace cwg2629
157+
151158
// cwg2630 is in cwg2630.cpp
152159

153160
namespace cwg2631 { // cwg2631: 16

clang/www/cxx_dr_status.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18208,7 +18208,7 @@ <h2 id="cxxdr">C++ defect report implementation status</h2>
1820818208
<td>[<a href="https://wg21.link/stmt.switch">stmt.switch</a>]</td>
1820918209
<td>C++23</td>
1821018210
<td>Variables of floating-point type as <TT>switch</TT> conditions</td>
18211-
<td class="unknown" align="center">Unknown</td>
18211+
<td class="full" align="center">Clang 2.7</td>
1821218212
</tr>
1821318213
<tr id="2630">
1821418214
<td><a href="https://cplusplus.github.io/CWG/issues/2630.html">2630</a></td>

0 commit comments

Comments
 (0)