Field initializer is not constant g ++ 4.8.4

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 into coliru (g ++ 6.1.0), with the same compilation options, and it worked.

Can someone tell me what is wrong, please?

Thank.

+1
source share
1 answer

Actually, as Chris and Baum noted, the upgrade to g ++ 4.9 has been fixed.

+1
source

Source: https://habr.com/ru/post/1663275/