@@ -22,46 +22,31 @@ template <int dimensions = 1> class array {
2222 static_assert (dimensions >= 1 , " Array cannot be 0-dimensional." );
2323
2424public:
25- /* TODO: use common_array initialization via initialization list in
26- * constructor when memset conversion between SPIR-V and LLVM IR formats
27- * will be fixed in SPIR-V translator. */
28- template <int N = dimensions, detail::enable_if_t <(N == 1 ), size_t > = 0 >
29- array () {
30- common_array[0 ] = 0 ;
31- }
32-
33- template <int N = dimensions, detail::enable_if_t <(N == 2 ), size_t > = 0 >
34- array () {
35- common_array[0 ] = 0 ;
36- common_array[1 ] = 0 ;
37- }
38-
39- template <int N = dimensions, detail::enable_if_t <(N == 3 ), size_t > = 0 >
40- array () {
41- common_array[0 ] = 0 ;
42- common_array[1 ] = 0 ;
43- common_array[2 ] = 0 ;
44- }
45-
4625 /* The following constructor is only available in the array struct
4726 * specialization where: dimensions==1 */
4827 template <int N = dimensions>
49- array (typename std::enable_if<(N == 1 ), size_t >::type dim0)
28+ array (typename std::enable_if<(N == 1 ), size_t >::type dim0 = 0 )
5029 : common_array{dim0} {}
5130
52- /* The following constructor is only available in the array struct
31+ /* The following constructors are only available in the array struct
5332 * specialization where: dimensions==2 */
5433 template <int N = dimensions>
5534 array (typename std::enable_if<(N == 2 ), size_t >::type dim0, size_t dim1)
5635 : common_array{dim0, dim1} {}
5736
58- /* The following constructor is only available in the array struct
37+ template <int N = dimensions, detail::enable_if_t <(N == 2 ), size_t > = 0 >
38+ array () : array(0 , 0 ) {}
39+
40+ /* The following constructors are only available in the array struct
5941 * specialization where: dimensions==3 */
6042 template <int N = dimensions>
6143 array (typename std::enable_if<(N == 3 ), size_t >::type dim0, size_t dim1,
6244 size_t dim2)
6345 : common_array{dim0, dim1, dim2} {}
6446
47+ template <int N = dimensions, detail::enable_if_t <(N == 3 ), size_t > = 0 >
48+ array () : array(0 , 0 , 0 ) {}
49+
6550 // Conversion operators to derived classes
6651 operator cl::sycl::id<dimensions>() const {
6752 cl::sycl::id<dimensions> result;
0 commit comments