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



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



*** 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