[Issue 18244] Generic functions in std.math cannot be overloaded

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 18 07:55:31 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18244

--- Comment #6 from github-bugzilla at puremagic.com ---
Commits pushed to master at https://github.com/dlang/phobos

https://github.com/dlang/phobos/commit/113579ec6be26777198a2e13abe9913226a385e6
Fix issue 18244: Generic functions in std.math need to have proper sig
constraints.

Not having any sig constraints causes needless conflicts with
user-defined numerical types, e.g.:

````
// myNumber.d
module myNumber;
struct MyNumber { ... }
int signbit(T : MyNumber)(T num) { ... }

// usercode.d
import myNumber;
import std.math;
MyNumber num;
auto x = signbit(num); // tries to call std.math.signbit, and fails
````

Add sig constraints to:

* signbit
* isFinite.
* isNormal.
* isSubnormal
* sgn.
* nextafter.

https://github.com/dlang/phobos/commit/e4da79f10f52b1a9cae1143c28b8b3b520efaa10
Merge pull request #6040 from quickfur/signbit_sig

Issue 18244: std.math generic functions need to have sig constraints
merged-on-behalf-of: Sebastian Wilzbach <sebi.wilzbach at gmail.com>

--


More information about the Digitalmars-d-bugs mailing list