Index: libcxx/trunk/include/variant =================================================================== --- libcxx/trunk/include/variant +++ libcxx/trunk/include/variant @@ -1116,6 +1116,8 @@ template < class _Arg, enable_if_t, variant>, int> = 0, + enable_if_t>::value, int> = 0, + enable_if_t>::value, int> = 0, class _Tp = __variant_detail::__best_match_t<_Arg, _Types...>, size_t _Ip = __find_detail::__find_unambiguous_index_sfinae<_Tp, _Types...>::value, Index: libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/T.pass.cpp =================================================================== --- libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/T.pass.cpp +++ libcxx/trunk/test/std/utilities/variant/variant.variant/variant.ctor/T.pass.cpp @@ -37,6 +37,9 @@ NoThrowT(int) noexcept(true) {} }; +struct AnyConstructible { template AnyConstructible(T&&) {} }; +struct NoConstructible { NoConstructible() = delete; }; + void test_T_ctor_noexcept() { { using V = std::variant; @@ -62,6 +65,17 @@ static_assert(!std::is_constructible::value, "no matching constructor"); } + { + using V = std::variant; + static_assert( + !std::is_constructible>::value, + "no matching constructor"); + static_assert(!std::is_constructible>::value, + "no matching constructor"); + } + + + #if !defined(TEST_VARIANT_HAS_NO_REFERENCES) { using V = std::variant;