Microsoft KB Archive/259746

= FIX: C1001 Compiler Error When Virtual Function Used as a Parameter =

Article ID: 259746

Article Last Modified on 8/7/2007

-

APPLIES TO


 * Microsoft C++ 32-bit Compiler 1.0
 * Microsoft Visual C++ 6.0 Enterprise Edition
 * Microsoft Visual C++ 6.0 Professional Edition
 * Microsoft Visual C++ 6.0 Standard Edition

-



This article was previously published under Q259746



SYMPTOMS
The following C1001 compiler error can occur when a virtual function is used as a parameter:

test.cpp(18) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 1786) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information

Error executing cl.exe.

Please refer to the &quot;More Information&quot; section for sample code that reproduces the error.



CAUSE
This is a bug in the compiler.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. This bug was corrected in the latest service pack for Visual Studio 6.0.

For additional information about Visual Studio service packs, click the following article numbers to view the articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That a Visual Studio Service Pack Is Installed

To download the latest Visual Studio service pack, visit the following Microsoft Web site:

http://msdn2.microsoft.com/en-us/vstudio/Aa718353.aspx



MORE INFORMATION
Following is sample code to reproduce the error:

// cl /c /GX ice.cpp

class TestClass { };

class ExampleClass { public: void Compute(void); virtual TestClass& TestFunction(void); };

void ExampleClass::Compute(void) { TestClass *test; test = new TestClass(TestFunction); }

Following are three workarounds:

 Remove /GX (Enable exception handling) from compilation switches.  Explicitly define a copy constructor for TestClass. For example:

public: TestClass( TestClass& );   Introduce a temp variable of type TestClass, as follows:

void ExampleClass::Compute(void) { TestClass *test; TestClass temp = TestFunction; test = new TestClass(temp); }                       

Additional query words: sp4

Keywords: kbbug kbcpponly kbfix kblangcpp kbvc600fix kbvs600sp4fix kbvs600sp5fix KB259746

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.