diff options
Diffstat (limited to 'test/std/experimental/simd/simd.cons/broadcast.pass.cpp')
| -rw-r--r-- | test/std/experimental/simd/simd.cons/broadcast.pass.cpp | 38 |
1 files changed, 33 insertions, 5 deletions
diff --git a/test/std/experimental/simd/simd.cons/broadcast.pass.cpp b/test/std/experimental/simd/simd.cons/broadcast.pass.cpp index 60230cc63735..49b2b5572842 100644 --- a/test/std/experimental/simd/simd.cons/broadcast.pass.cpp +++ b/test/std/experimental/simd/simd.cons/broadcast.pass.cpp @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// -// UNSUPPORTED: c++98, c++03 +// UNSUPPORTED: c++98, c++03, c++11, c++14 // See GCC PR63723. // UNSUPPORTED: gcc-4.9 @@ -20,18 +20,19 @@ #include <cstdint> #include <experimental/simd> -using namespace std::experimental::parallelism_v2; +namespace ex = std::experimental::parallelism_v2; template <class T, class... Args> auto not_supported_native_simd_ctor(Args&&... args) - -> decltype(native_simd<T>(std::forward<Args>(args)...), void()) = delete; + -> decltype(ex::native_simd<T>(std::forward<Args>(args)...), + void()) = delete; template <class T> void not_supported_native_simd_ctor(...) {} template <class T, class... Args> auto supported_native_simd_ctor(Args&&... args) - -> decltype(native_simd<T>(std::forward<Args>(args)...), void()) {} + -> decltype(ex::native_simd<T>(std::forward<Args>(args)...), void()) {} template <class T> void supported_native_simd_ctor(...) = delete; @@ -55,4 +56,31 @@ void compile_narrowing_conversion() { not_supported_native_simd_ctor<int>(3.); } -int main() {} +void compile_convertible() { + struct ConvertibleToInt { + operator int64_t() const; + }; + supported_native_simd_ctor<int64_t>(ConvertibleToInt()); + + struct NotConvertibleToInt {}; + not_supported_native_simd_ctor<int64_t>(NotConvertibleToInt()); +} + +void compile_unsigned() { + not_supported_native_simd_ctor<int>(3u); + supported_native_simd_ctor<uint16_t>(3u); +} + +template <typename SimdType> +void test_broadcast() { + SimdType a(3); + for (size_t i = 0; i < a.size(); i++) { + assert(a[i] == 3); + } +} + +int main() { + test_broadcast<ex::native_simd<int>>(); + test_broadcast<ex::fixed_size_simd<int, 4>>(); + test_broadcast<ex::fixed_size_simd<int, 15>>(); +} |
