This documentation is archived and is not being maintained.

Compiler Error C3147

Error Message

illegal __nogc with multi-dimensional __gc array

A __gc array, which is indicated with a comma inside the array brackets, was also specified to be an unmanaged array with the __nogc keyword. Change the declaration so that the array is unambiguously declared as either managed or unmanaged.

C3147 is only reachable using /clr:oldSyntax.

The following sample generates C3147:

// C3147.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>
using namespace System;
int main()
   String* x __nogc[,];   // C3147, remove __nogc