]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Mark Mitchell <mark@codesourcery.com>
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 23 Mar 2007 04:31:21 +0000 (04:31 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 23 Mar 2007 04:31:21 +0000 (04:31 +0000)
PR c++/31273
* call.c (standard_conversion): Use type_decays_to.  Keep FCODE
consistent with FROM.
PR c++/31273
* g++.dg/expr/bitfield7.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123150 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 2a381230426d8c6aead1e62b88b9d20351ce3171..3de84b69166d74e075f6573a02ea8c4ed72ed2a1 100644 (file)
@@ -1,3 +1,10 @@
+2007-03-22  Jim Wilson  <wilson@specifix.com>
+           Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/31273
+       * call.c (standard_conversion): Use type_decays_to.  Keep FCODE
+       consistent with FROM.
+
 2007-03-22  Gabriel Dos Reis  <gdr@integrable-solutions.net>
 
        * error.c (dump_expr): Handle dependent names that designate types.
index 8218ed44e4249eabfe93cf61c5e5f9d40a7236c4..320e51c09ffadd55d7436ce45a473fd354b8fd9b 100644 (file)
@@ -636,15 +636,9 @@ standard_conversion (tree to, tree from, tree expr, bool c_cast_p,
   tcode = TREE_CODE (to);
 
   conv = build_identity_conv (from, expr);
-  if (fcode == FUNCTION_TYPE)
+  if (fcode == FUNCTION_TYPE || fcode == ARRAY_TYPE)
     {
-      from = build_pointer_type (from);
-      fcode = TREE_CODE (from);
-      conv = build_conv (ck_lvalue, from, conv);
-    }
-  else if (fcode == ARRAY_TYPE)
-    {
-      from = build_pointer_type (TREE_TYPE (from));
+      from = type_decays_to (from);
       fcode = TREE_CODE (from);
       conv = build_conv (ck_lvalue, from, conv);
     }
@@ -655,7 +649,10 @@ 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 = strip_top_quals (bitfield_type);
+           {
+             from = strip_top_quals (bitfield_type);
+             fcode = TREE_CODE (from);
+           }
        }
       conv = build_conv (ck_rvalue, from, conv);
     }
index a5f2623e291e6ca21b4bb3342a42231480971169..a22b4c88e9eb7f1e5bb76a2188a323872201cd2f 100644 (file)
@@ -1,3 +1,8 @@
+2007-03-22  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/31273
+       * g++.dg/expr/bitfield7.C: New test.
+
 2007-03-22  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
 
        PR other/23572
diff --git a/gcc/testsuite/g++.dg/expr/bitfield7.C b/gcc/testsuite/g++.dg/expr/bitfield7.C
new file mode 100644 (file)
index 0000000..d274e3e
--- /dev/null
@@ -0,0 +1,8 @@
+// PR c++/31273
+
+enum E { e };
+struct S {
+  E v:5;
+};
+S s;
+int main() { if (!s.v) return 0; }