2009-12-16 04:14:24 +08:00
// RUN: %clang_cc1 -fsyntax-only -verify %s
2009-09-11 07:18:36 +08:00
struct T {
void f ( ) ;
} ;
struct A {
T * operator - > ( ) ; // expected-note{{candidate function}}
} ;
struct B {
T * operator - > ( ) ; // expected-note{{candidate function}}
} ;
struct C : A , B {
} ;
struct D : A { } ;
2010-03-10 19:27:22 +08:00
struct E ; // expected-note {{forward declaration of 'E'}}
2009-11-18 09:28:03 +08:00
void f ( C & c , D & d , E & e ) {
2009-09-11 07:18:36 +08:00
c - > f ( ) ; // expected-error{{use of overloaded operator '->' is ambiguous}}
d - > f ( ) ;
2009-11-18 09:28:03 +08:00
e - > f ( ) ; // expected-error{{incomplete definition of type}}
2009-11-08 09:45:36 +08:00
}
2011-01-26 07:16:36 +08:00
// rdar://8875304
namespace rdar8875304 {
class Point { } ;
class Line_Segment { public : Line_Segment ( const Point & ) { } } ;
class Node { public : Point Location ( ) { Point p ; return p ; } } ;
void f ( )
{
Node * * node1 ;
Line_Segment ( node1 - > Location ( ) ) ; // expected-error {{not a structure or union}}
}
}
2012-04-26 03:49:54 +08:00
namespace arrow_suggest {
template < typename T >
class wrapped_ptr {
public :
wrapped_ptr ( T * ptr ) : ptr_ ( ptr ) { }
T * operator - > ( ) { return ptr_ ; }
void Check ( ) ; // expected-note {{'Check' declared here}}
private :
T * ptr_ ;
} ;
class Worker {
public :
void DoSomething ( ) ;
void Chuck ( ) ;
} ;
void test ( ) {
wrapped_ptr < Worker > worker ( new Worker ) ;
worker . DoSomething ( ) ; // expected-error {{no member named 'DoSomething' in 'arrow_suggest::wrapped_ptr<arrow_suggest::Worker>'; did you mean to use '->' instead of '.'?}}
worker . DoSamething ( ) ; // expected-error {{no member named 'DoSamething' in 'arrow_suggest::wrapped_ptr<arrow_suggest::Worker>'}}
worker . Chuck ( ) ; // expected-error {{no member named 'Chuck' in 'arrow_suggest::wrapped_ptr<arrow_suggest::Worker>'; did you mean 'Check'?}}
}
} // namespace arrow_suggest