C ++ 11 calling constructor from constructor of the same class type

I was told that the following happened due to changes in C ++ 11:

class SomeType { int number; public: SomeType(int new_number) : number(new_number) {} SomeType() : SomeType(42) {} }; 

But when I try to build, I get an error message:

 "SomeType" is not a nonstatic data member or base class of class "SomeType" error C2614: 'SomeType' : illegal member initialization: 'SomeType' is not a base or member 

Is this feature not yet supported in Visual Studio 2010? Do I need to configure anything to build this? What's wrong?

+6
source share
1 answer

It is not supported in VS2010. Most C ++ 11 features are not supported in VS2010 (or VS11, for that matter)

Here is a diagram of the supported functions in VC10 and VC11.

+10
source

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


All Articles