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