[Issue 18287] several std.math functions no longer work with alias this
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jan 23 19:21:22 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18287
--- Comment #1 from hsteoh at quickfur.ath.cx ---
Has signbit() ever worked with alias this types? I tried commenting out the
new sig constraint of signbit(), but this code still fails to compile on git
master:
--------
struct Proxy {
double f;
alias f this;
}
auto p = Proxy(1.61803);
auto sign = signbit(p);
--------
The compiler says:
---------
std/math.d(267): Error: cannot implicitly convert expression 4.50360e+15 of
type double to Proxy
std/math.d(5762): Error: template instance std.math.floatTraits!(Proxy) error
instantiating
std/math.d(5806): instantiated from here: signbit!(Proxy)
--------
This is caused by signbit() attempting to instantiate floatTraits with Proxy,
but floatTraits does not take alias this into account.
(Not that it *shouldn't* work with alias this, but just that it doesn't seem to
have worked before. Or perhaps that only broke after floatTraits was
introduced?)
--
More information about the Digitalmars-d-bugs
mailing list