1 //===----------------------------------------------------------------------===//
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
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
13 // template <class ...Types> class variant;
15 // constexpr bool valueless_by_exception() const noexcept;
19 #include <type_traits>
22 #include "archetypes.h"
23 #include "test_macros.h"
24 #include "variant_test_helpers.h"
27 int main(int, char**) {
29 using V
= std::variant
<int, long>;
31 static_assert(!v
.valueless_by_exception(), "");
34 using V
= std::variant
<int, long>;
36 assert(!v
.valueless_by_exception());
39 using V
= std::variant
<int, long, std::string
>;
41 assert(!v
.valueless_by_exception());
43 #ifndef TEST_HAS_NO_EXCEPTIONS
45 using V
= std::variant
<int, MakeEmptyT
>;
47 assert(!v
.valueless_by_exception());
49 assert(v
.valueless_by_exception());