[Issue 10614] New: A delegate erroneously inferred as impure
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jul 11 12:17:23 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10614
Summary: A delegate erroneously inferred as impure
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2013-07-11 12:17:22 PDT ---
struct Foo {
immutable int y;
void bar(TF)(TF f) pure {
f(1);
}
void spam() pure {
bar((int x) => y);
}
}
void main() {}
dmd 2.064alpha gives errors, but I think the code should be accepted:
test.d(4): Error: pure function 'test.Foo.bar!(immutable(int) delegate(int x)
nothrow @safe).bar' cannot call impure delegate 'f'
test.d(7): Error: template instance test.Foo.bar!(immutable(int) delegate(int
x) nothrow @safe) error instantiating
--
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