<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/123231>123231</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Erroneous "use of infinity" warning
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang:diagnostics
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
ahatanak
</td>
</tr>
</table>
<pre>
clang incorrectly emits a warning when a method called infinity is called.
$ cat test.cpp
```
double infinity() { return 0; }
int main() {
return infinity();
}
```
$ clang++ -ffast-math test.cpp -c
test.cpp:4:11: warning: use of infinity is undefined behavior due to the currently enabled floating-point options [-Wnan-infinity-disabled]
4 | return infinity();
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJx8Us1utDgQfJrm0mLkHzyEAwdms_MKe25wA9419sg2ifL2KyYzyZfv8Ektgdpd5apyU85uCcw9mAuY14r2ssbU00qFAv1XjdF-9JOnsKALU0yJp-I_kDdXMhK-UwouLPi-ckDCjcsaLU7kPVt0YXbBlQ90-dE6gRiOUg1OVLBwLqfpdjtaZ_EoMdi4j56_4KBeQHUI7QUTlz0FFKAvCO3rJ5sLBTdy4XsOxID4HP5JA_o4fWB_ufOp6nAK6gLqgvU8Uy71RmX9Uor1BGL40q2HBvQgJejhGcXxu2fGOP_wvwfLswtsceSV3lxMaHfGErGsjNOeEod7sIHGI7vZRyouLPUtHv7irbgYMoK51P8ECvWTu7Yu3xFgXj9tY4PQ_oV_CKCyvbad7qjiXra6FaY1pqvWnjvqhDDUMKlz82LH8zwKTVoI08p5HivXK6GMkPIsO9PJ7tSYeT5LaV4mtue2kdAI3sj5k_dv2ymmpXI579xLpZWWlaeRfb7vmlKfWevBOlpCzMVNGZQ6ljD1B7we9yVDI7zLJX8TFlc893-nFAPHPSMo9VveoNTzNao9-X4t5ZZBD6CuoK6LK-s-nqa4gboerI9PfUvxX54KqOtdcwZ1fch-69X_AQAA__-Xlf-D">