[Issue 4328] templated unittests fail to link when instantiated from other file if compiler order isn't correct
http://d.puremagic.com/issues/show_bug.cgi?id=4328 Rainer Schuetze r.sagita...@gmx.de changed: What|Removed |Added CC||r.sagita...@gmx.de --- Comment #1 from Rainer Schuetze r.sagita...@gmx.de 2010-08-27 08:15:20 PDT --- even worse: the link fails if the template is in a library and the library is not compiled with unittests: import std.stdio; void main() { writef(\n); } dmd -unittest test.d OPTLINK (R) for Win32 Release 8.00.2 Copyright (C) Digital Mars 1989-2009 All rights reserved. http://www.digitalmars.com/ctg/optlink.html test.obj(test) Error 42: Symbol Undefined _D3std6format15__unittest_failFiZv --- errorlevel 1 Strangely, the relased phobos.lib is compiled with unittests, while the makefile does not pass -unittest. So this does only show up when I compile the runtime library myself. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---
[Issue 4328] templated unittests fail to link when instantiated from other file if compiler order isn't correct
http://d.puremagic.com/issues/show_bug.cgi?id=4328 --- Comment #2 from Rainer Schuetze r.sagita...@gmx.de 2010-08-27 08:39:32 PDT --- Here's a workaround: similar to the assert handling, generate the unittest_fail function whenever there is a template in the module: Index: template.c === --- template.c(revision 632) +++ template.c(working copy) @@ -429,6 +429,13 @@ sc-module-toModuleAssert(); } +if (/*global.params.useUnitTests */ sc-module) +{ +// Generate this function as it may be used +// when template is instantiated in other modules +sc-module-toModuleUnittest(); +} + /* Remember Scope for later instantiations, but make * a copy since attributes can change. */ -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email --- You are receiving this mail because: ---