From e76d7cc71d8a0f3c56c54bfa6ce754efe084a445 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 22 Apr 2008 19:13:19 -0400 Subject: [PATCH] re PR c++/35316 (ICE with typeof/decltype and bit-fields) PR c++/35316 * semantics.c (finish_decltype_type): Check DECL_BIT_FIELD_TYPE to see if DECL_BIT_FIELD_TYPE should be used, not some other flag. * typeck.c (is_bitfield_expr_with_lowered_type): Likewise. From-SVN: r134571 --- gcc/cp/ChangeLog | 7 +++++++ gcc/cp/semantics.c | 2 +- gcc/cp/typeck.c | 2 +- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/cpp0x/decltype11.C | 12 ++++++++++++ 5 files changed, 26 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype11.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 71bb45ec65b..df321745b31 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +2008-04-22 Jason Merrill + + PR c++/35316 + * semantics.c (finish_decltype_type): Check DECL_BIT_FIELD_TYPE + to see if DECL_BIT_FIELD_TYPE should be used, not some other flag. + * typeck.c (is_bitfield_expr_with_lowered_type): Likewise. + 2008-04-22 Jakub Jelinek PR c++/35747 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index f31235b5625..7881a9faf1b 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -4174,7 +4174,7 @@ finish_decltype_type (tree expr, bool id_expression_or_member_access_p) switch (TREE_CODE (expr)) { case FIELD_DECL: - if (DECL_C_BIT_FIELD (expr)) + if (DECL_BIT_FIELD_TYPE (expr)) { type = DECL_BIT_FIELD_TYPE (expr); break; diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 9e9d46151a9..2e2aa179cdf 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -1507,7 +1507,7 @@ is_bitfield_expr_with_lowered_type (const_tree exp) tree field; field = TREE_OPERAND (exp, 1); - if (TREE_CODE (field) != FIELD_DECL || !DECL_C_BIT_FIELD (field)) + if (TREE_CODE (field) != FIELD_DECL || !DECL_BIT_FIELD_TYPE (field)) return NULL_TREE; if (same_type_ignoring_top_level_qualifiers_p (TREE_TYPE (exp), DECL_BIT_FIELD_TYPE (field))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 435f0814dca..28b643168f1 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2008-04-22 Jason Merrill + + PR c++/35316 + * g++.dg/cpp0x/decltype11.C: New. + 2008-04-23 Jakub Jelinek PR rtl-optimization/36017 diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype11.C b/gcc/testsuite/g++.dg/cpp0x/decltype11.C new file mode 100644 index 00000000000..ac32d349a6c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype11.C @@ -0,0 +1,12 @@ +// PR c++/35316 +// { dg-options "-std=c++0x" } + +template struct A +{ + int i : 2; + + void foo() + { + decltype(i) j; + } +}; -- 2.30.2