[ESIMD] Add more user-friendly error msg when write beyond simd obj #12059
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It is still not prohibited to create 'simd_view' that views beyond the bounds of viewed 'simd' object. And it is not yet prohibited to read using such 'simd_view' object, but the commit 17f8939 prohibited writing beyong simd bounds. The error message was difficult to read and did not give any guidance on the proposed fix.
The old error message only said that __esimd_wrregion call could not be matched. The newly added static assert says that the viewed object in LHS does not fit the value in RHS.
Example of problem situation:
simd<float, 16> vec; // vec is only 16-elements
auto vec_too_bit_view = vec.select<128, 1>();// 128-elems - too many
vec_too_bit_view = simd<float, 128>{0}; //error: write 128-elem to
16-elem storage