Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Error C3072

Error Message

operator 'operator' cannot be applied to an instance of a ref class

use the unary 'operator ' operator to convert an instance of a ref class to a handle type

A CLR type requires CLR operators, not native (or standard) operators. For more information, see % (Tracking Reference).


The following sample generates C3072.

// C3072.cpp
// compile with: /clr
ref class R {};

int main() {
   R r1;
   R^ r2 = &r1;   // C3072
   R^ r3 = %r1;   // OK

Community Additions

© 2015 Microsoft