[Issue 3922] New: Wrong error message with return in void function

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 10 05:02:49 PST 2010


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

           Summary: Wrong error message with return in void function
           Product: D
           Version: 2.041
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-03-10 05:02:48 PST ---
This is a wrong program:

void foo(int x) {
    return x;
}
void main() {}


Currently dmd2 generates a bad error message:
temp.d(2): Error: var has no effect in expression (x)

A much better error message can be:
temp.d(2): Error: return can't be used in a void function.

Bad error messages like this one do waste my programming time.

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