1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 struct T { 3 void f(); 4 }; 5 6 struct A { 7 T* operator->(); // expected-note{{candidate function}} 8 }; 9 10 struct B { 11 T* operator->(); // expected-note{{candidate function}} 12 }; 13 14 struct C : A, B { 15 }; 16 17 struct D : A { }; 18 19 struct E; // expected-note {{forward declaration of 'E'}} 20 f(C & c,D & d,E & e)21void f(C &c, D& d, E& e) { 22 c->f(); // expected-error{{use of overloaded operator '->' is ambiguous}} 23 d->f(); 24 e->f(); // expected-error{{incomplete definition of type}} 25 } 26 27 // rdar://8875304 28 namespace rdar8875304 { 29 class Point {}; Line_Segment(const Point &)30class Line_Segment{ public: Line_Segment(const Point&){} }; Location()31class Node { public: Point Location(){ Point p; return p; } }; 32 f()33void f() 34 { 35 Node** node1; 36 Line_Segment(node1->Location()); // expected-error {{not a structure or union}} 37 } 38 } 39 40 41 namespace arrow_suggest { 42 43 template <typename T> 44 class wrapped_ptr { 45 public: wrapped_ptr(T * ptr)46 wrapped_ptr(T* ptr) : ptr_(ptr) {} operator ->()47 T* operator->() { return ptr_; } 48 void Check(); // expected-note {{'Check' declared here}} 49 private: 50 T *ptr_; 51 }; 52 53 class Worker { 54 public: 55 void DoSomething(); // expected-note {{'DoSomething' declared here}} 56 void Chuck(); 57 }; 58 test()59void test() { 60 wrapped_ptr<Worker> worker(new Worker); 61 worker.DoSomething(); // expected-error {{no member named 'DoSomething' in 'arrow_suggest::wrapped_ptr<arrow_suggest::Worker>'; did you mean to use '->' instead of '.'?}} 62 worker.DoSamething(); // expected-error {{no member named 'DoSamething' in 'arrow_suggest::wrapped_ptr<arrow_suggest::Worker>'; did you mean to use '->' instead of '.'?}} \ 63 // expected-error {{no member named 'DoSamething' in 'arrow_suggest::Worker'; did you mean 'DoSomething'?}} 64 worker.Chuck(); // expected-error {{no member named 'Chuck' in 'arrow_suggest::wrapped_ptr<arrow_suggest::Worker>'; did you mean 'Check'?}} 65 } 66 67 } // namespace arrow_suggest 68