aboutsummaryrefslogtreecommitdiff
path: root/include/gdb/gdb-index.h
diff options
context:
space:
mode:
authorArsen Arsenović <arsen@aarsen.me>2024-07-22 15:49:20 +0200
committerArsen Arsenović <arsen@gcc.gnu.org>2024-07-25 16:44:38 +0200
commit2664c1bf83855b79d8c43772e71b87ed4f09c174 (patch)
treea2369f9726d4d3b34a293660516df347655fc68e /include/gdb/gdb-index.h
parent1a37d6b732506f8c3f9e9452c9dc6a456f25397b (diff)
downloadgcc-2664c1bf83855b79d8c43772e71b87ed4f09c174.zip
gcc-2664c1bf83855b79d8c43772e71b87ed4f09c174.tar.gz
gcc-2664c1bf83855b79d8c43772e71b87ed4f09c174.tar.bz2
cp+coroutines: teach convert_to_void to diagnose discarded co_awaits
co_await expressions are nearly calls to Awaitable::await_resume, and, as such, should inherit its nodiscard. A discarded co_await expression should, hence, act as if its call to await_resume was discarded. This patch teaches convert_to_void how to discard 'through' a CO_AWAIT_EXPR. When we discard a CO_AWAIT_EXPR, we can also just discard the await_resume() call conveniently embedded within it. This results in a [[nodiscard]] diagnostic that the PR noted was missing. gcc/cp/ChangeLog: PR c++/110171 * coroutines.cc (co_await_get_resume_call): New function. Returns the await_resume expression of a given co_await. * cp-tree.h (co_await_get_resume_call): New function. * cvt.cc (convert_to_void): Handle CO_AWAIT_EXPRs and call maybe_warn_nodiscard on their resume exprs. gcc/testsuite/ChangeLog: PR c++/110171 * g++.dg/coroutines/pr110171-1.C: New test. * g++.dg/coroutines/pr110171.C: New test.
Diffstat (limited to 'include/gdb/gdb-index.h')
0 files changed, 0 insertions, 0 deletions