Chandler Carruth | 62395c9 | 2011-04-25 06:34:35 +0000 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -fdelayed-template-parsing -fsyntax-only -verify %s |
| 2 | |
| 3 | template <class T> |
| 4 | class A { |
| 5 | void foo() { |
| 6 | undeclared(); |
| 7 | } |
| 8 | void foo2(); |
| 9 | }; |
| 10 | |
| 11 | template <class T> |
| 12 | class B { |
| 13 | void foo4() { } // expected-note {{previous definition is here}} expected-note {{previous definition is here}} |
| 14 | void foo4() { } // expected-error {{class member cannot be redeclared}} expected-error {{redefinition of 'foo4'}} expected-note {{previous definition is here}} |
| 15 | }; |
| 16 | |
| 17 | |
| 18 | template <class T> |
| 19 | void B<T>::foo4() {// expected-error {{redefinition of 'foo4'}} |
| 20 | } |
| 21 | |
| 22 | template <class T> |
| 23 | void A<T>::foo2() { |
| 24 | undeclared(); |
| 25 | } |
| 26 | |
| 27 | |
| 28 | template <class T> |
| 29 | void foo3() { |
| 30 | undeclared(); |
| 31 | } |
| 32 | |
| 33 | template void A<int>::foo2(); |
| 34 | |
| 35 | |
| 36 | void undeclared() |
| 37 | { |
| 38 | |
| 39 | } |
| 40 | |
| 41 | template <class T> void foo5() {} //expected-note {{previous definition is here}} |
| 42 | template <class T> void foo5() {} // expected-error {{redefinition of 'foo5'}} |