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
This commit is contained in:
Jason Merrill 2011-03-01 17:44:26 -05:00 committed by Jason Merrill
parent f2ca11ca97
commit faa9e9bfca
4 changed files with 20 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2011-03-01 Jason Merrill <jason@redhat.com>
PR c++/46282
* decl2.c (grokbitfield): Handle type-dependent width.
2011-02-28 Jason Merrill <jason@redhat.com>
PR c++/47873

View File

@ -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;

View File

@ -1,3 +1,7 @@
2011-03-01 Jason Merrill <jason@redhat.com>
* g++.dg/cpp0x/regress/bitfield-err1.C: New.
2011-03-01 Richard Guenther <rguenther@suse.de>
PR tree-optimization/47890

View File

@ -0,0 +1,9 @@
// PR c++/46282
// { dg-options -std=c++0x }
template<int>
class A
{
A : i() {} // { dg-message "" }
int i;
};