From 2a924bb46cd43165272ce6f1720710c38beb2c24 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 25 Mar 2015 20:06:24 +0000 Subject: [PATCH] re PR c++/61670 (ICE on invalid in tree_nop_conversion) 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 | 5 +++++ gcc/cp/class.c | 3 ++- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/template/pr61670.C | 9 +++++++++ 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/template/pr61670.C 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 + + PR c++/61670 + * class.c (remove_zero_width_bit_fields): Check for null DECL_SIZE. + 2015-03-24 Jason Merrill 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 + + PR c++/61670 + * g++.dg/template/pr61670.C: New test. + 2015-03-25 Paolo Carlini 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 A { + A: 0 // { dg-error "" } +}; + +A a; -- 2.30.2