[Bug c++/44158] [C++0x] wrong overload resolution for copy-initialization from an rvalue
--- Comment #8 from jason at gcc dot gnu dot org 2010-05-19 15:49 --- Subject: Bug 44158 Author: jason Date: Wed May 19 15:49:01 2010 New Revision: 159577 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=159577 Log: PR c++/44158 * call.c (build_over_call): Don't do bitwise copy for move ctor. Modified: branches/gcc-4_5-branch/gcc/cp/ChangeLog branches/gcc-4_5-branch/gcc/cp/call.c branches/gcc-4_5-branch/gcc/testsuite/ChangeLog branches/gcc-4_5-branch/gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44158
[Bug c++/44158] [C++0x] wrong overload resolution for copy-initialization from an rvalue
--- Comment #9 from jason at gcc dot gnu dot org 2010-05-19 16:10 --- Fixed for 4.5.1. -- jason at gcc dot gnu dot org changed: What|Removed |Added Status|ASSIGNED|RESOLVED Resolution||FIXED Target Milestone|--- |4.5.1 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44158
[Bug c++/44158] [C++0x] wrong overload resolution for copy-initialization from an rvalue
--- Comment #7 from jason at gcc dot gnu dot org 2010-05-17 19:54 --- Subject: Bug 44158 Author: jason Date: Mon May 17 19:53:45 2010 New Revision: 159508 URL: http://gcc.gnu.org/viewcvs?root=gccview=revrev=159508 Log: PR c++/44158 * call.c (build_over_call): Don't do bitwise copy for move ctor. Modified: trunk/gcc/cp/ChangeLog trunk/gcc/cp/call.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/g++.dg/cpp0x/rv-trivial-bug.C -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44158
[Bug c++/44158] [C++0x] wrong overload resolution for copy-initialization from an rvalue
--- Comment #1 from redi at gcc dot gnu dot org 2010-05-16 17:07 --- The rules say that for copy-initialization where the source type (X) is not the same as the destination type (X) a temporary is created. That temporary is copy-constructed from x, then y is move-constructed from the temporary. To avoid the temporary use direct-initialization; Y y( static_castX(x) ); -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44158
[Bug c++/44158] [C++0x] wrong overload resolution for copy-initialization from an rvalue
--- Comment #2 from redi at gcc dot gnu dot org 2010-05-16 17:08 --- (In reply to comment #1) Y y( static_castX(x) ); ^ Oops. I meant X not Y -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44158
[Bug c++/44158] [C++0x] wrong overload resolution for copy-initialization from an rvalue
--- Comment #3 from paolo dot carlini at oracle dot com 2010-05-16 18:29 --- This is invalid then. -- paolo dot carlini at oracle dot com changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44158
[Bug c++/44158] [C++0x] wrong overload resolution for copy-initialization from an rvalue
--- Comment #4 from redi at gcc dot gnu dot org 2010-05-16 19:34 --- it might be a valid enhancement request, as I think the temporary is eligible for copy-elision (Jason?) but the compiler isn't required to elide it, so it is wrong to assert that a temporary won't be created -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44158
[Bug c++/44158] [C++0x] wrong overload resolution for copy-initialization from an rvalue
--- Comment #5 from paolo dot carlini at oracle dot com 2010-05-16 21:25 --- To be safe, let's reopen the bug. For the record, this works: #include cassert struct X { X(int i) : i_(i) {} X(X x) : i_(x.i_) { x.i_ = 0; } int i_; X(const X) = delete; }; int main() { X x(42); X y = static_castX(x); assert( y.i_ == 42 ); assert( x.i_ == 0 ); } -- paolo dot carlini at oracle dot com changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44158
[Bug c++/44158] [C++0x] wrong overload resolution for copy-initialization from an rvalue
--- Comment #6 from jason at gcc dot gnu dot org 2010-05-16 22:32 --- (In reply to comment #1) The rules say that for copy-initialization where the source type (X) is not the same as the destination type (X) a temporary is created. But the source type is X; there are no expressions of reference type. The problem is not the overload resolution, but that build_over_call looks at TYPE_HAS_COMPLEX_INIT_REF even though we're dealing with the move ctor, not the copy ctor. -- jason at gcc dot gnu dot org changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|-00-00 00:00:00 |2010-05-16 22:32:43 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44158
[Bug c++/44158] [C++0x] wrong overload resolution for copy-initialization from an rvalue
-- jason at gcc dot gnu dot org changed: What|Removed |Added AssignedTo|unassigned at gcc dot gnu |jason at gcc dot gnu dot org |dot org | Status|NEW |ASSIGNED Last reconfirmed|2010-05-16 22:32:43 |2010-05-16 23:21:43 date|| http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44158