Inconsistency since `marray` is `constexpr` while `half` is not
nilsfriess opened this issue · comments
According to the spec, the constructors of marray
should be constexpr
. Also, marray
should accept sycl::half
as element type (see 4.14.3 where it says "The element type parameter, DataT, must be a numeric type as it is defined by C++ standard."; sycl::half
is a numeric type).
Hence, the following should compile
constexpr sycl::marray m{sycl::half{1}};
However, the spec does not require half
to be constexpr-constructible and in C++17 this is basically impossible to achieve without using builtins that allow compile time bitcasts.
How should implementations handle this? Should there be a non-constexpr marray
overload for DataT == sycl::half
?
Note: This is related to Khronos internal issue 455.
constexpr bitcast needs compiler support, no way to do in C++17, maybe 23; so the only way is special case half so marray is not constexpr for half, also affects vec class