From faa9e9bfcaf52cd6194a1bf8f8b905a511b6e1e1 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 1 Mar 2011 17:44:26 -0500 Subject: [PATCH] re PR c++/46282 ([C++0x] ICE: SIGSEGV in grokbitfield (decl2.c:1054)) PR c++/46282 * decl2.c (grokbitfield): Handle type-dependent width. From-SVN: r170600 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/decl2.c | 3 ++- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/cpp0x/regress/bitfield-err1.C | 9 +++++++++ 4 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/regress/bitfield-err1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index d1b1b4aaf4e..ac3f4d71f2e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2011-03-01 Jason Merrill + + PR c++/46282 + * decl2.c (grokbitfield): Handle type-dependent width. + 2011-02-28 Jason Merrill PR c++/47873 diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 93d44a4d6b5..eb5d4f5a9c3 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -1052,7 +1052,8 @@ grokbitfield (const cp_declarator *declarator, if (width != error_mark_node) { /* The width must be an integer type. */ - if (!INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (width))) + if (!type_dependent_expression_p (width) + && !INTEGRAL_OR_UNSCOPED_ENUMERATION_TYPE_P (TREE_TYPE (width))) error ("width of bit-field %qD has non-integral type %qT", value, TREE_TYPE (width)); DECL_INITIAL (value) = width; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 94bbe7ee6ec..fed2d43e4d2 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2011-03-01 Jason Merrill + + * g++.dg/cpp0x/regress/bitfield-err1.C: New. + 2011-03-01 Richard Guenther PR tree-optimization/47890 diff --git a/gcc/testsuite/g++.dg/cpp0x/regress/bitfield-err1.C b/gcc/testsuite/g++.dg/cpp0x/regress/bitfield-err1.C new file mode 100644 index 00000000000..a2e9d47b578 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/regress/bitfield-err1.C @@ -0,0 +1,9 @@ +// PR c++/46282 +// { dg-options -std=c++0x } + +template +class A +{ + A : i() {} // { dg-message "" } + int i; +}; -- 2.30.2