This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/44158] [C++0x] wrong overload resolution for copy-initialization from an rvalue
- From: "paolo dot carlini at oracle dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 May 2010 21:25:29 -0000
- Subject: [Bug c++/44158] [C++0x] wrong overload resolution for copy-initialization from an rvalue
- References: <bug-44158-19147@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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_cast<X&&>(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