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

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Aug 25 23:31:07 UTC 2019


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

          Issue ID: 20167
           Summary: Issue warning when result discarded from strong pure
                    function?
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: turkeyman at gmail.com

It would be nice to have a compile error (or warning maybe) when the user
discards the result from a stong pure function.
If the function receives args `const`, and has no side effects, then calling
the function is completely redundant if the result is discarded.
At best it's pointless and inefficient, but in practise it's almost certainly a
bug that the user didn't notice.

--


More information about the Digitalmars-d-bugs mailing list