Export (0) Print
Expand All
Expand Minimize

Compiler Error C3126

Error Message

cannot define a union 'union' inside of managed type 'type'

A union cannot be defined inside a managed type.

The following sample generates C3126:

// C3126_2.cpp
// compile with: /clr /c
ref class Test
{
   union x
   {   // C3126
      int a;
      int b;
   };
};

The following sample generates C3126:

// C3126.cpp
// compile with: /clr:oldSyntax /c
#using <mscorlib.dll>

__gc class Test
{
   union x
   {   // C3126
      int a;
      int b;
   };
};

Community Additions

ADD
Show:
© 2014 Microsoft