blob: f73af595fd6cd1223064dea9d75ea6eee032501e [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
Anders Carlsson1d79faf2009-06-12 18:53:02 +00002
3typedef double A;
4template<typename T> class B {
5 typedef int A;
6};
7
8template<typename T> struct X : B<T> {
9 static A a;
10};
11
12int a0[sizeof(X<int>::a) == sizeof(double) ? 1 : -1];
13
14// PR4365.
15template<class T> class Q;
16template<class T> class R : Q<T> {T current;};
John McCall26416062009-11-24 20:33:45 +000017
18
19namespace test0 {
20 template <class T> class Base {
21 void instance_foo();
22 static void static_foo();
23 class Inner {
24 void instance_foo();
25 static void static_foo();
26 };
27 };
28
29 template <class T> class Derived1 : Base<T> {
30 void test0() {
31 Base<T>::static_foo();
32 Base<T>::instance_foo();
33 }
34
35 void test1() {
36 Base<T>::Inner::static_foo();
37 Base<T>::Inner::instance_foo(); // expected-error {{call to non-static member function without an object argument}}
38 }
39
40 static void test2() {
41 Base<T>::static_foo();
42 Base<T>::instance_foo(); // expected-error {{call to non-static member function without an object argument}}
43 }
44
45 static void test3() {
46 Base<T>::Inner::static_foo();
47 Base<T>::Inner::instance_foo(); // expected-error {{call to non-static member function without an object argument}}
48 }
49 };
50
51 template <class T> class Derived2 : Base<T>::Inner {
52 void test0() {
53 Base<T>::static_foo();
54 Base<T>::instance_foo(); // expected-error {{call to non-static member function without an object argument}}
55 }
56
57 void test1() {
58 Base<T>::Inner::static_foo();
59 Base<T>::Inner::instance_foo();
60 }
61
62 static void test2() {
63 Base<T>::static_foo();
64 Base<T>::instance_foo(); // expected-error {{call to non-static member function without an object argument}}
65 }
66
67 static void test3() {
68 Base<T>::Inner::static_foo();
69 Base<T>::Inner::instance_foo(); // expected-error {{call to non-static member function without an object argument}}
70 }
71 };
72
73 void test0() {
74 Derived1<int> d1;
75 d1.test0();
76 d1.test1(); // expected-note {{in instantiation of member function}}
77 d1.test2(); // expected-note {{in instantiation of member function}}
78 d1.test3(); // expected-note {{in instantiation of member function}}
79
80 Derived2<int> d2;
81 d2.test0(); // expected-note {{in instantiation of member function}}
82 d2.test1();
83 d2.test2(); // expected-note {{in instantiation of member function}}
84 d2.test3(); // expected-note {{in instantiation of member function}}
85 }
86}