cpp-proposals-pub
cpp-proposals-pub copied to clipboard
P2642: Avoid division by zero
Para 12.3 of the converting constructor from layout_stride::mapping explicitly divides by zero if the leftmost resp. rightmost extent is zero.
This a general issue with other constructors as well, e.g., if padding_value is zero.
The two-parameter constructor mapping(ext, pad) has a precondition that extents_type::index-cast(pad) is greater than zero. Thus, we already check in some cases. We should consider extending these checks to all the cases, so the mappings behave reasonably.
- [ ] Check whether commit c010f8123f69a0e3e752d5704a493f4e32ef83f0 in PR https://github.com/ORNL/cpp-proposals-pub/pull/441 may fix this.