1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-comparison %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc // PR8439
4*f4a2713aSLionel Sambuc class A
5*f4a2713aSLionel Sambuc {
6*f4a2713aSLionel Sambuc };
7*f4a2713aSLionel Sambuc 
8*f4a2713aSLionel Sambuc class B
9*f4a2713aSLionel Sambuc {
10*f4a2713aSLionel Sambuc public:
11*f4a2713aSLionel Sambuc   A & m;
12*f4a2713aSLionel Sambuc };
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc class Base
15*f4a2713aSLionel Sambuc {
16*f4a2713aSLionel Sambuc public:
17*f4a2713aSLionel Sambuc   B &f();
18*f4a2713aSLionel Sambuc };
19*f4a2713aSLionel Sambuc 
20*f4a2713aSLionel Sambuc class Derived1 : public Base { };
21*f4a2713aSLionel Sambuc 
22*f4a2713aSLionel Sambuc class Derived2 : public Base { };
23*f4a2713aSLionel Sambuc 
24*f4a2713aSLionel Sambuc class X : public B, public Derived2, public Derived1
25*f4a2713aSLionel Sambuc {
26*f4a2713aSLionel Sambuc public:
27*f4a2713aSLionel Sambuc   virtual void g();
28*f4a2713aSLionel Sambuc };
29*f4a2713aSLionel Sambuc 
g()30*f4a2713aSLionel Sambuc void X::g()
31*f4a2713aSLionel Sambuc {
32*f4a2713aSLionel Sambuc   m.f<int>(); // expected-error{{no member named 'f' in 'A'}} \
33*f4a2713aSLionel Sambuc   // expected-error{{expected '(' for function-style cast}} \
34*f4a2713aSLionel Sambuc   // expected-error{{expected expression}}
35*f4a2713aSLionel Sambuc }
36*f4a2713aSLionel Sambuc 
37*f4a2713aSLionel Sambuc namespace PR11134 {
38*f4a2713aSLionel Sambuc   template<typename Derived> class A;
39*f4a2713aSLionel Sambuc   template<typename Derived> class B : A<Derived> {
40*f4a2713aSLionel Sambuc     typedef A<Derived> Base;
41*f4a2713aSLionel Sambuc     using Base::member;
42*f4a2713aSLionel Sambuc     int member;
43*f4a2713aSLionel Sambuc   };
44*f4a2713aSLionel Sambuc }
45*f4a2713aSLionel Sambuc 
46*f4a2713aSLionel Sambuc namespace AddrOfMember {
47*f4a2713aSLionel Sambuc   struct A { int X; };
48*f4a2713aSLionel Sambuc   typedef int (A::*P);
49*f4a2713aSLionel Sambuc   template<typename T> struct S : T {
fAddrOfMember::S50*f4a2713aSLionel Sambuc     void f() {
51*f4a2713aSLionel Sambuc       P(&T::X) // expected-error {{cannot cast from type 'int *' to member pointer type 'P'}}
52*f4a2713aSLionel Sambuc           == &A::X;
53*f4a2713aSLionel Sambuc     }
54*f4a2713aSLionel Sambuc   };
55*f4a2713aSLionel Sambuc 
g()56*f4a2713aSLionel Sambuc   void g() {
57*f4a2713aSLionel Sambuc     S<A>().f(); // ok, &T::X is 'int (A::*)', not 'int *', even though T is a base class
58*f4a2713aSLionel Sambuc   }
59*f4a2713aSLionel Sambuc 
60*f4a2713aSLionel Sambuc   struct B : A { static int X; };
h()61*f4a2713aSLionel Sambuc   void h() {
62*f4a2713aSLionel Sambuc     S<B>().f(); // expected-note {{here}}
63*f4a2713aSLionel Sambuc   }
64*f4a2713aSLionel Sambuc }
65