Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Douglas Gregor | 27b152f | 2009-03-10 18:52:44 +0000 | [diff] [blame] | 2 | template<typename T> struct A; // expected-note 4{{template is declared here}} |
Douglas Gregor | ee1828a | 2009-03-10 18:03:33 +0000 | [diff] [blame] | 3 | |
Douglas Gregor | 9813753 | 2009-03-10 18:33:27 +0000 | [diff] [blame] | 4 | template<typename T> struct B : A<T*> { }; // expected-error{{implicit instantiation of undefined template}} \ |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 5 | // expected-error{{implicit instantiation of undefined template 'A<X *>'}} |
Douglas Gregor | ee1828a | 2009-03-10 18:03:33 +0000 | [diff] [blame] | 6 | |
| 7 | template<typename T> struct C : B<T> { } ; // expected-note{{instantiation of template class}} |
| 8 | |
| 9 | template<typename T> struct D : C<T> { }; // expected-note{{instantiation of template class}} |
| 10 | |
| 11 | template<typename T> struct E : D<T> { }; // expected-note{{instantiation of template class}} |
| 12 | |
| 13 | template<typename T> struct F : E<T(T)> { }; // expected-note{{instantiation of template class}} |
| 14 | |
| 15 | void f() { |
| 16 | (void)sizeof(F<int>); // expected-note{{instantiation of template class}} |
| 17 | } |
Douglas Gregor | 9813753 | 2009-03-10 18:33:27 +0000 | [diff] [blame] | 18 | |
| 19 | typedef struct { } X; |
| 20 | |
| 21 | void g() { |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 22 | (void)sizeof(B<X>); // expected-note{{in instantiation of template class 'B<X>' requested here}} |
Douglas Gregor | 9813753 | 2009-03-10 18:33:27 +0000 | [diff] [blame] | 23 | } |
Douglas Gregor | 27b152f | 2009-03-10 18:52:44 +0000 | [diff] [blame] | 24 | |
| 25 | template<typename T> |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 26 | struct G : A<T>, // expected-error{{implicit instantiation of undefined template 'A<int>'}} |
| 27 | A<T*> // expected-error{{implicit instantiation of undefined template 'A<int *>'}} |
Douglas Gregor | 27b152f | 2009-03-10 18:52:44 +0000 | [diff] [blame] | 28 | { }; |
| 29 | |
| 30 | void h() { |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 31 | (void)sizeof(G<int>); // expected-note{{in instantiation of template class 'G<int>' requested here}} |
Douglas Gregor | 27b152f | 2009-03-10 18:52:44 +0000 | [diff] [blame] | 32 | } |