1 // I, Howard Hinnant, hereby place this code in the public domain.
3 // Test that move constructor and move assignement are special.
4 // That is, their presence should inhibit compiler generated
5 // copy ctor or assignment.
7 // { dg-options "-std=c++0x" }
11 template <bool> struct sa;
12 template <> struct sa<true> {};
14 struct one {char x[1];};
15 struct two {char x[2];};
23 base(const base&) {++copy;}
24 base& operator=(const base&) {++assign; return *this;}
31 derived(derived&&) {} // { dg-error "argument 1" }
32 derived& operator=(derived&&) {return *this;} // { dg-error "argument 1" }
38 derived d2(static_cast<derived&&>(d)); // should not call base::(const base&)
40 derived d3(d); // { dg-error "lvalue" }
42 d2 = static_cast<derived&&>(d); // should not call base::operator=
44 d3 = d; // { dg-error "lvalue" }