Share via


Compiler Warning C4867

'function': function call missing argument list; use 'call' to create a pointer to member

A pointer to member function was initialized incorrectly.

This warning can be generated as a result of compiler conformance work that was done for Visual C++ 2005: enhanced pointer-to-member conformance. Code that compiled prior to Visual C++ 2005 will now generate C4867. See Breaking Changes in the Visual C++ 2005 Compiler for more information.

This warning is always issued as an error. Use the warning pragma to disable this warning. For more information about C4867 and MFC/ATL, see _ATL_ENABLE_PTM_WARNING.

Example

The following sample generates C4867.

// C4867.cpp
// compile with: /c
class A {
public:
   void f(int) {}

   typedef void (A::*TAmtd)(int);

   struct B {
      TAmtd p;
   };

   void g() {
      B b = {f};   // C4867
      B b2 = {&A::f};   // OK
   }
};