[Issue 18868] Separate compilation generates two static this functions, runs it twice

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 19 22:23:34 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18868

--- Comment #2 from johanengelen at weka.io ---
Extra testcase that must be added and considered (currently works):
```
static foreach(s; ["666", "777"]) {
    mixin(genCtor(s));
}

int i;

string genCtor(string a)
{
    return "static this() { i += " ~ a ~ "; }";
}

void main()
{
    assert(i == 0 + 666 + 777);
}
```

--


More information about the Digitalmars-d-bugs mailing list