re PR c++/27979 (conversion check confused by enum bitfields)
authorMark Mitchell <mark@codesourcery.com>
Fri, 16 Jun 2006 23:12:08 +0000 (23:12 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 16 Jun 2006 23:12:08 +0000 (23:12 +0000)
PR c++/27979
* call.c (standard_conversion): Strip cv-qualifiers from bitfield
types.
PR c++/27979
* g++.dg/expr/bitfield2.C: New test.

From-SVN: r114733

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/expr/bitfield2.C [new file with mode: 0644]

index 28e17099b2ff812b297bac88f92cf0dba9483178..35001a03a4794f13073d8e6896c8faca8d53eab9 100644 (file)
@@ -1,5 +1,9 @@
 2006-06-16  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/27979
+       * call.c (standard_conversion): Strip cv-qualifiers from bitfield
+       types.
+
        PR c++/27884
        * decl.c (have_extern_spec): Remove.
        (start_decl): Do not check have_extern_spec.
index cd82732d11451755f1ed795306534581ef7e0d2b..970fce7ad220bd8798f6424c194a93df5f7241e8 100644 (file)
@@ -632,7 +632,7 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
          tree bitfield_type;
          bitfield_type = is_bitfield_expr_with_lowered_type (expr);
          if (bitfield_type)
-           from = bitfield_type;
+           from = strip_top_quals (bitfield_type);
        }
       conv = build_conv (ck_rvalue, from, conv);
     }
index a1eba47192b1e80b9b3531fc29dae860c33c0a05..b4cc183d964782ad0f7ca824e1a42219409c3c7b 100644 (file)
@@ -1,7 +1,10 @@
 2006-06-16  Mark Mitchell  <mark@codesourcery.com>
 
+       PR c++/27979
+       * g++.dg/expr/bitfield2.C: New test. 
+
        PR c++/27884
-       * g++.dg/parse/linkage2.C: New test
+       * g++.dg/parse/linkage2.C: New test.
 
 2006-06-16  Richard Guenther  <rguenther@suse.de>
 
diff --git a/gcc/testsuite/g++.dg/expr/bitfield2.C b/gcc/testsuite/g++.dg/expr/bitfield2.C
new file mode 100644 (file)
index 0000000..6599315
--- /dev/null
@@ -0,0 +1,9 @@
+// PR c++/27979
+
+class Ast
+{
+  enum AstKind { };
+  const AstKind kind : 8;
+  void foo(AstKind k) { }
+  void bar(void) { foo(kind); }
+};