[Issue 9517] New: Safety/purity/etc. of mixin code should not depend on generating function
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 14 20:53:45 PST 2013
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 at puremagic.com
ReportedBy: hsteoh at quickfur.ath.cx
--- Comment #0 from hsteoh at 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: -------
More information about the Digitalmars-d-bugs
mailing list