Bug 18111 – unittests get different names depending on how the files are passed to dmd
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2017-12-22T02:03:23Z
Last change time
2018-01-16T04:41:37Z
Assigned to
No Owner
Creator
Atila Neves
Comments
Comment #0 by atila.neves — 2017-12-22T02:03:23Z
/tmp/foo.d:
void _() {
import dir1.dir2.bar;
pragma(msg, __traits(getUnitTests, dir1.dir2.bar));
}
/tmp/dir1/dir2/bar.d:
module dir1.dir2.bar;
unittest { }
void _() { pragma(msg, __traits(getUnitTests, dir1.dir2.bar)); }
When compiling foo.d:
/tmp % dmd -c -unittest foo.d
tuple(__unittest_dir1_dir2_bar_d_2_0)
When compiling bar.d:
/tmp % dmd -c -unittest /tmp/dir1/dir2/bar.d
tuple(__unittest__tmp_dir1_dir2_bar_d_2_0)
The symbol names don't match and a linker error ensues. This prevents __traits(getUnittests) from being used in certain separate compilation scenarios.
Comment #1 by github-bugzilla — 2018-01-08T15:46:36Z