Compiler Error C3146
illegal __nogc reference to managed type 'type'
An attempt was made to create an unmanaged reference to a variable of a managed type.
C3146 is only reachable using /clr:oldSyntax.
The following sample generates C3146:
// C3146.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>
int main() {
System::String *str1 = new System::String("test");
System::String __nogc& str2 = *str1; // C3146
System::String & str3 = *str1; // OK equivalent to __gc& str2
}