[Issue 8862] order of declaration of a function and compile time execution

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Oct 21 15:11:23 PDT 2012


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



--- Comment #4 from Ryuichi OHORI <r.97all at gmail.com> 2012-10-21 15:11:21 PDT ---
> I see. Then try to minimize the code yourself. And then attach/paste it here
> instead of dpaste, please.
Actually I was trying to reduce test case for a bug
http://d.puremagic.com/issues/show_bug.cgi?id=8865 and came up with another
(this) one, so it was difficult for me. Thanks to your code, I managed to
minimize see below:

void main()
{
    F!10 x;
}

struct F(int n)
{
    mixin I!n;
}

mixin template I(int n)
{
    int value;
    static F[1] x = get_xs(); // compiles, but outputs: "error.d(14):       
called from here: get_xs()"
    static F[1] get_xs()
    {
        return [F(0)];
    }
    //static F[1] x = get_xs(); // compiles, without output.
}

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


More information about the Digitalmars-d-bugs mailing list