diff --git a/libcxx/test/std/utilities/variant/variant.variant/variant.ctor/default.pass.cpp b/libcxx/test/std/utilities/variant/variant.variant/variant.ctor/default.pass.cpp index 26221e8a1f44..e4278f0e0abc 100644 --- a/libcxx/test/std/utilities/variant/variant.variant/variant.ctor/default.pass.cpp +++ b/libcxx/test/std/utilities/variant/variant.variant/variant.ctor/default.pass.cpp @@ -32,7 +32,7 @@ #include "variant_test_helpers.hpp" struct NonDefaultConstructible { - NonDefaultConstructible(int) {} + constexpr NonDefaultConstructible(int) {} }; struct NotNoexcept { @@ -98,6 +98,11 @@ void test_default_ctor_basic() { assert(v.index() == 0); assert(std::get<0>(v) == 0); } + { + std::variant v; + assert(v.index() == 0); + assert(std::get<0>(v) == 0); + } { using V = std::variant; constexpr V v; @@ -110,6 +115,12 @@ void test_default_ctor_basic() { static_assert(v.index() == 0, ""); static_assert(std::get<0>(v) == 0, ""); } + { + using V = std::variant; + constexpr V v; + static_assert(v.index() == 0, ""); + static_assert(std::get<0>(v) == 0, ""); + } } int main() { diff --git a/libcxx/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp b/libcxx/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp index 7ab828eb0bfb..6d78de3a48ba 100644 --- a/libcxx/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp +++ b/libcxx/test/std/utilities/variant/variant.variant/variant.status/index.pass.cpp @@ -10,14 +10,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// The following compilers don't consider a type an aggregate type (and -// consequently not a literal type) if it has a base class at all. -// In C++17, an aggregate type is allowed to have a base class if it's not -// virtual, private, nor protected (e.g. ConstexprTestTypes:::NoCtors). -// XFAIL: gcc-5, gcc-6 -// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 -// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 - // // template class variant; @@ -33,14 +25,18 @@ #include "test_macros.h" #include "variant_test_helpers.hpp" + int main() { -#if TEST_STD_VER == 17 - { // This test does not pass on C++20 or later; see https://bugs.llvm.org/show_bug.cgi?id=39232 - using V = std::variant; + { + using V = std::variant; constexpr V v; static_assert(v.index() == 0, ""); } -#endif + { + using V = std::variant; + V v; + assert(v.index() == 0); + } { using V = std::variant; constexpr V v(std::in_place_index<1>); diff --git a/libcxx/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp b/libcxx/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp index be021917d6dd..9ccdc2221994 100644 --- a/libcxx/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp +++ b/libcxx/test/std/utilities/variant/variant.variant/variant.status/valueless_by_exception.pass.cpp @@ -10,14 +10,6 @@ // UNSUPPORTED: c++98, c++03, c++11, c++14 -// The following compilers don't consider a type an aggregate type (and -// consequently not a literal type) if it has a base class at all. -// In C++17, an aggregate type is allowed to have a base class if it's not -// virtual, private, nor protected (e.g. ConstexprTestTypes:::NoCtors). -// XFAIL: gcc-5, gcc-6 -// XFAIL: clang-3.5, clang-3.6, clang-3.7, clang-3.8 -// XFAIL: apple-clang-6, apple-clang-7, apple-clang-8.0 - // // template class variant; @@ -33,14 +25,18 @@ #include "test_macros.h" #include "variant_test_helpers.hpp" + int main() { -#if TEST_STD_VER == 17 - { // This test does not pass on C++20 or later; see https://bugs.llvm.org/show_bug.cgi?id=39232 - using V = std::variant; + { + using V = std::variant; constexpr V v; static_assert(!v.valueless_by_exception(), ""); } -#endif + { + using V = std::variant; + V v; + assert(!v.valueless_by_exception()); + } { using V = std::variant; const V v("abc");