Index: test/std/utilities/variant/variant.get/get_index.pass.cpp =================================================================== --- test/std/utilities/variant/variant.get/get_index.pass.cpp +++ test/std/utilities/variant/variant.get/get_index.pass.cpp @@ -37,8 +37,10 @@ { using V = std::variant; constexpr V v(42); -#ifndef __clang__ // Avoid https://bugs.llvm.org/show_bug.cgi?id=15481 +#ifdef TEST_WORKAROUND_CONSTEXPR_IMPLIES_NOEXCEPT ASSERT_NOEXCEPT(std::get<0>(v)); +#else + ASSERT_NOT_NOEXCEPT(std::get<0>(v)); #endif ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &); static_assert(std::get<0>(v) == 42, ""); @@ -53,8 +55,10 @@ { using V = std::variant; constexpr V v(42l); -#ifndef __clang__ // Avoid https://bugs.llvm.org/show_bug.cgi?id=15481 +#ifdef TEST_WORKAROUND_CONSTEXPR_IMPLIES_NOEXCEPT ASSERT_NOEXCEPT(std::get<1>(v)); +#else + ASSERT_NOT_NOEXCEPT(std::get<1>(v)); #endif ASSERT_SAME_TYPE(decltype(std::get<1>(v)), const long &); static_assert(std::get<1>(v) == 42, ""); Index: test/std/utilities/variant/variant.get/get_type.pass.cpp =================================================================== --- test/std/utilities/variant/variant.get/get_type.pass.cpp +++ test/std/utilities/variant/variant.get/get_type.pass.cpp @@ -31,24 +31,28 @@ { using V = std::variant; constexpr V v(42); -#ifndef __clang__ // Avoid https://bugs.llvm.org/show_bug.cgi?id=15481 +#ifdef TEST_WORKAROUND_CONSTEXPR_IMPLIES_NOEXCEPT ASSERT_NOEXCEPT(std::get(v)); +#else + ASSERT_NOT_NOEXCEPT(std::get(v)); #endif - ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &); + ASSERT_SAME_TYPE(decltype(std::get(v)), const int &); static_assert(std::get(v) == 42, ""); } { using V = std::variant; const V v(42); ASSERT_NOT_NOEXCEPT(std::get(v)); - ASSERT_SAME_TYPE(decltype(std::get<0>(v)), const int &); + ASSERT_SAME_TYPE(decltype(std::get(v)), const int &); assert(std::get(v) == 42); } { using V = std::variant; constexpr V v(42l); -#ifndef __clang__ // Avoid https://bugs.llvm.org/show_bug.cgi?id=15481 +#ifdef TEST_WORKAROUND_CONSTEXPR_IMPLIES_NOEXCEPT ASSERT_NOEXCEPT(std::get(v)); +#else + ASSERT_NOT_NOEXCEPT(std::get(v)); #endif ASSERT_SAME_TYPE(decltype(std::get(v)), const long &); static_assert(std::get(v) == 42, ""); Index: test/support/test_workarounds.h =================================================================== --- test/support/test_workarounds.h +++ test/support/test_workarounds.h @@ -23,4 +23,10 @@ # endif #endif +#if defined(TEST_COMPILER_GCC) +# if __GNUC__ < 9 +# define TEST_WORKAROUND_CONSTEXPR_IMPLIES_NOEXCEPT // GCC PR 87603 +# endif +#endif + #endif // SUPPORT_TEST_WORKAROUNDS_H