summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-25 20:06:24 +0000
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2015-03-25 20:06:24 +0000
commit60daeb2c1a4c740968f778cfec31401665577af7 (patch)
tree66ac49b022061a1477eea8481de32ecf4d3735ba
parent51cd10c1be3fc80786475357cbd1d22f8ceb8d7b (diff)
downloadgcc-60daeb2c1a4c740968f778cfec31401665577af7.tar.gz
PR c++/61670
* class.c (remove_zero_width_bit_fields): Check for null DECL_SIZE. * g++.dg/template/pr61670.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@221671 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/class.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/pr61670.C9
4 files changed, 21 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 5b3fd49f540..65e1912cf07 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -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
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index 0518320d6b9..c2d420190c4 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -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);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7dedff41e2d..c8f90338966 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -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
index 00000000000..d244efae71f
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/pr61670.C
@@ -0,0 +1,9 @@
+// PR c++/61670
+// { dg-do compile }
+
+template <class>
+class A {
+ A: 0 // { dg-error "" }
+};
+
+A<int> a;