Summary: bad error location in "has no effect in expression"
           Product: D
           Version: 1.051
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD

--- Comment #0 from Vladimir <> 2009-12-17 16:09:57 PST 

=== Module a.d ===
enum { A, B, C }

=== Module b.d ===
import a;

// ... thousands of lines of code ...
void foo()
// ... thousands of lines of code ...

The error message outputted by the compiler will look like this:
a.d(1): Error: long has no effect in expression (0)

This is more serious considering that starting with 1.049, DMD forbids return
expressions without side effects inside void functions. In my particular case,
this was with the pretty-large DFL library, which required quite a bit of
"divide-et-impera" to find the offending code.

By quickly looking at the compiler code, it looks like this happens because the
expression statement is using the expression directly from the enumeration. The
fix would involve instantiating an enum-reference expression each time an
enumeration member is mentioned, or something like that.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to