[LoongArch] Supports FP_TO_SINT operation for fp16 (#118303)
[llvm-project.git] / libcxx / test / std / utilities / expected / expected.void / ctor / ctor.inplace.pass.cpp
blobc00d0df5288579275667046d630ec340b42261d5
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
11 // constexpr explicit expected(in_place_t) noexcept;
13 #include <cassert>
14 #include <expected>
15 #include <type_traits>
16 #include <utility>
18 // test explicit
19 static_assert(std::is_constructible_v<std::expected<void, int>, std::in_place_t>);
20 static_assert(!std::is_convertible_v<std::in_place_t, std::expected<void, int>>);
22 // test noexcept
23 static_assert(std::is_nothrow_constructible_v<std::expected<void, int>, std::in_place_t>);
25 constexpr bool test() {
26 std::expected<void, int> e(std::in_place);
27 assert(e.has_value());
29 return true;
32 int main(int, char**) {
33 test();
34 static_assert(test());
35 return 0;