diff options
author | Iain Sandoe <iain@sandoe.co.uk> | 2020-04-07 15:03:21 +0100 |
---|---|---|
committer | Iain Sandoe <iain@sandoe.co.uk> | 2020-04-07 16:30:30 +0100 |
commit | 89b01e86ff8521a0decf292595089e5631cc9320 (patch) | |
tree | 172b02ed153431332d9aca9e62c3e4fba4875e1e | |
parent | 6a90680bfff0a3803b3dc950c847046abb2d7d54 (diff) | |
download | gcc-89b01e86ff8521a0decf292595089e5631cc9320.zip gcc-89b01e86ff8521a0decf292595089e5631cc9320.tar.gz gcc-89b01e86ff8521a0decf292595089e5631cc9320.tar.bz2 |
coroutines, ensure placeholder var is properly declared.
In cases that we need to extended the lifetime of a temporary captured
by reference, we make a replacement var for the temporary. This will
be then used to define a coroutine frame entry (so that the var created
is elided by a later phase). However, we should ensure that the var
is correctly declared anyway.
gcc/cp/ChangeLog:
2020-04-07 Iain Sandoe <iain@sandoe.co.uk>
* coroutines.cc (maybe_promote_captured_temps): Ensure that
reference capture placeholder vars are properly declared.
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/coroutines.cc | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 67bee23..60d9279 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2020-04-07 Iain Sandoe <iain@sandoe.co.uk> + + * coroutines.cc (maybe_promote_captured_temps): Ensure that + reference capture placeholder vars are properly declared. + 2020-04-07 Patrick Palka <ppalka@redhat.com> PR c++/90996 diff --git a/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc index 38a23a9..983fa65 100644 --- a/gcc/cp/coroutines.cc +++ b/gcc/cp/coroutines.cc @@ -2832,7 +2832,9 @@ maybe_promote_captured_temps (tree *stmt, void *d) sloc = DECL_SOURCE_LOCATION (orig_temp); DECL_SOURCE_LOCATION (newvar) = sloc; DECL_CHAIN (newvar) = varlist; - varlist = newvar; + varlist = newvar; /* Chain it onto the list for the bind expr. */ + /* Declare and initialze it in the new bind scope. */ + add_decl_expr (newvar); tree stmt = build2_loc (sloc, INIT_EXPR, var_type, newvar, to_replace); stmt = coro_build_cvt_void_expr_stmt (stmt, sloc); |