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. From-SVN: r267859
12 lines
178 B
C
12 lines
178 B
C
// PR c++/88613
|
|
// { dg-do compile { target c++11 } }
|
|
// { dg-additional-options -Wtautological-compare }
|
|
|
|
void a() {
|
|
const int b = 5;
|
|
[=] {
|
|
if (b != 5)
|
|
;
|
|
}();
|
|
}
|