http://d.puremagic.com/issues/show_bug.cgi?id=7099

           Summary: static constructor in template mixin in library not
                    executed
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: rob...@octarineparrot.com


--- Comment #0 from Robert Clipsham <rob...@octarineparrot.com> 2011-12-12 
23:08:00 GMT ---
lib.d:
----
import std.stdio;

template T() {
    static this() {
        writefln("A");
    }
}
mixin T;

mixin(q{
    static this() {
        writefln("B");
    }
});

static this() {
    writefln("C");
}
----

test.d:
----
import lib;

void main() {
    import std.stdio;
    writefln("You should see ABC above.");
}
----

Compile the above files with the following:
$ dmd -lib lib.d
$ dmd test.d lib.a

The first static constructor (A) is not executed when lib.d is a library. Note
that when compiled with `dmd test.d lib.d` this works as expected. Tested on
Linux32 and OSX32 with dmd 2.056. This worked in previous releases, it is
currently broken (not sure when it broke).

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to