is it regression?
drug
drug2004 at bk.ru
Wed Feb 28 13:16:54 UTC 2018
https://run.dlang.io/is/HJxtvw
```
import std.stdio, std.typecons, std.math;
void main()
{
auto foo = nullable(2.0);
auto bar = nullable(2.0);
assert (foo.approxEqual(bar));
}
```
Comiling gives the following:
Up to 2.067.1: Failure with output:
-----
onlineapp.d(4): Error: undefined identifier nullable, did you mean
struct Nullable(T)?
onlineapp.d(5): Error: undefined identifier nullable, did you mean
struct Nullable(T)?
-----
2.068.2 to 2.072.2: Failure with output:
-----
onlineapp.d(4): Error: undefined identifier 'nullable', did you mean
struct 'Nullable(T)'?
onlineapp.d(5): Error: undefined identifier 'nullable', did you mean
struct 'Nullable(T)'?
-----
2.073.2 to 2.077.1: Success and no output
Since 2.078.1: Failure with output:
-----
/path/to/dmd.linux/dmd2/linux/bin64/../../src/phobos/std/math.d(7575):
Error: template std.math.approxEqual cannot deduce function from
argument types !()(Nullable!double, Nullable!double, double, double),
candidates are:
/path/to/dmd.linux/dmd2/linux/bin64/../../src/phobos/std/math.d(7499):
std.math.approxEqual(T, U, V)(T lhs, U rhs, V maxRelDiff, V
maxAbsDiff = 1e-05) if ((isNumeric!T || isInputRange!T &&
isNumeric!(ElementType!T)) && (isNumeric!U || isInputRange!U &&
isNumeric!(ElementType!U)) && isNumeric!V)
/path/to/dmd.linux/dmd2/linux/bin64/../../src/phobos/std/math.d(7573):
std.math.approxEqual(T, U)(T lhs, U rhs)
onlineapp.d(7): Error: template instance
std.math.approxEqual!(Nullable!double, Nullable!double) error instantiating
-----
tldr - std.math.approxEqual stops deduced its args type when Nullable is
used.
More information about the Digitalmars-d-learn
mailing list