[Issue 3855] New: Misleading error messages for return expression in void methods.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Feb 25 12:45:46 PST 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3855
Summary: Misleading error messages for return expression in
void methods.
Product: D
Version: 1.056
Platform: x86
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: nobody at puremagic.com
ReportedBy: sky at q1cc.net
--- Comment #0 from Markus Dangl <sky at q1cc.net> 2010-02-25 12:45:45 PST ---
dmd 1.056 gives a misleading error message on invalid code.
The error was not even reported in my previous version (1.045).
Consider the following invalid code:
class C {
int i;
void m() {
return i;
}
}
And output of "dmd main.d":
main.d(4): Error: dotvar has no effect in expression (this.i)
The error message could be much clearer about not being able to return
something for a void method.
Testing the same thing with a simple function:
void m() {
return 1;
}
gives the following output of "dmd main.d":
main.d(2): Error: long has no effect in expression (1)
Which is still not very clear.
--
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