Function hijack on selective import
rumbu
rumbu at rumbu.ro
Tue Jan 16 20:49:44 UTC 2018
On Tuesday, 16 January 2018 at 20:30:43 UTC, H. S. Teoh wrote:
> On Tue, Jan 16, 2018 at 07:14:00PM +0000, rumbu via
>>
>> Even specialized, now I have another problem:
>>
>> std.math:
>>
>> int signbit(X)(X x) { ... }
>>
>> mylibrary:
>>
>> int signbit(D: Decimal!bits, int bits) { ... }
>>
>> =============
>>
>> end user:
>>
>> import std.math;
>> import mylibrary;
>>
>> Decimal!32 d;
>> float f;
>>
>> auto y = signbit(f); //ok, call to std.math.signbit
>> auto x = signbit(d); //error, also calls std.math.signbit
>
> Arguably, this is a defect in Phobos. Looking at the
> definition of std.math.signbit, it's obvious that it's only
> meant to handle built-in floating-point types, yet there are no
> sig constraints to that effect.
>
> Fix: https://github.com/dlang/phobos/pull/6040
>
>
> T
Thank you for the pull request, but the list is longer :)
https://issues.dlang.org/show_bug.cgi?id=18244
More information about the Digitalmars-d-learn
mailing list