www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23086] New: spurious case of `expression has no effect` message


          Issue ID: 23086
           Summary: spurious case of `expression has no effect` message
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: diagnostic, rejects-valid
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: b2.temp gmx.com

For the following code

static int v;

ref int a()
    return a;

int main()
    a == 0;
    return v ? 0 : 1;

we get, with -de, the output

 /tmp/temp_7F3C12CCD670.d:15:5: Error: `a() == 0` has no effect
but the effect of the call directly influences the return code of the program. --
May 04 2022