re PR c++/61670 (ICE on invalid in tree_nop_conversion)
authorMarek Polacek <polacek@redhat.com>
Wed, 25 Mar 2015 20:06:24 +0000 (20:06 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Wed, 25 Mar 2015 20:06:24 +0000 (20:06 +0000)
PR c++/61670
* class.c (remove_zero_width_bit_fields): Check for null DECL_SIZE.

* g++.dg/template/pr61670.C: New test.

From-SVN: r221671

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

index 5b3fd49f540112c113790b3f4c2dbf02e02bf34c..65e1912cf07ecf9044f1b6c1649c27a0b986bcc9 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-25  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/61670
+       * class.c (remove_zero_width_bit_fields): Check for null DECL_SIZE.
+
 2015-03-24  Jason Merrill  <jason@redhat.com>
 
        PR c++/65046
index 0518320d6b9953517fc72fe7f075fb3747dbf1ee..c2d420190c4a47aea424ba3a3a44d8937ae6f884 100644 (file)
@@ -5434,7 +5434,8 @@ remove_zero_width_bit_fields (tree t)
             DECL_INITIAL (*fieldsp).
             check_bitfield_decl eventually sets DECL_SIZE (*fieldsp)
             to that width.  */
-         && integer_zerop (DECL_SIZE (*fieldsp)))
+         && (DECL_SIZE (*fieldsp) == NULL_TREE
+             || integer_zerop (DECL_SIZE (*fieldsp))))
        *fieldsp = DECL_CHAIN (*fieldsp);
       else
        fieldsp = &DECL_CHAIN (*fieldsp);
index 7dedff41e2d41ff7d443fd425fc16187631dc099..c8f9033896663b0d1b71267afe5876c97ea4afdb 100644 (file)
@@ -1,3 +1,8 @@
+2015-03-25  Marek Polacek  <polacek@redhat.com>
+
+       PR c++/61670
+       * g++.dg/template/pr61670.C: New test.
+
 2015-03-25  Paolo Carlini  <paolo.carlini@oracle.com>
 
        PR c++/54987
diff --git a/gcc/testsuite/g++.dg/template/pr61670.C b/gcc/testsuite/g++.dg/template/pr61670.C
new file mode 100644 (file)
index 0000000..d244efa
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/61670
+// { dg-do compile }
+
+template <class>
+class A {
+  A: 0 // { dg-error "" }
+};
+
+A<int> a;