Compiler Error C2671

 

For the latest documentation on Visual Studio 2017, see Visual Studio 2017 Documentation.

For the latest documentation on Visual Studio 2017, see Compiler Error C2671 on docs.microsoft.com. 'function' : static member functions do not have 'this' pointers

A static member function tried to access this.

The following sample generates C2671:

// C2671.cpp  
struct S {  
   static S* const func() { return this; }  // C2671  
};  

Show: