<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span> changed
<a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - incorrect implementation of isnan and similar functions"
href="https://llvm.org/bugs/show_bug.cgi?id=18218">bug 18218</a>
<br>
<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>What</th>
<th>Removed</th>
<th>Added</th>
</tr>
<tr>
<td style="text-align:right;">Status</td>
<td>RESOLVED
</td>
<td>REOPENED
</td>
</tr>
<tr>
<td style="text-align:right;">CC</td>
<td>
</td>
<td>richard-llvm@metafoo.co.uk
</td>
</tr>
<tr>
<td style="text-align:right;">Resolution</td>
<td>INVALID
</td>
<td>---
</td>
</tr></table>
<p>
<div>
<b><a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - incorrect implementation of isnan and similar functions"
href="https://llvm.org/bugs/show_bug.cgi?id=18218#c8">Comment # 8</a>
on <a class="bz_bug_link
bz_status_REOPENED "
title="REOPENED --- - incorrect implementation of isnan and similar functions"
href="https://llvm.org/bugs/show_bug.cgi?id=18218">bug 18218</a>
from <span class="vcard"><a class="email" href="mailto:richard-llvm@metafoo.co.uk" title="Richard Smith <richard-llvm@metafoo.co.uk>"> <span class="fn">Richard Smith</span></a>
</span></b>
<pre>(In reply to <a href="show_bug.cgi?id=18218#c7">comment #7</a>)
<span class="quote">> The only valid types that can be passed to isnan (and others in
> <cmath>) are arithmetic types; i.e, the built-in integral and floating point
> types. No user-defined types.</span >
That may have been the intent, but I don't see any way to read the standard's
wording that way. From the example in <a href="show_bug.cgi?id=18218#c0">comment#0</a>:
std::isnan(A());
There are no arguments of arithmetic type, so none of the bullets in 26.8/11
apply. The overload set contains 'isnan(float)', 'isnan(double)', and
'isnan(long double)', and 'isnan(float)' should be selected.
To my reading, what paragraph 11 requires is overload sets like this:
template<typename T, typename U>
typename conditional<is_arithmetic<U>::value, T, U>::type
cast_if_arithmetic(U u) { return u; }
template<typename T>
struct is_double_or_integral :
integral_constant<bool, is_arithmetic<T>::value &&
!is_same<T, float>::value &&
!is_same<T, long double>::value> {};
bool isgreater(float, float);
bool isgreater(double, double);
bool isgreater(long double, long double);
// bullet 1
template<typename T, typename U>
typename enable_if<is_same<T, long double>::value ||
is_same<U, long double>::value, bool>::type
isgreater(T t, U u) {
return isgreater(cast_if_arithmetic<long double>(t),
cast_if_arithmetic<long double>(u));
}
// bullet 2
template<typename T, typename U>
typename enable_if<is_double_or_integral<T>::value ||
is_double_or_integral<U>::value, bool>::type
isgreater(T t, U u) {
return isgreater(cast_if_arithmetic<double>(t),
cast_if_arithmetic<double>(u));
}
// bullet 3 requires no overloads: bullets 1 and 2 would have applied
// if there were an arithmetic argument of a type other than float</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>