This documentation is archived and is not being maintained.

Compiler Error C2273

'type' : illegal as right side of '->' operator

A type appears as the right operand of a -> operator.

This error can be caused by trying to access a user-defined type conversion. Use the keyword operator between -> and type.

The following sample generates C2273:

// C2273.cpp
struct MyClass {
   operator int() {
      return 0;
   }
};
int main() {
   MyClass * ClassPtr = new MyClass;
   int i = ClassPtr->int();   // C2273
   int j = ClassPtr-> operator int();   // OK
}
Show: