blob: 60230cc6373585a175b745b21c4ef90a7143bd0a [file] [log] [blame]
Tim Shen403c6672018-04-23 21:54:06 +00001//===----------------------------------------------------------------------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is dual licensed under the MIT and the University of Illinois Open
6// Source Licenses. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
Tim Shen6f33ea42018-07-30 22:21:22 +000010// UNSUPPORTED: c++98, c++03
Tim Shen403c6672018-04-23 21:54:06 +000011
12// See GCC PR63723.
13// UNSUPPORTED: gcc-4.9
14
15// <experimental/simd>
16//
17// [simd.class]
18// template <class U> simd(U&& value);
19
20#include <cstdint>
21#include <experimental/simd>
22
Tim Shen6f33ea42018-07-30 22:21:22 +000023using namespace std::experimental::parallelism_v2;
Tim Shen403c6672018-04-23 21:54:06 +000024
25template <class T, class... Args>
26auto not_supported_native_simd_ctor(Args&&... args)
Tim Shen6f33ea42018-07-30 22:21:22 +000027 -> decltype(native_simd<T>(std::forward<Args>(args)...), void()) = delete;
Tim Shen403c6672018-04-23 21:54:06 +000028
29template <class T>
30void not_supported_native_simd_ctor(...) {}
31
32template <class T, class... Args>
33auto supported_native_simd_ctor(Args&&... args)
Tim Shen6f33ea42018-07-30 22:21:22 +000034 -> decltype(native_simd<T>(std::forward<Args>(args)...), void()) {}
Tim Shen403c6672018-04-23 21:54:06 +000035
36template <class T>
37void supported_native_simd_ctor(...) = delete;
38
39void compile_narrowing_conversion() {
40 supported_native_simd_ctor<int8_t>(3);
41 supported_native_simd_ctor<int16_t>(3);
42 supported_native_simd_ctor<int32_t>(3);
43 supported_native_simd_ctor<int64_t>(3);
44 supported_native_simd_ctor<uint8_t>(3);
45 supported_native_simd_ctor<uint16_t>(3);
46 supported_native_simd_ctor<uint32_t>(3);
47 supported_native_simd_ctor<uint64_t>(3);
48 supported_native_simd_ctor<float>(3.f);
49 supported_native_simd_ctor<double>(3.);
50 supported_native_simd_ctor<long double>(3.);
51
52 not_supported_native_simd_ctor<float>(3.);
53 not_supported_native_simd_ctor<int8_t>(long(3));
54 not_supported_native_simd_ctor<float>(long(3));
55 not_supported_native_simd_ctor<int>(3.);
56}
57
Tim Shen6f33ea42018-07-30 22:21:22 +000058int main() {}