• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 // any::any<Value>(Value &&)
15 
16 // Attempt to construct any with a non-copyable type.
17 
18 #include <experimental/any>
19 
20 class non_copyable
21 {
22     non_copyable(non_copyable const &);
23 
24 public:
non_copyable()25     non_copyable() {}
non_copyable(non_copyable &&)26     non_copyable(non_copyable &&) {}
27 };
28 
main()29 int main()
30 {
31     using namespace std::experimental;
32     non_copyable nc;
33     any a(static_cast<non_copyable &&>(nc));
34     // expected-error@experimental/any:* 1 {{static_assert failed "_ValueType must be CopyConstructible."}}
35     // expected-error@experimental/any:* 1 {{calling a private constructor of class 'non_copyable'}}
36 }
37