aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorLee Millward <lee.millward@codesourcery.com>2006-10-20 20:13:42 +0000
committerLee Millward <lmillward@gcc.gnu.org>2006-10-20 20:13:42 +0000
commit4c9fb8704ae3893ac39729e9713f8046fac6e1d7 (patch)
treec490295d80e90317c5432e6da339f8379c7bf200 /gcc/cp
parent5d7adf7a1573b3ab23d9a2d70fbf30a8ef0c4958 (diff)
downloadgcc-4c9fb8704ae3893ac39729e9713f8046fac6e1d7.zip
gcc-4c9fb8704ae3893ac39729e9713f8046fac6e1d7.tar.gz
gcc-4c9fb8704ae3893ac39729e9713f8046fac6e1d7.tar.bz2
re PR c++/28053 (ICE deriving from class with invalid bitfield)
PR c++/28053 * decl2.c (grokbitfield): Detect invalid non-integral types earlier when possible. * g++.dg/parse/bitfield1.C: Adjust error markers. * g++.dg/parse/bitfield2.C: New test. Co-Authored-By: Mark Mitchell <mark@codesourcery.com> From-SVN: r117910
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog7
-rw-r--r--gcc/cp/decl2.c8
2 files changed, 15 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 356bc25..a0cfbc0 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,10 @@
+2006-10-20 Lee Millward <lee.millward@codesourcery.com>
+ Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/28053
+ * decl2.c (grokbitfield): Detect invalid non-integral
+ types earlier when possible.
+
2006-10-18 Mark Shinwell <shinwell@codesourcery.com>
PR c++/26884
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 42e9240..3b23638 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -946,6 +946,14 @@ grokbitfield (const cp_declarator *declarator,
if (TREE_CODE (value) == VOID_TYPE)
return void_type_node;
+ if (!INTEGRAL_TYPE_P (TREE_TYPE (value))
+ && (POINTER_TYPE_P (value)
+ || !dependent_type_p (TREE_TYPE (value))))
+ {
+ error ("bit-field %qD with non-integral type", value);
+ return error_mark_node;
+ }
+
if (TREE_CODE (value) == TYPE_DECL)
{
error ("cannot declare %qD to be a bit-field type", value);