https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91548
--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Thanks.
Reduced (no templates, no lambda):
constexpr int& impl(const int (&array)[10], int index) {
return const_cast<int&>(array[index]);
}
struct A {
constexpr int& operator[](int i) { return impl(elems, i); }
int elems[10];
};
constexpr bool
f()
{
A arr = {};
arr[2] = true;
return false;
}
constexpr bool b = f();
