[Issue 23086] New: spurious case of `expression has no effect` message
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed May 4 12:50:51 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23086
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 at puremagic.com
Reporter: b2.temp at gmx.com
For the following code
```
static int v;
ref int a()
{
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.
--
More information about the Digitalmars-d-bugs
mailing list