Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic

Compiler Error C3181

Error Message

'type' : invalid operand for operator

An invalid parameter was passed to the __typeof or typeid operator. The parameter must be a managed type.

Note that the compiler uses aliases for native types that map to types in the common language runtime.

The following sample generates C3181:

// C3181a.cpp
// compile with: /clr
using namespace System;

int main() {
   Type ^pType1 = interior_ptr<int>::typeid;   // C3181
   Type ^pType2 = int::typeid;   // OK
}

The following sample generates C3181:

// C3181b.cpp
// compile with: /clr:oldSyntax
#using <mscorlib.dll>
using namespace System;

int main() {
   Type *pType1 = __typeof(int __gc*);   // C3181
   Type *pType2 = __typeof(int*);   // OK
}
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.