Hello, I was doing some template nonsense and came across this weird issue. This compiles fine:
struct Foo(string S) {}
bool foo(T)(T it) {
static if (is(T == Foo!S, string S)) {
return true;
} else {
return false;
}
}
void main() {
foo(Foo!"x"());
}
but the below fails with a “undefined identifier 'S'” error!
struct X {
struct Foo(string S) {}
}
bool foo(T)(T it) {
static if (is(T == X.Foo!S, string S)) {
return true;
} else {
return false;
}
}
void main() {
foo(X.Foo!"x"());
}
Am I just doing something obviously wrong, or is this a compiler bug? If so, is there a workaround? Thank you.