Skip to content

[SYCL] Add noexcept specifier to vec::byte_size #8889

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sycl/include/sycl/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ template <typename Type, int NumElements> class vec {
__SYCL2020_DEPRECATED(
"get_size() is deprecated, please use byte_size() instead")
static constexpr size_t get_size() { return byte_size(); }
static constexpr size_t byte_size() { return sizeof(m_Data); }
static constexpr size_t byte_size() noexcept { return sizeof(m_Data); }

template <typename convertT,
rounding_mode roundingMode = rounding_mode::automatic>
Expand Down
1 change: 1 addition & 0 deletions sycl/test-e2e/Basic/vector_operators.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ template <typename T, int N> void check_vector_size() {
constexpr auto length = (N == 3 ? 4 : N);
assert(Vec.size() == N);
assert(Vec.byte_size() == sizeof(T) * length);
static_assert(noexcept(Vec.byte_size()));
}

int main() {
Expand Down