Compiler Error C2436

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Compiler Error C2436.

identifier' : member function or nested class in constructor initializer list

Member functions or local classes in the constructor initializer list cannot be initialized.

The following sample generates C2436:

// C2436.cpp  
struct S{  
   int f();  
   struct Inner{  
      int i;  
   };  
   S():f(10), Inner(0){}   // C2436  
};  

Show: