<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/88608>88608</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Don't diagnose an ill-formed global array as being a VLA
</td>
</tr>
<tr>
<th>Labels</th>
<td>
c++,
clang:diagnostics
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Endilll
</td>
</tr>
</table>
<pre>
That's a FIXME Richard left in CWG367 test. I'm making an issue out of it, because DR test suite is moving away from using array sizes as a C++98-compatible context requiring a constant expression. https://godbolt.org/z/bj85KWYcq
```cpp
namespace cwg367 { // cwg367: yes
// FIXME: These diagnostics are terrible. Don't diagnose an ill-formed global
// array as being a VLA!
int a[true ? throw 0 : 4];
// expected-error@-1 {{variable length arrays in C++ are a Clang extension}}
// expected-error@-2 {{variable length array declaration not allowed at file scope}}
int b[true ? 4 : throw 0];
// cxx98-error@-1 {{variable length arrays in C++ are a Clang extension}}
// cxx98-error@-2 {{variable length array folded to constant array as an extension}}
int c[true ? *new int : 4];
// expected-error@-1 {{variable length arrays in C++ are a Clang extension}}
// expected-note@-2 {{read of uninitialized object is not allowed in a constant expression}}
// expected-error@-3 {{variable length array declaration not allowed at file scope}}
int d[true ? 4 : *new int];
// cxx98-error@-1 {{variable length arrays in C++ are a Clang extension}}
// cxx98-error@-2 {{variable length array folded to constant array as an extension}}
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzclcGO2zYQhp-GugxsyJRlSQcd7HVUBG0vQdC0R4ocSUwpUiFHa-8-fUFpt-tut2kuAYoCBGwOyRl-_4yGIgTdW8Sa5SeWnxMx0-B8_c4qbYxJWqce6o-DIMaLAAKa97_-_A4-aDkIr8BgR6At3H36ITsUQBhoC-8ZL0YYxe_a9iAs6BBmBDcTuA40MX4HLUoxB4Tzh-UMhFkTgg4wuvvl1EU8QOfdCHNY5t6LBwj6EQOIeI07xk-Mn6pyI904CdKtQZDOEl4JPH6ZtV_ORVsgYQnwOnkMQTu7hYFoCiw7Mt4w3vROtc7Q1vme8eaR8ab9XOY_fvpNfmHpmaVHdkjXIadptVgxYpiERJCXPpKz4gSrtycLy47wgGHdDs9ri3px6eOAAUFp0VsXSMsAwiMQeh9JtnB2lvGCnnfgoqMxm875ERX0xrXCvHK-iiQCtLiy__LTkfHd8y5tCQTLT-RnBJY1QIN3F0gh3mfP8jPLTq884nVCSag26L3zbJ9udpGUFad74bWImhu0PQ1r7LCUwpqZhUfAnRG2B7wS2ig9K85x_FsU_rUooFAa4QVpZ8E6AmGMu6ACQdBpgxCkm_CvkSJ7e8u-X6ifFHiTXV6vVfl9wN-O8HXozhmFCsi9VPSf-Rb2nxSO3PKWm_Gjxcti_8-k3TrCWwE8ChVbxWy11aSF0Y-owLWfUVLsEbc51_btb_wbCy37HoWm_l5oL7L_X2vt5c9zs0xUnakqq0SC9a7Y8aqqeFkkQy3KvKzyQ1G0u7Y6dAeeK86rtix2XSUPHSa65infp_tdllZpmRbblsu0kunhoNIiz8o926c4Cm22xtyPsW8nyxtTl-UhLRMjWjRhec84l6tSjHPG7-I8asWy403rjWv5OfF19LZp5z6wfWp0oPDinzQZrL-pK7_Zh5PZm_rVs6NpmNutdCPjTQz09LOZvIulznizUAXGmwXsjwAAAP__H8RiQQ">