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.
Comment #1 by code — 2015-02-21T12:20:08Z
The real problem is that ezDelegate gets instanciated twice. once with extern(C++) void() and once with void() resulting in two temmpalte instanciations which output the same C++ symbol. So this is not a bug.