xref: /llvm-project/libcxx/test/std/utilities/expected/expected.unexpected/ctad.compile.pass.cpp (revision 6a54dfbfe534276d644d7f9c027f0deeb748dd53)
1e356f681SHui Xie //===----------------------------------------------------------------------===//
2*6a54dfbfSLouis Dionne //
3e356f681SHui Xie // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4e356f681SHui Xie // See https://llvm.org/LICENSE.txt for license information.
5e356f681SHui Xie // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6e356f681SHui Xie //
7e356f681SHui Xie //===----------------------------------------------------------------------===//
8e356f681SHui Xie 
9e356f681SHui Xie // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
10e356f681SHui Xie 
11e356f681SHui Xie // template<class E> unexpected(E) -> unexpected<E>;
12e356f681SHui Xie 
13e356f681SHui Xie #include <concepts>
14e356f681SHui Xie #include <expected>
15e356f681SHui Xie 
16e356f681SHui Xie struct Foo{};
17e356f681SHui Xie 
18e356f681SHui Xie static_assert(std::same_as<decltype(std::unexpected(5)), std::unexpected<int>>);
19e356f681SHui Xie static_assert(std::same_as<decltype(std::unexpected(Foo{})), std::unexpected<Foo>>);
20e356f681SHui Xie static_assert(std::same_as<decltype(std::unexpected(std::unexpected<int>(5))), std::unexpected<int>>);
21