dmd
dmd copied to clipboard
static if declaration leads to nonsense error
// bugrepro1.d
import bugrepro2;
class Foo {
Timer t;
this() {
t = new Timer;
}
}
static if(false)
alias Timer = bugrepro2.Timer;
else
class Timer{}
and
// bugrepro2.d
class Timer {}
build with dmd bugrepo1 (master as well as old version):
bugrepro1.d(7): Error: cannot implicitly convert expression new Timer of type bugrepro1.Timer to bugrepro2.Timer
t = new Timer;
Error disappears if you put the class below the static if, but supposed to be order independent.