From 807625cf45d49ff58c333a0ad826f267d1f45a04 Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Sun, 3 Oct 1999 16:04:30 +0000 Subject: [PATCH] tree.c (lvalue_p_1): Use DECL_C_BIT_FIELD to check for bitfields, rather than DECL_BIT_FIELD. * tree.c (lvalue_p_1): Use DECL_C_BIT_FIELD to check for bitfields, rather than DECL_BIT_FIELD. * ir.texi: Document how to tell whether or not a field is a bitfield. * lex.c (make_lang_type): Fix typo in comment. From-SVN: r29781 --- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/ir.texi | 2 +- gcc/cp/lex.c | 2 +- gcc/cp/tree.c | 2 +- gcc/testsuite/g++.old-deja/g++.other/bitfld4.C | 25 +++++++++++++++++++++++++ 5 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.other/bitfld4.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 814e211..ffe4cd2 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +1999-10-03 Mark Mitchell + + * tree.c (lvalue_p_1): Use DECL_C_BIT_FIELD to check for + bitfields, rather than DECL_BIT_FIELD. + * ir.texi: Document how to tell whether or not a field is a + bitfield. + + * lex.c (make_lang_type): Fix typo in comment. + 1999-10-01 Jason Merrill * typeck.c (decay_conversion): Strip cv-quals from non-class rvalues. diff --git a/gcc/cp/ir.texi b/gcc/cp/ir.texi index 2831e3b..6e1623e 100644 --- a/gcc/cp/ir.texi +++ b/gcc/cp/ir.texi @@ -842,7 +842,7 @@ These nodes represent non-static data members. The @code{DECL_SIZE} and @code{INTEGER_CST}. These values are indexed from zero, where zero indicates the first bit in the object. -FIXME: Talk about bitfields. +If @code{DECL_C_BIT_FIELD} holds, this field is a bitfield. @item NAMESPACE_DECL @xref{Namespaces}. diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index acc99c7..5d87eea 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -4830,7 +4830,7 @@ make_lang_type (code) clear it here. */ TYPE_ALIAS_SET (t) = 0; - /* We need to allocate a TYPE_BINFO even for TEMPALTE_TYPE_PARMs + /* We need to allocate a TYPE_BINFO even for TEMPLATE_TYPE_PARMs since they can be virtual base types, and we then need a canonical binfo for them. Ideally, this would be done lazily for all types. */ diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 8e4f2da..96a1549 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -86,7 +86,7 @@ lvalue_p_1 (ref, treat_class_rvalues_as_lvalues) /* The "field" can be a FUNCTION_DECL or an OVERLOAD in some situations. */ && TREE_CODE (TREE_OPERAND (ref, 1)) == FIELD_DECL - && DECL_BIT_FIELD (TREE_OPERAND (ref, 1))) + && DECL_C_BIT_FIELD (TREE_OPERAND (ref, 1))) { /* Clear the ordinary bit. If this object was a class rvalue we want to preserve that information. */ diff --git a/gcc/testsuite/g++.old-deja/g++.other/bitfld4.C b/gcc/testsuite/g++.old-deja/g++.other/bitfld4.C new file mode 100644 index 0000000..ac0a378 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.other/bitfld4.C @@ -0,0 +1,25 @@ +// Build don't link: +// Origin: "Chen, Wen-Ke" + +template +bool operator!=(const T&, const T&); + +enum MsgType { + MSG_DATA +}; + +class C { +public: + MsgType mType : 8; +}; + +int main(void) +{ + extern C& c; + + c.mType = MSG_DATA; + if (c.mType != MSG_DATA) + return -1; + + return 0; +} -- 2.7.4