1 out of 2 rated this helpful - Rate this topic

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.

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
   }
};
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Thanks this helped me, but why does the warning throw an error
This fixed my problem, but the last thing I expected by upgrading was to have my code from VS 2003 to stop compiling. If this is a warning then why not just make it a warning?

thanks

http://theputernerd.com/129/visual-studio-2005-compiling-vs-2003-projects