Error: array must be initialized using an initializer enclosed in parentheses

I have the following C ++ code:

template <typename WorkType, int Degree = 2> class PolynomialFunction {
 public:
  static constexpr int kNumberCoefficients[] = { 0, 3, 6, 10, 15 };
  static const int kPolyDimension = kNumberCoefficients[Degree];
  ...
 private:
  WorkType polynom_[kPolyDimension];
  ...

which compiled before, but all of a sudden (possibly a new compiler) it fails with the following errors:

./polyomial_function.h: when creating 'constexpr const int Polynomial function :: kNumberCoefficients []':
./polynomial_function.h:84:56: required from 'const int Polynomial function :: kPolyDimension'
./polynomial_function.h:309: 35: required from the class Polynomial function
./segment.h:321:17: required from here
./polynomial_function.h:83:24: error: the initializer cannot determine the size "Polynomial function :: kNumberCoefficients"
./polynomial_function.h:83 : 24: error: the array must be initialized using an initializer enclosed in curly braces
./polynomial_function.h: when creating the class Polynomial function:
./segment.h:321:17: required from here

Btw. 83 - "kNumberCoefficients", 309 - "polyom_". , ? .

+4

All Articles