aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/testsuite/std
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2025-07-14 18:29:17 -0400
committerJason Merrill <jason@redhat.com>2025-07-15 15:05:48 -0400
commit35b19980046fc57d9d6851b8f4349bd22de3fa03 (patch)
tree28ad7b9636111905a361876a9273d0fedb10832e /libstdc++-v3/testsuite/std
parent3fbed69502770851c8a5bfece99e9ee8c6d9e4b0 (diff)
downloadgcc-35b19980046fc57d9d6851b8f4349bd22de3fa03.zip
gcc-35b19980046fc57d9d6851b8f4349bd22de3fa03.tar.gz
gcc-35b19980046fc57d9d6851b8f4349bd22de3fa03.tar.bz2
c++: don't mark void exprs as read [PR44677]
In Jakub's patch for PR44677 he added code to prevent mark_exp_read on e.g. (void)++i from marking i as read, but it seems to me that we can generalize that to avoid looking any farther into any void expression; you can't read a void value, and an explicit cast will have already called mark_exp_read on its operand in convert_to_void. For testing I added an assert to catch places where we were trying to mark void expressions as read, and fix a few that it found. But there were several other places (such as check_return_expr) where we could have a void expression but always calling mark_exp_read makes sense, so I dropped the assert from the final commit. PR c++/44677 gcc/cp/ChangeLog: * cp-gimplify.cc (cp_fold) [CLEANUP_POINT_EXPR]: Don't force rvalue. [COMPOUND_EXPR]: Likewise. * cvt.cc (convert_to_void): Call mark_exp_read later. * expr.cc (mark_use): Turn off read_p for any void argument. (mark_exp_read): Return early for void argument.
Diffstat (limited to 'libstdc++-v3/testsuite/std')
0 files changed, 0 insertions, 0 deletions