in_place_t.pass.cpp revision 0cdbe6048173c1f05628dbc85430acf191a3e173
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// <optional>
11
12// struct in_place_t{};
13// constexpr in_place_t in_place{};
14
15#include <experimental/optional>
16#include <type_traits>
17
18#if _LIBCPP_STD_VER > 11
19
20using std::experimental::optional;
21using std::experimental::in_place_t;
22using std::experimental::in_place;
23
24constexpr
25int
26test(const in_place_t&)
27{
28    return 3;
29}
30
31#endif
32
33int main()
34{
35#if _LIBCPP_STD_VER > 11
36
37    static_assert((std::is_class<in_place_t>::value), "");
38    static_assert((std::is_empty<in_place_t>::value), "");
39
40    static_assert(test(in_place) == 3, "");
41#endif
42}
43