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

Last reviewed: July 18, 1997
Article ID: Q131323
1.00 1.50 1.51 1.52 WINDOWS NT kbtool kbbuglist

The information in this article applies to:

  • The Microsoft C/C++ Compiler (CL.EXE) included with: Microsoft Visual C++ for Windows, versions 1.0, 1.5, 1.51, 1.52

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:
  • It dereferences a pointer to a member function from the 'this' pointer.
  • It uses the '/vmg' or the '/vmg /vmv' compiler options.

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 : CPPIss kb16bitonly kbbuglist kbtool
Version : 1.00 1.50 1.51 1.52
Platform : NT WINDOWS


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: July 18, 1997
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.