Follow Us
Contribute
  • Register

Error C2819: type (type) does not have an overloaded member 'operator ->'

0 votes

You need to define operator->() to use this pointer operation.


This error can also occur when using C++ Stack Semantics for Reference Types.


// compile with: /clr
ref struct R {
   void Test() {}
};

int main() {
   R r;
   r->Test();   // C2819
}

requested 7 years ago by errorbase (170,010 points)

2 Solutions

0 votes

This article is a derivative work based on http://msdn.microsoft.com/en-us/library/b7yzwefx.aspx" title="http://msdn.microsoft.com/en-us/library/b7yzwefx.aspx" target="_blank">Compiler Error C2819 which is provided by http://msdn.microsoft.com/en-us/library/60k1461a.aspx" title="http://msdn.microsoft.com/en-us/library/60k1461a.aspx" target="_blank">MSDN Community Content - Visual C++.

solved 7 years ago by errorbase (170,010 points)
0 votes

Possible resolution:


// compile with: /clr
ref struct R {
   void Test() {}
};

int main() {
   R r;
   r.Test();   
}

solved 7 years ago by errorbase (170,010 points)

Related errors