c++ - field initializer is not constant g++ 4.8.4 -


i tried compile following code on 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 got error message:

error: field initializer 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, copy/paste same code on coliru (g++ 6.1.0), same compilation parameters , worked.

can tells me wrong please ?

thank you.

actually, pointed out chris , baum, updating g++ 4.9 fixed it.


Comments

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -