diff options
author | Jason Merrill <jason@redhat.com> | 2019-01-11 22:36:20 +0000 |
---|---|---|
committer | Jason Merrill <jason@redhat.com> | 2019-01-11 22:36:20 +0000 |
commit | e39affc9dc9a65df2c24b8aea5bbdcb235e5db8d (patch) | |
tree | 3fc4cee14e318f3bf8b1fcb6ec63b532bfa104fc /gcc/cp/cp-gimplify.c | |
parent | feaaf267734db21028bf1b6fb0626aa43b4da6c3 (diff) |
PR c++/88613 - ICE with use of const var in lambda.
The issue here was that we were cp_folding a location wrapper around a
lambda capture proxy before it had been mark_rvalue_used. I considered
adding mark_rvalue_use calls to build_new_op_1, but it seems appropriate to
have them in cp_fold_maybe_rvalue when we know we're trying to produce an
rvalue.
The change to mark_use is for a related issue: when we change the operand of
the location wrapper from VAR_DECL to INTEGER_CST, we need the TREE_CODE of
the location wrapper to change as well, from VIEW_CONVERT_EXPR to
NON_LVALUE_EXPR.
* expr.c (mark_use): Fix location wrapper handling.
* cp-gimplify.c (cp_fold_maybe_rvalue): Call mark_rvalue_use.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@267859 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/cp-gimplify.c')
-rw-r--r-- | gcc/cp/cp-gimplify.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/cp/cp-gimplify.c b/gcc/cp/cp-gimplify.c index 726adac4f4e..121dfa41d8d 100644 --- a/gcc/cp/cp-gimplify.c +++ b/gcc/cp/cp-gimplify.c @@ -2124,6 +2124,8 @@ cp_fold_maybe_rvalue (tree x, bool rval) while (true) { x = cp_fold (x); + if (rval) + x = mark_rvalue_use (x); if (rval && DECL_P (x) && !TYPE_REF_P (TREE_TYPE (x))) { |