aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/decl2.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2010-09-15 19:55:43 -0400
committerJason Merrill <jason@gcc.gnu.org>2010-09-15 19:55:43 -0400
commit441b624e3d4b2be01deaf8156bd5ea2b39849259 (patch)
treefb7f920d5338a10375609c74215f95e478226b25 /gcc/cp/decl2.c
parent02a39a93ce25e78a1698001e1fefd6d96f644231 (diff)
downloadgcc-441b624e3d4b2be01deaf8156bd5ea2b39849259.zip
gcc-441b624e3d4b2be01deaf8156bd5ea2b39849259.tar.gz
gcc-441b624e3d4b2be01deaf8156bd5ea2b39849259.tar.bz2
* decl2.c (grokbitfield): Diagnose non-integral width.
From-SVN: r164321
Diffstat (limited to 'gcc/cp/decl2.c')
-rw-r--r--gcc/cp/decl2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index f233055..63197705 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1066,6 +1066,10 @@ 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)))
+ error ("width of bit-field %qD has non-integral type %qT", value,
+ TREE_TYPE (width));
constant_expression_warning (width);
DECL_INITIAL (value) = width;
SET_DECL_C_BIT_FIELD (value);