www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14209] New: Duplicate Comdat with extern(C++)

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

          Issue ID: 14209
           Summary: Duplicate Comdat with extern(C++)
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Severity: normal
          Priority: P1
         Component: DMD
          Assignee: nobody puremagic.com
          Reporter: code benjamin-thaut.de

The following code produces a duplicate comdat linker error on windows x64

template Signature(T)
{
  alias Signature = typeof(T.init);
}

struct ezDelegate(T)
{
  extern(C++) static DispatchDFunction()
  {
  }

};

extern(C++) void Test1(ezDelegate!(Signature!(void function())) )
{
}

int main()
{
  ezDelegate!(Signature!(void function())) test;
  return 0;
}

The error message is:
// fatal error LNK1179: invalid or corrupt file: duplicate COMDAT
'?DispatchDFunction ?$ezDelegate P6AXXZ  SAXXZ'

Removing any of the "exern(C++)" or the "typeof" will avoid the problem.

--
Feb 20 2015