Commit c8361db1 by Jason Merrill Committed by Jason Merrill

re PR c++/44158 ([C++0x] wrong overload resolution for copy-initialization from an rvalue)

	PR c++/44158
	* call.c (build_over_call): Don't do bitwise copy for move ctor.

From-SVN: r159508
parent b258210c
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>
......
......@@ -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
......
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.
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment