https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118657
--- Comment #6 from Andi Kleen <andi-gcc at firstfloor dot org> ---
The C test case needs to use constexpr too.
#define DATA_SIZE 1024
static constexpr int TO_DATA_INDEX[DATA_SIZE] = {};
bool foo(int* data, unsigned char first_idx)
{
int second_idx = TO_DATA_INDEX[first_idx];
if (second_idx >= DATA_SIZE)
return false;
data[second_idx] = 1;
return true;
}
