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

2023-04-21 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. In D148925#4287497 , @tbaeder wrote: > In D148925#4287218 , @erichkeane > wrote: > >> So things cast to 'void' can have side effects, right? Does the call to >> discard still

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

2023-04-21 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder added a comment. In 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

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

2023-04-21 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder updated this revision to Diff 515762. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148925/new/ https://reviews.llvm.org/D148925 Files: clang/lib/AST/Interp/ByteCodeExprGen.cpp clang/test/AST/Interp/literals.cpp Index: clang/test/AST/Interp/literals.cpp

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

2023-04-21 Thread Erich Keane via Phabricator via cfe-commits
erichkeane added a comment. So things cast to 'void' can have side effects, right? Does the call to discard still evaluate them? https://godbolt.org/z/a3ej9bxKe constexpr int foo(int start) { int i = start; (void)i++; (void)i++,(void)i++; return i; } constexpr

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

2023-04-21 Thread Timm Bäder via Phabricator via cfe-commits
tbaeder created this revision. tbaeder added reviewers: aaron.ballman, tahonermann, shafik, erichkeane. Herald added a project: All. tbaeder requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. First, we need to handle void types in