[Issue 9620] Error messages of failed pure enforcement

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


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

--- Comment #4 from yebblies <yebblies at gmail.com> ---
(In reply to bearophile_hugs from comment #3)
> 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'

Heh that sure looks wrong to me.  Although it's most likely not this same
diagnostic issue.

--


More information about the Digitalmars-d-bugs mailing list