1//===----------------------------------------------------------------------===//
2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
3// See https://llvm.org/LICENSE.txt for license information.
4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5//
6//===----------------------------------------------------------------------===//
7
8// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
9
10// constexpr explicit expected(in_place_t) noexcept;
11
12#include <cassert>
13#include <expected>
14#include <type_traits>
15#include <utility>
16
17// test explicit
18static_assert(std::is_constructible_v<std::expected<void, int>, std::in_place_t>);
19static_assert(!std::is_convertible_v<std::in_place_t, std::expected<void, int>>);
20
21// test noexcept
22static_assert(std::is_nothrow_constructible_v<std::expected<void, int>, std::in_place_t>);
23
24constexpr bool test() {
25 std::expected<void, int> e(std::in_place);
26 assert(e.has_value());
27
28 return true;
29}
30
31int main(int, char**) {
32 test();
33 static_assert(test());
34 return 0;
35}
36

source code of libcxx/test/std/utilities/expected/expected.void/ctor/ctor.inplace.pass.cpp