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

           Summary: Safety/purity/etc. of mixin code should not depend on
                    generating function
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nob...@puremagic.com
        ReportedBy: hst...@quickfur.ath.cx


--- Comment #0 from hst...@quickfur.ath.cx 2013-02-14 20:53:44 PST ---
import std.stdio;

string makeCode() @system
{
        return "return true;";
}

bool func() @safe // <--- does not compile
{
        mixin(makeCode());
}

void main()
{
        writeln(func());
}


Apparently, DMD regards func() as calling makeCode(), but actually this is done
at compile-time, not runtime, so func() should be @safe. Similarly with pure,
nothrow, etc..

The attributes of func() should derive from the *return value* of makeCode(),
not makeCode() itself.

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

Reply via email to