http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.announce&artnum=12529
New bug introduced in 2.016 (2.015, 2.013 are ok)
$ ../dmd-v2.016/bin/dmd -c staticif.d
staticif.d(27): Error: no property 'f' for type 'staticif.AA'
staticif.d(27): Error: function expected before (), not 1 of type int
staticif.d(28): Error: no property 'f' for type 'staticif.BB'
staticif.d(28): Error: function expected before (), not 1 of type int
$ cat staticif.d
class A {
}
class B {
}
template T(X) {
static if (is(typeof(X) : A) ||
is(typeof(X) : B) ) {
void f() {
}
}
}
class AA {
mixin T!(A);
}
class BB {
mixin T!(B);
}
int main() {
AA a = new AA();
BB b = new BB();
a.f();
b.f();
return 0;
}
Comment #1 by shro8822 — 2008-07-09T15:31:35Z
Invalid
I think. typeof(X) where X is a type just became invalid code and invalid code in an is results in false.
Comment #2 by 2korden — 2008-07-09T17:17:11Z
Just replace typeof(X) with X, it should fix your code.
Comment #3 by bugzilla — 2008-07-10T05:13:29Z
Invalid because the argument to typeof must be an expression, not a type.