Commit 3569f81f by Jason Merrill Committed by Jason Merrill

PR c++/84752 - ICE with capture of constexpr array.

	* call.c (standard_conversion): Set rvaluedness_matches_p on the
	identity conversion under ck_lvalue.

From-SVN: r258406
parent a72e8ba8
2018-03-09 Jason Merrill <jason@redhat.com> 2018-03-09 Jason Merrill <jason@redhat.com>
PR c++/84752 - ICE with capture of constexpr array.
* call.c (standard_conversion): Set rvaluedness_matches_p on the
identity conversion under ck_lvalue.
2018-03-09 Jason Merrill <jason@redhat.com>
Paolo Carlini <paolo.carlini@oracle.com> Paolo Carlini <paolo.carlini@oracle.com>
PR c++/71169 PR c++/71169
......
...@@ -103,7 +103,7 @@ struct conversion { ...@@ -103,7 +103,7 @@ struct conversion {
being bound to an rvalue expression. If KIND is ck_rvalue, being bound to an rvalue expression. If KIND is ck_rvalue,
true when we are treating an lvalue as an rvalue (12.8p33). If true when we are treating an lvalue as an rvalue (12.8p33). If
KIND is ck_base, always false. If ck_identity, we will be KIND is ck_base, always false. If ck_identity, we will be
binding a reference directly. */ binding a reference directly or decaying to a pointer. */
BOOL_BITFIELD rvaluedness_matches_p: 1; BOOL_BITFIELD rvaluedness_matches_p: 1;
BOOL_BITFIELD check_narrowing: 1; BOOL_BITFIELD check_narrowing: 1;
/* The type of the expression resulting from the conversion. */ /* The type of the expression resulting from the conversion. */
...@@ -1139,6 +1139,8 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p, ...@@ -1139,6 +1139,8 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
{ {
from = type_decays_to (from); from = type_decays_to (from);
fcode = TREE_CODE (from); fcode = TREE_CODE (from);
/* Tell convert_like_real that we're using the address. */
conv->rvaluedness_matches_p = true;
conv = build_conv (ck_lvalue, from, conv); conv = build_conv (ck_lvalue, from, conv);
} }
/* Wrapping a ck_rvalue around a class prvalue (as a result of using /* Wrapping a ck_rvalue around a class prvalue (as a result of using
......
// PR c++/84752
// { dg-do compile { target c++11 } }
void foo()
{
constexpr int x[1] = {};
[&x]{ return (bool)x; };
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment