re PR c++/44158 ([C++0x] wrong overload resolution for copy-initialization from an...
authorJason Merrill <jason@redhat.com>
Mon, 17 May 2010 19:53:45 +0000 (15:53 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 17 May 2010 19:53:45 +0000 (15:53 -0400)
PR c++/44158
* call.c (build_over_call): Don't do bitwise copy for move ctor.

From-SVN: r159508

gcc/cp/ChangeLog
gcc/cp/call.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C

index acc111f7569690a09b7106430443cfd44d721395..f06c6cd481af9bb06c5b328bf6b92882125498cc 100644 (file)
@@ -1,3 +1,8 @@
+2010-05-17  Jason Merrill  <jason@redhat.com>
+
+       PR c++/44158
+       * call.c (build_over_call): Don't do bitwise copy for move ctor.
+
 2010-05-17  Dodji Seketeli  <dodji@redhat.com>
            Jason Merrill  <jason@redhat.com>
 
index c0639920cf9208dca11eb766d94489b3b060380c..5d1300709c9a1d930110b1df27a32332aa797041 100644 (file)
@@ -5776,7 +5776,8 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
        }
       /* [class.copy]: the copy constructor is implicitly defined even if
         the implementation elided its use.  */
-      else if (TYPE_HAS_COMPLEX_INIT_REF (DECL_CONTEXT (fn)))
+      else if (TYPE_HAS_COMPLEX_INIT_REF (DECL_CONTEXT (fn))
+              || move_fn_p (fn))
        {
          mark_used (fn);
          already_used = true;
@@ -5794,7 +5795,8 @@ build_over_call (struct z_candidate *cand, int flags, tsubst_flags_t complain)
        {
          if (TREE_CODE (arg) == TARGET_EXPR)
            return arg;
-         else if (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn)))
+         else if (TYPE_HAS_TRIVIAL_INIT_REF (DECL_CONTEXT (fn))
+                  && !move_fn_p (fn))
            return build_target_expr_with_type (arg, DECL_CONTEXT (fn));
        }
       else if (TREE_CODE (arg) == TARGET_EXPR
index 17b9c512f17b9821edc0f5e10626e7dcbe428f5d..67cd4ad1e88f9346e8b71d714bb9821f5159d156 100644 (file)
@@ -1,3 +1,8 @@
+2010-05-17  Jason Merrill  <jason@redhat.com>
+
+       PR c++/44158
+       * g++.dg/cpp0x/rv-trivial-bug.C: Test copy-init too.
+
 2010-05-17  Martin Jambor  <mjambor@suse.cz>
 
        * g++.dg/ipa/ivinline-1.C: New test.
index de52d0f48f64169cdc5066982548f3302d692bd1..beb8acb5a501a766d580c9b740156875bc666b0d 100644 (file)
@@ -19,7 +19,8 @@ int test2()
     base2 b2(b);
     assert(move_construct == 0);
     base2 b3(static_cast<base2&&>(b));
-    assert(move_construct == 1);
+    base2 b4 = static_cast<base2&&>(b);
+    assert(move_construct == 2);
     b = b2;
     assert(move_assign == 0);
     b = static_cast<base2&&>(b2);