[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / SemaTemplate / member-access-ambig.cpp
blob5c2d7617033fe33fb9e6770b7bb89f2457e6c9b7
1 // RUN: %clang_cc1 -fsyntax-only -verify -Wno-unused-comparison %s
3 // PR8439
4 class A
6 };
8 class B
10 public:
11 A & m;
14 class Base
16 public:
17 B &f();
20 class Derived1 : public Base { };
22 class Derived2 : public Base { };
24 class X : public B, public Derived2, public Derived1
26 public:
27 virtual void g();
30 void X::g()
32 m.f<int>(); // expected-error{{no member named 'f' in 'A'}} \
33 // expected-error{{expected '(' for function-style cast}} \
34 // expected-error{{expected expression}}
37 namespace PR11134 {
38 template<typename Derived> class A;
39 template<typename Derived> class B : A<Derived> {
40 typedef A<Derived> Base;
41 using Base::member;
42 int member;
46 namespace AddrOfMember {
47 struct A { int X; };
48 typedef int (A::*P);
49 template<typename T> struct S : T {
50 void f() {
51 P(&T::X) // expected-error {{cannot cast from type 'int *' to member pointer type 'P'}}
52 == &A::X;
56 void g() {
57 S<A>().f(); // ok, &T::X is 'int (A::*)', not 'int *', even though T is a base class
60 struct B : A { static int X; };
61 void h() {
62 S<B>().f(); // expected-note {{here}}