blob: fab65cef2e4584b107abdca828d17242bb472511 [file] [log] [blame]
Douglas Gregord475b8d2009-03-25 21:17:03 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
3template<typename T>
4class X {
5public:
6 struct C { T &foo(); };
7
8 struct D {
Douglas Gregord048bb72009-03-25 21:23:52 +00009 struct E { T &bar(); }; // expected-error{{cannot form a reference to 'void'}}
Douglas Gregord475b8d2009-03-25 21:17:03 +000010 struct F; // expected-note{{member is declared here}}
11 };
12};
13
14X<int>::C *c1;
15X<float>::C *c2;
16
17X<int>::X *xi;
18X<float>::X *xf;
19
20void test_naming() {
21 c1 = c2; // expected-error{{incompatible type assigning 'X<float>::C *', expected 'X<int>::C *'}}
22 xi = xf; // expected-error{{incompatible type assigning}}
23 // FIXME: error above doesn't print the type X<int>::X cleanly!
24}
25
26void test_instantiation(X<double>::C *x,
27 X<float>::D::E *e,
28 X<float>::D::F *f) {
29 double &dr = x->foo();
30 float &fr = e->bar();
31 f->foo(); // expected-error{{implicit instantiation of undefined member 'struct X<float>::D::F'}}
32
33}
Douglas Gregord048bb72009-03-25 21:23:52 +000034
35
36X<void>::C *c3; // okay
37X<void>::D::E *e1; // okay
38X<void>::D::E e2; // expected-note{{in instantiation of member class 'struct X<void>::D::E' requested here}}