MC++ FAQ
Sunday 09 | 08 | 2002
Properties and StructLayout
If you're writing code that uses __value classes mixed with the StructLayout attribute, you will run into an Internal Compiler error.

The following code demonstrates the problem:

#using <mscorlib.dll>
using namespace System;
using namespace System::Reflection;
using namespace System::Runtime::InteropServices;


[StructLayout(LayoutKind::Sequential)]
public __value class Test
{
private:
  int m_value;
public:
  __property int get_Value() { return m_value; }
  __property void set_Value(int v) { m_value = v; }
};

Compiling this code will generate the following error:

t.cpp(14) : 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

The only workarounds are to either loose the StructLayout attribute, or not use __property.

Posted by tomasr at September 08, 2002 10:46 PM
Comments
Post a comment
Name:


Email Address:


URL:


Comments:


Remember info?

Copyright(C) 2002, Tomas Restrepo, All rights reserved. Powered by Movable Type 2.63