BUG: Fatal Error C1001 Line 585 w/ Pointer to Member Function

ID: Q131323

1.00 1.50 1.51 1.52 WINDOWS NT kbtool kbbuglist

The information in this article applies to:

SYMPTOMS

When compiling a file, you may receive the following error:

   fatal error C1001: internal compiler error
      (compiler file 'msc1.cpp', line 585).

This occurs when you compile a file that meet both of these conditions: In some operating environments, it may generate this error instead:

   error C2064: term does not evaluate to a function.

RESOLUTION

Either use the /vmb (Best-case always) C++ compiler option instead of /vmg, or if you must use the /vmg (General-purpose always) option, use it with /vms (single inheritance) or /vmm (multiple inheritance).

STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

If you specify the /vmb (Best-case always) C++ compiler option (the default), the compiler uses the smallest possible representation of each pointer and generates the smallest amount of code required to operate on the pointer for each kind of inheritance.

If you specify the /vmg (General-purpose always) option, the default inheritance model of the classes will be virtual inheritance (/vmv). To specify other inheritance models, use /vms (single inheritance) or /vmm (multiple inheritance) in addition to the /vmg option.

The following sample is a valid code fragment, and should not generate C2064 or C1001, but it does if you use the /vmg compiler option.

Sample Code to Demonstrate Problem

/* Compile options needed: /vmg
*/ 

class b { public:
   void (b::*bptr)(void);
   void one(void);
};

void b::one(void) {
   (this->*bptr)(); // This line causes the C1001 error.
}

REFERENCES

For more information, please see the following article in the Microsoft Knowledge Base:

ARTICLE-ID: Q126844

TITLE     : BUG: C1001 ICE If Compiling MFC Applications with /vmg Option

Additional reference words: 1.50 1.00 8.00 8.00c no32bit noupdate KBCategory: kbtool kbbuglist KBSubcategory: CPPIss
Keywords          : kb16bitonly kbCompiler kbCPPonly kbVC kbbuglist
Version           : 1.00 1.50 1.51 1.52
Platform          : NT WINDOWS

Last Reviewed: July 22, 1997