Dear all,

I am writing template constraints for different numeric types:

```
import std.stdio: writeln;
import std.traits: isIntegral, isNumeric;


T test(T)(T x, T y)
if(is(T: double) && isNumeric!T)
{
        return x*y;
}


auto test(T)(T x, T y)
if(!is(T: double) && isNumeric!T)
{
        return 5*test!double(x, y);
}


void main()
{
        int x = 2;
        double y = 2.0;
        writeln("int test: ", test(x, x));
        writeln("double test: ", test(y, y));
}
```

returns:

```
int test: 4
double test: 4
```

The same issue occurs when I try using template specializations instead. Explanations and suggestions please.

Thank you!

Compiler details:
$ dmd --version
DMD64 D Compiler v2.074.1
Copyright (c) 1999-2017 by Digital Mars written by Walter Bright

Reply via email to