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 unexpected(const unexpected&) = default;
11
12#include <cassert>
13#include <expected>
14
15struct Error {
16 int i;
17 constexpr Error(int ii) : i(ii) {}
18};
19
20constexpr bool test() {
21 const std::unexpected<Error> unex(5);
22 auto unex2 = unex;
23 assert(unex2.error().i == 5);
24 return true;
25}
26
27int main(int, char**) {
28 test();
29 static_assert(test());
30 return 0;
31}
32

source code of libcxx/test/std/utilities/expected/expected.unexpected/ctor/ctor.copy.pass.cpp