https://issues.dlang.org/show_bug.cgi?id=18774
--- Comment #6 from Jonathan M Davis <[email protected]> --- (In reply to Manu from comment #5) > I think you've missed my point, there is NO REFERENCE to Zip!().init in > main.d, at least, there shouldn't be... so why the link error? > Where is the reference coming from? You imported test.di. test.di references Zip!().init, and it references it when creating the function that you're calling from main.d. So, it's being used when generating main.d even if main.d doesn't use it directly. I'd guess that the problem relates to that. It's likely inserting the symbol when it imports test.di. I don't see what else the problem could be. Also, remember that you're actually generating template instantations with that code. It's not just referencing existing code like it would with a normal function. Template instantations don't live with the module that they come from in the same way that other functions do, because they can't, since they're not compiled with the module. I'd guess that that's part of the problem and that it results in the template instantiations being inserted into the resultant binary. Curiously, if I compile your example on FreeBSD (with clang as the C/C++ compiler, though I think that it's actually using GNU's linker), I only get an undefined reference for `_D4test9test_funcFiiZv', so it appears that the problem with Zip may be system-dependent. Maybe one linker ignores it because it isn't used directly in main.d, and the other doesn't? I don't know. Certainly, the fact that it appears to differ from system to system doesn't give me a warm, fuzzy feeling. --
