Bug 16477 – Template not properly instantiated / emitted

Status
RESOLVED
Resolution
DUPLICATE
Severity
blocker
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-09-08T11:52:15Z
Last change time
2017-12-09T00:11:00Z
Assigned to
No Owner
Creator
Johannes Pfau

Comments

Comment #0 by johannespfau — 2016-09-08T11:52:15Z
Reduced from the std.experimental.color code: https://github.com/dlang/phobos/pull/2845 Commands to cause the error: # Simulate phobos library build process dmd std/experimental/color/rgb.d std/experimental/color/lab.d std/experimental/color/package.d std/experimental/normint.d -lib -ofcolor.a # Simulate single module unittest for code coverage dmd -main -unittest std/experimental/color/lab.d color.a Output: lab.o: In function `_D3std12experimental7normint21__T13NormalizedIntTtZ13NormalizedInt11__xopEqualsFKxS3std12experimental7normint21__T13NormalizedIntTtZ13NormalizedIntKxS3std12experimental7normint21__T13NormalizedIntTtZ13NormalizedIntZb': __main.d:(.text._D3std12experimental7normint21__T13NormalizedIntTtZ13NormalizedInt11__xopEqualsFKxS3std12experimental7normint21__T13NormalizedIntTtZ13NormalizedIntKxS3std12experimental7normint21__T13NormalizedIntTtZ13NormalizedIntZb+0xe): undefined reference to `_D3std12experimental7normint21__T13NormalizedIntTtZ13NormalizedInt8opEqualsMxFNaNbNiNfS3std12experimental7normint21__T13NormalizedIntTtZ13NormalizedIntZb' Sources: std/experimental/color/lab.d: ----------------------------------------- import std.experimental.normint; ----------------------------------------- std/experimental/color/package.d: ----------------------------------------- module std.experimental.color; import std.experimental.color.rgb; enum aliceBlue = RGB!(ubyte)(); ----------------------------------------- std/experimental/color/rgb.d: ----------------------------------------- module std.experimental.color.rgb; import std.experimental.normint; import std.typecons ; struct RGB(ComponentType_) { alias ComponentType = NormalizedInt!ComponentType_; enum components_ = "rgba"; template Components(string components) { enum Components = ComponentType.stringof ~ ' ' ~ components[0] ~ ";\n" ; } mixin(Components!components_); @property tristimulus() { return tuple(r); } unittest { // test linear conversion alias lRGBA = RGB!(ushort); } } ----------------------------------------- std/experimental/normint.d: ----------------------------------------- module std.experimental.normint; import std.experimental.color; struct NormalizedInt(I) { bool opEquals(NormalizedInt) const { return true; } } -----------------------------------------
Comment #1 by timothee.cour2 — 2017-12-08T00:53:31Z
just ran into this as well. This is a blocker for running single module unittests
Comment #2 by timothee.cour2 — 2017-12-09T00:11:00Z
*** This issue has been marked as a duplicate of issue 18049 ***