[Issue 18097] New: [REG2.077] Unittest function is undefined identifier
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Dec 17 20:06:01 UTC 2017
https://issues.dlang.org/show_bug.cgi?id=18097
Issue ID: 18097
Summary: [REG2.077] Unittest function is undefined identifier
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: johanengelen at weka.io
Pre 2.077, this code worked:
```
unittest // first unittest
{
}
unittest // second unittest
{
auto a = &mixin(__traits(identifier, __traits(parent, { })));
auto b = &__traits(parent, { });
//auto c = &__unittestL3_2; // dlang 2.076
//auto c = &__unittest_dummy_d_3_2; //dlang 2.077
}
```
The purpose of the code is to obtain the address of the unittest function.
Either `a` or `b` work, and directly naming the unittest function also works
(`c`).
With 2.077, we get the error:
```
dummy.d-mixin-5(5): Error: undefined identifier __unittest_dummy_d_3_1, did you
mean function __unittest_dummy_d_3_1?
```
This regression was probably introduced by
https://github.com/dlang/dmd/pull/6727 , where the symbol name of unittest
function is set during semantic analysis probably too late for this identifier
resolution?
Note: the first unittest is needed to trigger the bug.
--
More information about the Digitalmars-d-bugs
mailing list