Compiler Error C3183

cannot define unnamed class, struct or union inside of managed type 'type'

A type that is embedded in a managed type must be named.

The following sample generates C3183:

// C3183a.cpp
// compile with: /clr /c
ref class Test
{
   ref class
   {  // C3183, delete class or name it
      int a;
      int b;
   };
};

The following sample generates C3183:

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

__gc class Test
{
   __gc class
   {  // C3183, delete class or name it
      int a;
      int b;
   };
};

int main()
{
}
Show: