[Issue 18880] [REG2.079] Miscompilation of unittests when two are mixed-in on one line
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat May 19 22:19:42 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=18880
--- Comment #2 from johanengelen at weka.io ---
Things are worse:
```
static foreach(s; ["666", "777"]) {
mixin(genTest(s));
}
int i;
string genTest(string a)
{
return "unittest { i += " ~ a ~ "; }";
}
void main()
{
assert(i == 0 + 666 + 666);
}
```
Thus: the exact source location is not necessarily unique and so an extra
uniqueness factor is needed to generate the unittest function names. (note:
must still be deterministic across separate compilations!)
--
More information about the Digitalmars-d-bugs
mailing list