<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/129429>129429</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Bogus new error on Wparentheses
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
dcb314
</td>
</tr>
</table>
<pre>
For this C++ code:
extern void g( int);
void f( int a, int b, int c)
{
if (a <= b <= c)
{
g( a);
}
}
given to a couple of recent builds of clang, does this:
Alphasrc $ /home/dcb40b/llvm/results.20250221/bin/clang++ -c -g -O2 -Wall mar2b.cc
mar2b.cc:6:13: warning: comparisons like 'X<=Y<=Z' don't have their mathematical meaning [-Wparentheses]
6 | if (a <= b <= c)
| ^
1 warning generated.
Alphasrc $ /home/dcb40b/llvm/results.20250223/bin/clang++ -c -g -O2 -Wall mar2b.cc
mar2b.cc:6:13: error: comparisons like 'X<=Y<=Z' don't have their mathematical meaning [-Wparentheses]
6 | if (a <= b <= c)
| ^
1 error generated.
Alphasrc $
I think it is an error to error on this code and a warning is fine.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzUVE2PtDYM_jXmYs0oODDAgQOzW6Seenzb3kLwQPqGZJSE2fbfVzAfu720UtVLIyQe4Sf-eGyjYjSTY26hPEP5nqk1zT60ox5kXmSDH_9oex8wzSbiG9AZ6IzajwyyA7E9_Hvi4PDmzYgTUI3GJaAG5Plu3w2XhwEV0NsOhifQG1l0UN35jbkgUK0Q5BvIdxye4MkTzYsKotkjqi_xGqjed3fv9_CTubHD5FGh9uvVMvoLBta85bAaO8btg7bKTVtGo-e4F_uqr7PXWcWgEahAoH72CwP1ox4KMQD11t4WoD5wXG2KRxJUCqIcqB-MA-ofrnfhDhoPEx5-Ijx8U9biogINR61BdC8ouxPILpcgO_xQwRk3bVD75aqCid5FtOY7I1D1812aX-6vX4EqHL0DqhLO6saYZjYBF5VmXlQyWllcWG0eEcrz4dtVBXZp5sgRyk0vRMQTQvWGz_MP3fgL98uB8gcQXf4sACd2HFTi8fivFZX_iaIcgg__Xz339P9OzX1kf9wm2H1Hk9BEVO5xLfkH8O6-z9seo3IjqlejTMSLcXzEbGzl2MhGZdzmVSEaUTcksrmtToKaPNeFOIlKN1rqejhxIS-CSlnWVWbavWNSkGiKuhDHU1GPdS6lrAe-KNVAIXhRxh63Rh99mDIT48ptTk1BTWbVwDY-_0eh3ViHYZ0iFMKamOLnvWSS5fbspzWi44_P8r62IluDbeeUrvtOUw_UTybN63DUfvkctz3MNfjfWCegfk8pAvWPrG4t_RkAAP__zpyALg">