cxx/test/std/experimental/any/any.class/any.cons/non_copyable_value.fail.cpp
Eric Fiselier 7175a07921 [libcxx] Add <experimental/any> v2.
Summary:
This patch adds the second revision of <experimental/any>. 
I've been working from the LFTS draft found at this link. https://rawgit.com/cplusplus/fundamentals-ts/v1/fundamentals-ts.html#any



Reviewers: danalbert, jroelofs, K-ballo, mclow.lists

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D6762

git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@243728 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-31 02:24:58 +00:00

37 lines
993 B
C++

//===----------------------------------------------------------------------===//
//
// 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>
// any::any<Value>(Value &&)
// Attempt to construct any 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(static_cast<non_copyable &&>(nc));
// expected-error@experimental/any:* 1 {{static_assert failed "_ValueType must be CopyConstructible."}}
// expected-error@experimental/any:* 1 {{calling a private constructor of class 'non_copyable'}}
}