]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/60708 (An array temporary causes an ICE in gimplify)
authorJason Merrill <jason@redhat.com>
Tue, 13 May 2014 16:05:19 +0000 (12:05 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 13 May 2014 16:05:19 +0000 (12:05 -0400)
PR c++/60708
* call.c (build_array_conv): Call complete_type.

From-SVN: r210384

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

index 9d63170ac7ebd3084ac0d01c853f37d1d9b668fd..a31db4358d5f6a690ab7cca16fec38efce1c0583 100644 (file)
@@ -1,5 +1,8 @@
 2014-05-13  Jason Merrill  <jason@redhat.com>
 
+       PR c++/60708
+       * call.c (build_array_conv): Call complete_type.
+
        PR c++/60713
        * typeck2.c (PICFLAG_SIDE_EFFECTS): New.
        (picflag_from_initializer): Return it.
index db5a17fdf5692682f12b43eef6d70d82fabcb303..51e1d192958e5cebd340c9a1aa1b4f55d5aba185 100644 (file)
@@ -943,6 +943,9 @@ build_array_conv (tree type, tree ctor, int flags, tsubst_flags_t complain)
   bool user = false;
   enum conversion_rank rank = cr_exact;
 
+  /* We might need to propagate the size from the element to the array.  */
+  complete_type (type);
+
   if (TYPE_DOMAIN (type))
     {
       unsigned HOST_WIDE_INT alen = tree_low_cst (array_type_nelts_top (type), 1);
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist82.C b/gcc/testsuite/g++.dg/cpp0x/initlist82.C
new file mode 100644 (file)
index 0000000..3b9ccad
--- /dev/null
@@ -0,0 +1,20 @@
+// PR c++/60708
+// { dg-do compile { target c++11 } }
+
+template <class T, class U> struct mypair {
+  mypair(T, U) {}
+};
+
+template<typename T> struct S {
+ mypair<T *, int> get_pair() noexcept {
+   return mypair<T*,int>(nullptr, 0);
+ }
+};
+
+static void foo(const mypair<char *, int> (&a)[2]) noexcept { }
+
+int main()
+{
+  S<char> s;
+  foo({s.get_pair(), s.get_pair()});
+}