www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 13043] New: Redundant linking to TypeInfo in non-root module


          Issue ID: 13043
           Summary: Redundant linking to TypeInfo in non-root module
           Product: D
           Version: D2
          Hardware: x86
                OS: Windows
            Status: NEW
          Keywords: link-failure
          Severity: major
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: k.hara.pg gmail.com

In below test case, 'y' is non-root module, and typeid(Inner) is completely
unneeded for the 'test' module compilation. But with -g -inline -version=bug,
it is unnecessarily referenced and fail to link.

module test;
import y;
void main() {}

module y;
struct QualifiedNameTests
    struct Inner
        const int opCmp(ref const Inner) { return 0; }

    shared(const(Inner[string])[]) data;

    size_t toHash() const
        return typeid(typeof(data)).getHash(cast(const void*)&data);

Command line:
dmd -version=bug -g -inline test.d

 Error 42: Symbol Undefined

Jul 04 2014