Bug 14209 – Duplicate Comdat with extern(C++)

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Windows
Creation time
2015-02-20T17:13:00Z
Last change time
2015-02-21T12:20:59Z
Assigned to
code
Creator
code

Comments

Comment #0 by code — 2015-02-20T17:13:32Z
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.