www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10614] New: A delegate erroneously inferred as impure


           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 puremagic.com
        ReportedBy: bearophile_hugs eml.cc

--- Comment #0 from bearophile_hugs eml.cc 2013-07-11 12:17:22 PDT ---
struct Foo {
    immutable int y;
    void bar(TF)(TF f) pure {
    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: -------
Jul 11 2013