[Issue 9620] Error messages of failed pure enforcement

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Thu Nov 13 04:27:32 PST 2014


https://issues.dlang.org/show_bug.cgi?id=9620

--- Comment #3 from bearophile_hugs at eml.cc ---
Are you sure the bug is fixed correctly? Why is foo() not raising an error? If
I comment out the call to bar() the main compiles, but it's not pure:


int x;
void bar() {
    x++;
}
void main() pure {
    static void foo() {
        x++;
    }
    foo(); // No error
    bar(); // Error
}


Gives:

test.d(10,8): Error: pure function 'D main' cannot call impure function
'test.bar'

--


More information about the Digitalmars-d-bugs mailing list