[Issue 18097] [REG2.077] Unittest function is undefined identifier
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Dec 22 20:14:00 UTC 2017
https://issues.dlang.org/show_bug.cgi?id=18097
Atila Neves <atila.neves at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |atila.neves at gmail.com
--- Comment #1 from Atila Neves <atila.neves at gmail.com> ---
It's probably due to using an "old" identifier. With the change you mentioned
that introduced the bug, I had to set an identifier for the unittest functions
before semantic analysis. I didn't understand why, but tests failed and all
hell broke loose. I think I do now.
Basically there's no scope when the `UnitTestDeclaration` is created, and then
when semantic analysis happens the scope is there and a number counting the
unittests is added to the name. The only reason for this is to account for the
pathological case where a user defines two unittests on the same line, which is
unlikely to happen but can.
And that's the reason the 1st unittest has to be present for the bug to take
effect - before semantic analysis the final digits after the last underscore
are all `0`. After, they change. A (horrible, awful) workaround for now is to
change
auto c = &__unittest_dummy_d_3_2; //dlang 2.077
to
auto c = &__unittest_dummy_d_3_0; //dlang 2.077
It's not the name of the symbol that gets put into the object file, but it's
the name dmd thinks it has at that point.
--
More information about the Digitalmars-d-bugs
mailing list