[Issue 18111] New: unittests get different names depending on how the files are passed to dmd

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Dec 22 02:03:23 UTC 2017


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

          Issue ID: 18111
           Summary: unittests get different names depending on how the
                    files are passed to dmd
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: atila.neves at gmail.com

/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.

--


More information about the Digitalmars-d-bugs mailing list