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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Jan 27 17:15:13 PST 2010


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

           Summary: Misleding error message "OP  has no effect in
                    expression XXX), in void function
           Product: D
           Version: 2.041
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: baryluk at smp.if.uj.edu.pl


--- Comment #0 from Witold Baryluk <baryluk at smp.if.uj.edu.pl> 2010-01-27 17:15:05 PST ---
On function with void return type, if one will put expression after return:

void f() {
   auto a = 1, b = 3, c = 5;
   return a/b*c;
}


will end with compiler error like:

aaa.d(4): Error: * has no effect in expression (a / b * c)


My function "f" was lot bigger, and took me about 5 minutes to understand what
is wrong.

Could such bugs can be detected and be something like

aaa.d(4): Error: no return statment allowed in void function/method

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