Skip to content

Commit cb6c058

Browse files
authored
[SYCL] Add noexcept specifier to vec::byte_size (#8889)
Signed-off-by: Michael Aziz <[email protected]>
1 parent d190de6 commit cb6c058

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

sycl/include/sycl/types.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ template <typename Type, int NumElements> class vec {
916916
__SYCL2020_DEPRECATED(
917917
"get_size() is deprecated, please use byte_size() instead")
918918
static constexpr size_t get_size() { return byte_size(); }
919-
static constexpr size_t byte_size() { return sizeof(m_Data); }
919+
static constexpr size_t byte_size() noexcept { return sizeof(m_Data); }
920920
921921
template <typename convertT,
922922
rounding_mode roundingMode = rounding_mode::automatic>

sycl/test-e2e/Basic/vector_operators.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ template <typename T, int N> void check_vector_size() {
3535
constexpr auto length = (N == 3 ? 4 : N);
3636
assert(Vec.size() == N);
3737
assert(Vec.byte_size() == sizeof(T) * length);
38+
static_assert(noexcept(Vec.byte_size()));
3839
}
3940

4041
int main() {

0 commit comments

Comments
 (0)