www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9517] New: Safety/purity/etc. of mixin code should not depend on generating function

reply d-bugmail puremagic.com writes:
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: nobody puremagic.com
        ReportedBy: hsteoh quickfur.ath.cx


--- Comment #0 from hsteoh 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: -------
Feb 14 2013
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9517


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |DUPLICATE


--- Comment #1 from yebblies <yebblies gmail.com> 2013-02-17 12:47:19 EST ---
*** This issue has been marked as a duplicate of issue 6169 ***

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