2017-02-08 11:30:13 +08:00
// RUN: %clang_cc1 -fsyntax-only -verify %s -Wshadow-field
2010-03-03 12:38:46 +08:00
class V {
public :
int f ( ) ;
2017-02-08 11:30:13 +08:00
int x ; // expected-note {{declared here}}
2010-03-03 12:38:46 +08:00
} ;
class W {
public :
int g ( ) ; // expected-note{{member found by ambiguous name lookup}}
2017-02-08 11:30:13 +08:00
int y ; // expected-note{{member found by ambiguous name lookup}} expected-note {{declared here}}
2010-03-03 12:38:46 +08:00
} ;
class B : public virtual V , public W
{
public :
int f ( ) ;
2017-02-08 11:30:13 +08:00
int x ; // expected-warning {{non-static data member 'x' of 'B' shadows member inherited from type 'V'}}
2010-03-03 12:38:46 +08:00
int g ( ) ; // expected-note{{member found by ambiguous name lookup}}
2017-02-08 11:30:13 +08:00
int y ; // expected-note{{member found by ambiguous name lookup}} expected-warning {{non-static data member 'y' of 'B' shadows member inherited from type 'W'}}
2010-03-03 12:38:46 +08:00
} ;
class C : public virtual V , public W { } ;
class D : public B , public C { void glorp ( ) ; } ;
void D : : glorp ( ) {
x + + ;
f ( ) ;
y + + ; // expected-error{{member 'y' found in multiple base classes of different types}}
2011-12-15 08:38:15 +08:00
g ( ) ; // expected-error{{member 'g' found in multiple base classes of different types}}
2010-03-03 12:38:46 +08:00
}
// PR6462
struct BaseIO { BaseIO * rdbuf ( ) { return 0 ; } } ;
struct Pcommon : virtual BaseIO { int rdbuf ( ) { return 0 ; } } ;
struct P : virtual BaseIO , Pcommon { } ;
void f ( ) { P p ; p . rdbuf ( ) ; }