www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3855] New: Misleading error messages for return expression in void methods.

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: sky q1cc.net



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: -------
Feb 25 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3855


Markus Dangl <sky q1cc.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |minor


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 25 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3855


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies gmail.com
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 3746 ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 12 2011