If "struct Relative" is defined at the outer of doTest(), everything is OK.
Here are the test codes:
=====================================
import std.stdio;
void doTest()
{
struct Relative
{
int xBase;
int xDir;
// This method causes a compiler internal error
void MoveTo()
{
}
}
Relative rel = {1, 2};
}
int main(string[] args)
{
return 0;
}
=====================================
Comment #1 by yebblies — 2011-07-14T07:44:22Z
This fails for both kinds of struct initializers, Struct(...) and {...}.
Workaround is to use a static struct and pass the context as needed.
Thanks for reducing this!