1 //===----------------------------------------------------------------------===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is dual licensed under the MIT and the University of Illinois Open 6 // Source Licenses. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 10 // UNSUPPORTED: c++98, c++03, c++11 11 12 // <experimental/any> 13 14 // template <class Value> 15 // any& operator=(Value &&); 16 17 // Instantiate the value assignment operator with a non-copyable type. 18 19 #include <experimental/any> 20 21 class non_copyable 22 { 23 non_copyable(non_copyable const &); 24 25 public: non_copyable()26 non_copyable() {} non_copyable(non_copyable &&)27 non_copyable(non_copyable &&) {} 28 }; 29 main()30int main() 31 { 32 using namespace std::experimental; 33 non_copyable nc; 34 any a; 35 a = static_cast<non_copyable &&>(nc); // expected-error@experimental/any:* 2 {{static_assert failed "_ValueType must be CopyConstructible."}} 36 // expected-error@experimental/any:* {{calling a private constructor of class 'non_copyable'}} 37 38 } 39