re PR middle-end/65554 (ICE: verify_gimple failed)
authorMarek Polacek <polacek@redhat.com>
Wed, 1 Apr 2015 13:08:05 +0000 (13:08 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 1 Apr 2015 13:08:05 +0000 (13:08 +0000)
PR c++/65554
* class.c (finish_struct): Require that the second field of a
user-defined initializer_list be of size type.

* g++.dg/cpp0x/initlist93.C: New test.
* g++.dg/cpp0x/initlist94.C: New test.

From-SVN: r221808

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

index 0d2456d6eb89cc7f57f4ee561056ef18cb5ec1c7..946450b48b053a71c956b99ae63b44c93fe714d8 100644 (file)
@@ -1,3 +1,9 @@
+2015-04-01  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/65554
+       * class.c (finish_struct): Require that the second field of a
+       user-defined initializer_list be of size type.
+
 2015-03-31  Marek Polacek  <polacek@redhat.com>
 
        PR c++/65390
index c2d420190c4a47aea424ba3a3a44d8937ae6f884..9f189fb5eaf977f5e9f542e20418c133153669d1 100644 (file)
@@ -6891,7 +6891,7 @@ finish_struct (tree t, tree attributes)
          if (f && TREE_CODE (TREE_TYPE (f)) == POINTER_TYPE)
            {
              f = next_initializable_field (DECL_CHAIN (f));
-             if (f && TREE_CODE (TREE_TYPE (f)) == INTEGER_TYPE)
+             if (f && same_type_p (TREE_TYPE (f), size_type_node))
                ok = true;
            }
        }
index 24fbed7c7bd0616e32787f72636c4ec66eff923d..399f9ccad37f9e0bced49d7bdc0cf1fb6ff8e282 100644 (file)
@@ -1,3 +1,9 @@
+2015-04-01  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/65554
+       * g++.dg/cpp0x/initlist93.C: New test.
+       * g++.dg/cpp0x/initlist94.C: New test.
+
 2015-04-01  Max Ostapenko  <m.ostapenko@partner.samsung.com>
 
        PR target/65624
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist93.C b/gcc/testsuite/g++.dg/cpp0x/initlist93.C
new file mode 100644 (file)
index 0000000..84a4738
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/65554
+// { dg-do compile { target c++11 } }
+
+namespace std
+{
+template <class> class initializer_list // { dg-error "definition of std::initializer_list does not match" }
+{
+  int *_M_array;
+  int _M_len;
+};
+}
+
+// { dg-prune-output "compilation terminated" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/initlist94.C b/gcc/testsuite/g++.dg/cpp0x/initlist94.C
new file mode 100644 (file)
index 0000000..f83a81d
--- /dev/null
@@ -0,0 +1,13 @@
+// PR c++/65554
+// { dg-do compile { target c++11 } }
+
+typedef decltype (sizeof (int)) size_type;
+
+namespace std
+{
+template <class> class initializer_list
+{
+  int *_M_array;
+  size_type _M_len;
+};
+}