I was building an static constexpr array in a class which references previously defined elements in the same array. I've tried before without problems, but I've found that gcc is having some issues finding the array's symbol name when it is within a struct.
struct Y {
static constexpr char command_info[8][5][(6)*2] = {
{
{ 0, 0 , 0,0},
{ 0, 0 , 0,0},
{ 1, 0 , 1 , static_cast<char>(command_info[0][2] [ (0 +1)*2 - 1 ] + command_info[0][2] [ (0 +1)*2 - 2 ]) , 0,0},
{ 2, 0 , 1 , static_cast<char>(command_info[0][3] [ (0 +1)*2 - 1 ] + command_info[0][3] [ (0 +1)*2 - 2 ]), 1, static_cast<char>(command_info[0][3] [ (1 +1)*2 - 1 ] + command_info[0][3] [ (1 +1)*2 - 2 ]) , 0,0},
{ 1, 0 , 1 , static_cast<char>(command_info[0][4] [ (0 +1)*2 - 1 ] + command_info[0][4] [ (0 +1)*2 - 2 ]) , 0,0},
},
};
};
The Demo shows simplified expanded code, removing other constexpr variables and functions.
Moving this definition outside of the struct works fine. Is there something wrong with gcc or am I doing something illegal here?