Compiler Warning C4867
Collapse the table of content
Expand the table of content
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer

Compiler Warning C4867

Error Message

'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.


The following sample generates C4867.

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

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

   struct B {
      TAmtd p;

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