2 //===----------------------------------------------------------------------===//
4 // The LLVM Compiler Infrastructure
6 // This file is dual licensed under the MIT and the University of Illinois Open
7 // Source Licenses. See LICENSE.TXT for details.
9 //===----------------------------------------------------------------------===//
11 // UNSUPPORTED: c++98, c++03, c++11, c++14
13 // The following compilers don't consider a type an aggregate type (and
14 // consequently not a literal type) if it has a base class at all.
15 // In C++17, an aggregate type is allowed to have a base class if it's not
16 // virtual, private, nor protected (e.g. ConstexprTestTypes:::NoCtors).
17 // XFAIL: gcc-5, gcc-6
18 // XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8
19 // XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0
23 // template <class ...Types> class variant;
25 // constexpr bool valueless_by_exception() const noexcept;
29 #include <type_traits>
32 #include "archetypes.hpp"
33 #include "test_macros.h"
34 #include "variant_test_helpers.hpp"
38 using V = std::variant<int, ConstexprTestTypes::NoCtors>;
40 static_assert(!v.valueless_by_exception(), "");
43 using V = std::variant<int, long, std::string>;
45 assert(!v.valueless_by_exception());
47 #ifndef TEST_HAS_NO_EXCEPTIONS
49 using V = std::variant<int, MakeEmptyT>;
51 assert(!v.valueless_by_exception());
53 assert(v.valueless_by_exception());