www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 7099] New: static constructor in template mixin in library not executed

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: robert octarineparrot.com



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: -------
Dec 12 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7099


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |wrong-code
                 CC|                            |clugdbug yahoo.com.au
           Platform|Other                       |All
           Severity|regression                  |normal



Happens on Windows as well. This isn't a regression, it behaves the same way in
D 1.040. It has never worked.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Dec 19 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=7099




16:26:59 GMT ---

 Happens on Windows as well. This isn't a regression, it behaves the same way in
 D 1.040. It has never worked.
I have no idea how my code used to work then. Weird. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Dec 19 2011