The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.
We recommend using Visual Studio 2017

Compiler Error C2819


The latest version of this topic can be found at Compiler Error C2819.

type 'type' does not have an overloaded member 'operator ->'

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

The following sample generates C2819:

// C2819.cpp  
// compile with: /c  
class A {  
      int i;  
class B {};  
void C(B j) {  
   j->i;   // C2819  
class D {  
   A* pA;  
      A* operator->() {  
         return pA;  
void F(D j) {  

C2819 can also occur when using C++ Stack Semantics for Reference Types. The following sample generates C2819:

// C2819_b.cpp  
// compile with: /clr  
ref struct R {  
   void Test() {}  
int main() {  
   R r;  
   r->Test();   // C2819  
   r.Test();   // OK