module vector;
struct vec2(T) {
T x, y;
this(T x, T y) { this.x = x; this.y = y; }
auto opDispatch(string swiz)() pure const {
writeln(swiz);
return 2;
}
}
alias vec2!int vec2i;
import std.stdio;
void main() {
// auto x = new vec2i(1, 2); // error about writeln (inpure function) in pure function
auto x = vec2i(1, 2); // no error, just fails to compile
writeln(x.xy);
}
Comment #1 by daniel350 — 2012-08-15T04:55:41Z
To be clear, an error was expected for both, not just one.
Comment #2 by daniel350 — 2012-09-22T03:24:53Z
*** This issue has been marked as a duplicate of issue 8387 ***