]> gcc.gnu.org Git - gcc.git/commit
c++: fix ICE on FUNCTION_DECLs inside coroutines [PR115906]
authorArsen Arsenovic <arsen@aarsen.me>
Tue, 30 Jul 2024 11:42:56 +0000 (13:42 +0200)
committerArsen Arsenovic <arsen@gcc.gnu.org>
Tue, 30 Jul 2024 11:42:56 +0000 (13:42 +0200)
commita362c9ca4ef6585e678f899705043a9aa10dd670
tree9989dc3d08f2cafc9bc352715a595a372ffeb043
parent7cde140863edea536c676096cbc3d84a6d1424e4
c++: fix ICE on FUNCTION_DECLs inside coroutines [PR115906]

When register_local_var_uses iterates a BIND_EXPRs BIND_EXPR_VARS, it
fails to account for the fact that FUNCTION_DECLs might be present, and
later passes it to DECL_HAS_VALUE_EXPR_P.  This leads to a tree check
failure in DECL_HAS_VALUE_EXPR_P:

  tree check: expected var_decl or parm_decl or result_decl, have
  function_decl in register_local_var_uses

We only care about PARM_DECL and VAR_DECL, so select only those.

PR c++/115906 - [coroutines] missing diagnostic and ICE when co_await used as default argument in function declaration

gcc/cp/ChangeLog:

PR c++/115906
* coroutines.cc (register_local_var_uses): Only process
PARM_DECL and VAR_DECLs.

gcc/testsuite/ChangeLog:

PR c++/115906
* g++.dg/coroutines/coro-function-decl.C: New test.
gcc/cp/coroutines.cc
gcc/testsuite/g++.dg/coroutines/coro-function-decl.C [new file with mode: 0644]
This page took 0.056796 seconds and 5 git commands to generate.