Compiler gets confused with ambiguity when `int` matches both `real` and `float`.

IM 3di at gm.com
Sat Dec 23 07:25:34 UTC 2017


The following expression:

import std.math : sqrt;
sqrt(400);

produces the following compiler error:

std.math.sqrt called with argument types (int) matches both:
/usr/include/dmd/phobos/std/math.d(1592,7):     
std.math.sqrt(float x)
and:
/usr/include/dmd/phobos/std/math.d(1598,6):     
std.math.sqrt(real x)

Shouldn't it just pick one according to some defined rules?





More information about the Digitalmars-d-learn mailing list