aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorIain Sandoe <iain@sandoe.co.uk>2021-10-02 16:15:38 +0100
committerIain Sandoe <iain@sandoe.co.uk>2021-10-03 21:03:56 +0100
commitfdf0b6ce6c1cfa1c328c0c40473c71ca11fd8303 (patch)
tree5076292a7ea47921a9134dc1e7084969a9cf25aa /gcc/cp
parent650beb110538097b9c3e8600149b333a83e7e836 (diff)
downloadgcc-fdf0b6ce6c1cfa1c328c0c40473c71ca11fd8303.zip
gcc-fdf0b6ce6c1cfa1c328c0c40473c71ca11fd8303.tar.gz
gcc-fdf0b6ce6c1cfa1c328c0c40473c71ca11fd8303.tar.bz2
coroutines: Fail with a sorry when presented with a VLA [PR 101765].
We do not support this yet. Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> PR c++/101765 gcc/cp/ChangeLog: * coroutines.cc (register_local_var_uses): Emit a sorry if we encounter a VLA in the coroutine local variables. gcc/testsuite/ChangeLog: * g++.dg/coroutines/pr101765.C: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/coroutines.cc10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc
index 377b90c..9017902 100644
--- a/gcc/cp/coroutines.cc
+++ b/gcc/cp/coroutines.cc
@@ -3927,6 +3927,16 @@ register_local_var_uses (tree *stmt, int *do_subtree, void *d)
if (local_var.is_static)
continue;
+ poly_uint64 size;
+ if (TREE_CODE (lvtype) == ARRAY_TYPE
+ && !poly_int_tree_p (DECL_SIZE_UNIT (lvar), &size))
+ {
+ sorry_at (local_var.def_loc, "variable length arrays are not"
+ " yet supported in coroutines");
+ /* Ignore it, this is broken anyway. */
+ continue;
+ }
+
lvd->local_var_seen = true;
/* If this var is a lambda capture proxy, we want to leave it alone,
and later rewrite the DECL_VALUE_EXPR to indirect through the