brintos

brintos / llvm-project-archived public Read only

0
0
Text · 897 B · 9c7ba5a Raw
33 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: c++03, c++11, c++14, c++17, c++2010 11// explicit bad_expected_access(E e);12 13// Effects: Initializes unex with std::move(e).14 15#include <cassert>16#include <concepts>17#include <expected>18#include <utility>19 20#include "test_macros.h"21#include "MoveOnly.h"22 23// test explicit24static_assert(std::convertible_to<int, int>);25static_assert(!std::convertible_to<int, std::bad_expected_access<int>>);26 27int main(int, char**) {28  std::bad_expected_access<MoveOnly> b(MoveOnly{3});29  assert(b.error().get() == 3);30 31  return 0;32}33