Expand Minimize
This topic has not yet been rated - Rate this topic

Compiler Error C3148

illegal __nogc pointer to managed type 'type'

A pointer to a managed type cannot be declared with the __nogc keyword.

C3148 is only reachable using /clr:oldSyntax.

The following sample generates C3148:

// C3148.cpp
// compile with: /clr:oldSyntax
#using<mscorlib.dll>
__gc class G {};

int main() {
   G __nogc *pg;   // C3148
   G *pg2;   // OK
   G __gc *pg3;
}
Did you find this helpful?
(1500 characters remaining)
© 2013 Microsoft. All rights reserved.