Comment #0 by matti.niemenmaa+dbugzilla — 2006-11-18T07:06:32Z
A code snippet somewhat modified from what's in the spec:
alias short bar;
void foo(bar x) {
static if (is (bar T : int))
alias T S;
else
alias real S;
static assert (is (S == int));
}
void main() {
bar x;
foo(x);
}
This fails, though according to the spec it should work. What's strange is that replacing the first two lines of foo() with the following works:
static if (is (bar : int))
alias int S;
Disclaimer: I haven't used this (is (Type Identifier)) feature at all, so I'm not 100% sure. But if this isn't meant to work then the example code in the spec is wrong.