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