@@ -1350,7 +1350,7 @@ template <typename _Tp>
13501350struct _VectorTraitsImpl <_Tp, enable_if_t <__is_vector_type_v<_Tp>>>
13511351{
13521352 using type = _Tp;
1353- using value_type = decltype (std::declval<_Tp>()[0 ]);
1353+ using value_type = std:: remove_reference_t < decltype (std::declval<_Tp>()[0 ])> ;
13541354 static constexpr int _S_width = sizeof (_Tp) / sizeof (value_type);
13551355 using _Wrapper = _SimdWrapper<value_type, _S_width>;
13561356 template <typename _Up, int _W = _S_width>
@@ -1610,11 +1610,16 @@ __or(_Tp __a, _Tp __b) noexcept
16101610
16111611// }}}
16121612// __and{{{
1613- template <typename _Tp, typename _TVT = _VectorTraits<_Tp>, typename ... _Dummy>
1614- _GLIBCXX_SIMD_INTRINSIC constexpr _Tp
1615- __and (_Tp __a, typename _TVT::type __b, _Dummy...) noexcept
1613+ template <typename _Tp>
1614+ constexpr auto __test_and_operator (int ) -> decltype(_Tp() & _Tp(), std::true_type{});
1615+
1616+ template <typename _Tp>
1617+ constexpr std::false_type __test_and_operator (...);
1618+
1619+ template <typename _Tp, typename _TVT = _VectorTraits<_Tp>>
1620+ _GLIBCXX_SIMD_INTRINSIC constexpr std::enable_if_t <!decltype (__test_and_operator<_Tp>(0 ))::value, _Tp>
1621+ __and (_Tp __a, typename _TVT::type __b) noexcept
16161622{
1617- static_assert (sizeof ...(_Dummy) == 0 );
16181623 using _Up = typename _TVT::value_type;
16191624 using _Ip = make_unsigned_t <__int_for_sizeof_t <_Up>>;
16201625 return __vector_bitcast<_Up>(__vector_bitcast<_Ip>(__a)
0 commit comments