From 9a57678e2025fdeba421a0e572ce5535b604ae82 Mon Sep 17 00:00:00 2001 From: "zhongxiao.yzx" Date: Wed, 12 May 2021 14:40:14 +0800 Subject: [PATCH] Fix is_vector_type fail while building neon with clang or GCC > 10.0 GCC with version 10 onward does not treat intrinsic type(int8x16_t) and __vector_type(vector_size(16) int8_t) are the same which lead to is_vector_type failure. Meanwhile, clang use __attribute__((neon_vector_type)) is not same type with __attribute__((__vector_size__())) Above all, is_vector_type should be judged by logical "or" with the same and same ChangeLog: * experimental/bits/simd.h: refactor the is_vector_type taking vector_type and intrinsic_type as independent types --- experimental/bits/simd.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/experimental/bits/simd.h b/experimental/bits/simd.h index 4c893114f..5482cea6e 100644 --- a/experimental/bits/simd.h +++ b/experimental/bits/simd.h @@ -1398,12 +1398,19 @@ template > struct __is_vector_type : false_type {}; template - struct __is_vector_type< - _Tp, void_t()[0])>, sizeof(_Tp)>::type>> - : is_same<_Tp, typename __vector_type< - remove_reference_t()[0])>, - sizeof(_Tp)>::type> {}; +struct __is_vector_type< + _Tp, + enable_if_t()[0])>::type, + sizeof(_Tp)>::type>, + std::is_same< + _Tp, typename __intrinsic_type()[0])>::type, + sizeof(_Tp)>::type>>>> : true_type +{ +}; template inline constexpr bool __is_vector_type_v = __is_vector_type<_Tp>::value;