[Issue 10288] New: Direct lambda call and purity inference bug
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jun 6 22:16:58 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10288
Summary: Direct lambda call and purity inference bug
Product: D
Version: D2
Platform: All
OS/Version: All
Status: NEW
Keywords: rejects-valid
Severity: major
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: k.hara.pg at gmail.com
--- Comment #0 from Kenji Hara <k.hara.pg at gmail.com> 2013-06-06 22:16:56 PDT ---
In this code, foo and bar are essentially equivalent, but foo is not inferred
to pure.
T foo(T)(T x)
{
() @trusted { x += 10; } ();
return x;
}
T bar(T)(T x)
{
void lambda() @trusted nothrow { x += 10; }
lambda();
return x;
}
@safe pure nothrow void main()
{
assert(foo(10) == 20);
// -> Error: pure function 'main' cannot call impure function 'foo'
assert(bar(10) == 20);
// -> OK
}
--
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