[Issue 5274] Impure function call inside impure function nested inside pure function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Nov 24 19:36:10 PST 2010


http://d.puremagic.com/issues/show_bug.cgi?id=5274



--- Comment #2 from bearophile_hugs at eml.cc 2010-11-24 19:34:49 PST ---
I have not expressed myself well enough, I am sorry. This bug report is a
"diagnostic" one, it's not a "rejects valid". So I agree that this code needs
to be refused at compile time, but is this a good message?

test.d(4): Error: pure function 'foo' cannot call impure function 'putchar'

foo() doesn't contain putchar(), it's bar() that calls it.

I don't know what is a good error message for this situation.
This is a reduced test case:


void foo() {}
pure void bar() {
    void spam() {
        foo();
    }
}
void main() {}


Maybe you are right, there is no much better error message to be invented here.

-- 
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