[Issue 20167] Issue warning when result discarded from strong pure function?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 26 00:43:56 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=20167

Dennis <dkorpel at live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel at live.nl

--- Comment #1 from Dennis <dkorpel at live.nl> ---
(In reply to Manu from comment #0)
> It would be nice to have a compile error (or warning maybe) when the user
> discards the result from a stong pure function.

```
int f() nothrow pure {
    return 1;
}

void main() {
  f();
}
```

When compiling with -w:

onlineapp.d(6): Warning: calling onlineapp.f without side effects discards
return value of type int, prepend a cast(void) if intentional

Is there anything lacking on the current warning or can this be closed?

--


More information about the Digitalmars-d-bugs mailing list