Issue 202395
Summary Surprising behavior of `[[nodiscard]]` with a statement _expression_ vs a comma operator.
Labels new issue
Assignees
Reporter markww
    Consider [this reproducer](https://godbolt.org/z/5vTKzG497), in which a statement _expression_ produces a `[[nodiscard]]` value within a macro which is promptly discarded. No warning is issued for the discard of the `[[nodiscard]]` value.

Contrast this with [similar code](https://godbolt.org/z/aWvsa3ds4) using a comma _expression_. A `[[nodiscard]]` warning is issued.

Now consider [this code](https://godbolt.org/z/6jKEj3z3K) in which the statement _expression_ is wrapped in parens. A warning is issued.

Now consider the original reproducer but [with the macro removed](https://godbolt.org/z/939cr65W3). A warning is again issued.

I would expect that a warning should be issued in all of these cases.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to