I'm trying to compile the following snippet with VS2017 but it is throwing an error C2131: expression did not evaluate to a constant without any further detail in the output log.
class Example { public: constexpr Example() : m_int() { for (int i = 0; i < 256; ++i) { for (int j = 0; j < 256; ++j) { m_int[i] = i; } } } private: int m_int[256]; }; int main() { constexpr Example vv; // <-- error C2131 here return 0; } However for some reason unknown to me, if I stop the j counter at < 255 (instead of 256), the code compile fine. What's the explanation behind this and how can I fix it?