Reputation: 42379
According to C++11 Features (Modern C++), VC++ 2013 now supports non-static data member initializers.
However, the following code is rejected by VC++ 2013:
struct A
{
const int n = 0; // error C2864
};
error C2864: 'A::n' : only static const integral data members can be initialized within a class
What's the root cause? Is it a compiler bug?
Upvotes: 1
Views: 968
Reputation: 52365
What's the root cause? Is it a compiler bug?
It's a documentation bug, both here and chris's link in the comment say that Non-static data member initializers will be implemented in VS2013 RTM.
Don't be surprised when you find false info on MSDN, there is a lot of old material, etc. which no one has updated or somebody made a mistake when typing it in.
Upvotes: 4