re PR c++/35316 (ICE with typeof/decltype and bit-fields)
authorJason Merrill <jason@redhat.com>
Tue, 22 Apr 2008 23:13:19 +0000 (19:13 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Tue, 22 Apr 2008 23:13:19 +0000 (19:13 -0400)
        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
gcc/cp/semantics.c
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/decltype11.C [new file with mode: 0644]

index 71bb45ec65be01526d627f9cbaa55888020427e2..df321745b31262097f9cf2b79e7fcfdb5c9ca94c 100644 (file)
@@ -1,3 +1,10 @@
+2008-04-22  Jason Merrill  <jason@redhat.com>
+
+       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  <jakub@redhat.com>
 
        PR c++/35747
index f31235b5625ba2f485b0dcf43c000fac1682c323..7881a9faf1be093dd3241bb0e1fc50e30646bb27 100644 (file)
@@ -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;
index 9e9d46151a92c75faaec67cda7e3dbf11a618c02..2e2aa179cdf860d622a9320f5b9a894001c1d5da 100644 (file)
@@ -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)))
index 435f0814dcae3b03eccaf161243d583bec3a49e2..28b643168f172fcbf7bfed244770e17a80d295af 100644 (file)
@@ -1,3 +1,8 @@
+2008-04-22  Jason Merrill  <jason@redhat.com>
+
+       PR c++/35316
+       * g++.dg/cpp0x/decltype11.C: New.
+
 2008-04-23  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..ac32d34
--- /dev/null
@@ -0,0 +1,12 @@
+// PR c++/35316
+// { dg-options "-std=c++0x" }
+
+template<int> struct A
+{
+  int i : 2;
+
+  void foo()
+  {
+    decltype(i) j;
+  }
+};