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 cause compiler declared
5 // copy ctor or assignment to be deleted.
7 // { dg-do compile { target c++11 } }
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;}
27 struct derived // { dg-message "declares a move" }
32 derived& operator=(derived&&) {return *this;}
38 derived d2(static_cast<derived&&>(d)); // should not call base::(const base&)
40 derived d3(d); // { dg-error "deleted" }
42 d2 = static_cast<derived&&>(d); // should not call base::operator=
44 d3 = d; // { dg-error "deleted" }