https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103618
Bug ID: 103618
Summary: constexpr std::reverse produces strict-overflow
warning
Product: gcc
Version: og11 (devel/omp/gcc-11)
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: maik.urbannek at cattatech dot de
Target Milestone: ---
(error.cpp)
```cpp
#include <algorithm>
#include <array>
#include <cstdio>
constexpr static std::array<char,4> foo()
{
std::array<char,4> raw={'\0','a','b','c'};
std::reverse(raw.begin(), raw.end());
return raw;
}
int main() {
constexpr std::array<char,4> a=foo();
puts(a.data());
return 0;
}
```
command
`gcc -o error error.cpp -std=c++20 -Werror=strict-overflow`