]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
PR c++/84752 - ICE with capture of constexpr array.
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 10 Mar 2018 03:34:23 +0000 (03:34 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 10 Mar 2018 03:34:23 +0000 (03:34 +0000)
* call.c (standard_conversion): Set rvaluedness_matches_p on the
identity conversion under ck_lvalue.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@258406 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/g++.dg/cpp0x/lambda/lambda-array3.C [new file with mode: 0644]

index 52fa63e0227062aac0705f28c9558373499380ad..05cfb768bc684ff565ba1a911c07afba5ad81f10 100644 (file)
@@ -1,3 +1,9 @@
+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>
 
index 17cd1c4f63e313cbbb6ea7c6a95f20ed9bfa46b8..45c22aaa312c96b4e8eb326cd7310a4b17b9ce48 100644 (file)
@@ -103,7 +103,7 @@ struct conversion {
      being bound to an rvalue expression.  If KIND is ck_rvalue,
      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
-     binding a reference directly.  */
+     binding a reference directly or decaying to a pointer.  */
   BOOL_BITFIELD rvaluedness_matches_p: 1;
   BOOL_BITFIELD check_narrowing: 1;
   /* 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,
     {
       from = type_decays_to (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);
     }
   /* Wrapping a ck_rvalue around a class prvalue (as a result of using
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-array3.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-array3.C
new file mode 100644 (file)
index 0000000..0971103
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/84752
+// { dg-do compile { target c++11 } }
+
+void foo()
+{
+  constexpr int x[1] = {};
+  [&x]{ return (bool)x; };
+}
+