[Issue 3746] Misleading error message "OP has no effect in expression XXX), in void function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jun 14 05:18:44 PDT 2011


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



--- Comment #11 from bearophile_hugs at eml.cc 2011-06-14 05:14:02 PDT ---
(In reply to comment #10)

> You're talking about two completely separate issues, both of which are
> enhancements.  This issue is about providing a clearer error message without
> changing the spec.

Walter has accepted one of the enhancement requests I was talking about (the
one about pure functions).

I was not aware the second too is an enhancement request, but after re-reading
that part of the D specs I see you are right. So technically your error message
is correct. But it's hard to keep in memory all the D specs, especially for D
newbies. So I suggest a longer and more wordy error message, because this error
message is not easy enough to understand.

----------

According to the D specs this code is illegal, is your patch raising an error
on it?

pure int sqr(int x) { return x * x; }
void main() {
    return sqr(10);
}

----------

According to the current D specs this code is correct:

int sqr(int x) { return x * x; }
void main() {
    return sqr(10);
}

But I can't see this as correct, it's bug prone. So bug 3922 was not a dupe, it
was an ehancement request! I have to reopen it.

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