[Bug c++/39126] Missing move constructor call (C++0x rvalue references)
--- Comment #3 from gbrammer at gmx dot de 2009-05-08 19:17 --- Well, I am sure that it shouldn't be created, but rereading the spec (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2118.html 12.8) I noticed that this bug is not in g++, but by design. I had hoped that rvalue references were a replacement for the ability to pass temporaries to non-const references present in g++ up to version 4.1 and Microsoft's C++ compilers, but apparently one has to be very very careful using them. Well, at least I now only have to worry about the code, not the compiler. -- gbrammer at gmx dot de changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution||INVALID http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39126
[Bug c++/39126] Missing move constructor call (C++0x rvalue references)
--- Comment #1 from gbrammer at gmx dot de 2009-05-07 19:05 --- Still happens with g++-4.4 (Debian 4.4.0-4) 4.4.1. Here's a version with printfs in the destructor and constructors: extern C { int printf(const char *format, ...); } struct Foo { Foo(Foo from) { printf(move constructor\n); } Foo() { printf(constructor\n); } ~Foo() { printf(destructor\n); } /*private: Foo(const Foo from) { printf(copy constructor\n); }*/ }; Foo CreateFoo(bool b) { Foo f; if (b) return Foo(); return f; } int main () { Foo f(CreateFoo(false)); } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39126
[Bug c++/39126] Missing move constructor call (C++0x rvalue references)
--- Comment #2 from pinskia at gcc dot gnu dot org 2009-05-07 19:09 --- Are you sure that an implicit copy constructor is not supposed to be created here? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39126