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

--- Comment #0 from Witold Baryluk <> 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:
------- You are receiving this mail because: -------

Reply via email to