Microsoft KB Archive/315544

= FIX: Too many delegate types in a managed type definition causes a C1001 compiler error in Visual Studio .NET 2002 =

Article ID: 315544

Article Last Modified on 8/25/2005

-

APPLIES TO


 * Microsoft Visual Studio .NET 2002 Professional Edition
 * Microsoft Visual Studio .NET 2002 Enterprise Architect
 * Microsoft Visual Studio .NET 2002 Enterprise Developer
 * Microsoft Visual Studio .NET 2002 Academic Edition

-



This article was previously published under Q315544



SYMPTOMS
When you define more than 18 delegate types in a managed type (class or struct), and then you try to compile the code, you receive the following error message:

&quot;Q315544.cpp(181) : fatal error C1001: INTERNAL COMPILER ERROR (compiler file 'msc1.cpp', line 2844) Please choose the Technical Support command on the Visual C++ Help menu, or open the Technical Support help file for more information&quot;



RESOLUTION
Move the delegate definitions outside of the managed type definition. For example, if you have a class such as the following: __gc class CApp { __delegate int MyFunc1(int); ////Place the other 18 delegate definitions here. } you can work around the problem by placing the delegate definitions as in the following sample code: __delegate int MyFunc1(int); __gc class CApp { MyFunc1* one; }



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 all versions of Visual Studio .NET (2003).



Steps to Reproduce the Behavior
  Create a Managed Extensions for C++ class, such as that shown in the following sample code: __gc class CApp { //// }                     Add 19 delegate definitions to the class by using the __delegate keyword, for example: __gc class CApp { __delegate int MyFunc1(int); ////Place the other 18 delegate definitions here. }                    Compile the code.

