Microsoft KB Archive/325570

= BUG: You may receive the &quot;fatal error C1001: internal compiler error&quot; error message when you try to export a class by using Visual C++ .NET =

Article ID: 325570

Article Last Modified on 1/17/2006

-

APPLIES TO


 * Microsoft Visual C++ .NET 2002 Standard Edition

-



This article was previously published under Q325570



SYMPTOMS
When you try to compile code that is similar to the sample code that appears in the &quot;Steps to Reproduce the Behavior&quot; section of this article, you may receive the following error message:

fatal error C1001: INTERNAL COMPILER ERROR

(compiler file 'msc1.cpp', line 2844)



CAUSE
This behavior occurs only under the following conditions:
 * You apply __declspec(dllexport) to a class that has a base class that does not have __declspec(dllexport).

-and-
 * The base class has multiple base classes that have virtual functions.



RESOLUTION
To work around the issue, do one of the following:  Explicitly export the base class C by using the following syntax:

template struct __declspec (dllexport) C ;

-or- Make one of the functions non-virtual.



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 Microsoft Visual C++ .NET (2003).



Steps to Reproduce the Behavior
To reproduce the problem, try to compile the following code: //test.cpp // Compiler Option: cl /c test.cpp struct __declspec (dllexport) A { virtual ~A(void){} };

struct __declspec (dllexport) B { virtual ~B(void){} };

template  struct C : A, B { };

//template struct __declspec (dllexport) C ;//WORKAROUND 1

struct __declspec (dllexport) D : C { };

Additional query words: ICE KbCpp KbNative KBUnmanaged

Keywords: kberrmsg kbbug kbfix kbpending kbcompiler KB325570

-

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

© Microsoft Corporation. All rights reserved.