[PATCH] D148925: Fix discarding void-typed comma expressions

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 21 09:15:23 PDT 2023


tbaeder added a comment.

In D148925#4287218 <https://reviews.llvm.org/D148925#4287218>, @erichkeane wrote:

> So things cast to 'void' can have side effects, right?  Does the call to discard still evaluate them?
>
> https://godbolt.org/z/a3ej9bxKe

Yes. `discard(E)` is just `visit(E)`, except that it sets `DiscardResult` to `true` for that one level of visiting. Following `visit()` calls will have `DiscardResult = false` again.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148925/new/

https://reviews.llvm.org/D148925



More information about the cfe-commits mailing list