[Bug c++/39126] Missing "move" constructor call (C++0x rvalue references)
gbrammer at gmx dot de
gcc-bugzilla@gcc.gnu.org
Thu May 7 19:05:00 GMT 2009
------- 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
More information about the Gcc-bugs
mailing list