FIX: You receive a compiler error message when you specify the LayoutKind attribute as Sequential or Explicit and define a property on a __value class in Visual Studio .NET (315549)



The information in this article applies to:

  • Microsoft Visual Studio .NET (2002), Professional Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
  • Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
  • Microsoft Visual Studio .NET (2002), Academic Edition

This article was previously published under Q315549

SYMPTOMS

When you specify the LayoutKind attribute as Sequential or Explicit, and you define a property on a _value class, and then you try to compile the code, you receive the following error message:
"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"
This behavior occurs when you define a property on a __gc class, also.

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).

MORE INFORMATION

Steps to Reproduce the Behavior

The following sample code demonstrates the error:
/* Compile options needed: cl.exe /clr
*/ 
#using <mscorlib.dll>

using namespace System::Runtime::InteropServices;

[StructLayout(LayoutKind::Sequential)]
public __value class Vector2 
{
protected:
  float vec __nogc[2];
public:
  // Accesses the indexed component of a vector.
   __property float get_elt(int i) { return(vec[i]); }
   __property  void set_elt(int i, float v) { vec[i]=v; }
};
				

Modification Type:MinorLast Reviewed:8/24/2005
Keywords:kbvs2002sp1sweep kbfix kbBug kbpending KB315549