I tried to compile the following code on my laptop, using g++ 4.8.4:
#include <algorithm>
#include <iostream>
#include <initializer_list>
#include <tuple>
struct Storage {
static const int num_spatial_subset = 8;
static constexpr std::initializer_list<std::initializer_list<double>> vectors{ {0,0,0},
{0,1,0},
{0,0,1},
{1,1,0},
{1,0,1},
{0,1,1},
{1,0,0},
{1,1,1} };
double storage[num_spatial_subset][vectors.size()];
};
int main()
{
}
And I got this error message:
error: field initializer is not constant
constexpr std::initializer_list< std::initializer_list<double> > vectors{ {0,0,0}, {0,1,0}, {0,0,1}, {1,1,0}, {1,0,1}, {0,1,1}, {1,0,0}, {1,1,1} };
However, I copy/paste the same code on coliru (g++ 6.1.0), with the same compilation parameters and it worked.
Can someone tells me what is wrong please ?
Thank you.
Actually, as pointed out by Chris and Baum, updating to g++ 4.9 fixed it.