Daniel Dunbar | 8fbe78f | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
Douglas Gregor | 5013a7e | 2009-09-24 23:39:01 +0000 | [diff] [blame] | 2 | template<typename T> |
| 3 | struct X0 { |
| 4 | typedef T* type; |
| 5 | |
| 6 | void f0(T); |
| 7 | void f1(type); |
| 8 | }; |
| 9 | |
| 10 | template<> void X0<char>::f0(char); |
| 11 | template<> void X0<char>::f1(type); |
Douglas Gregor | 71ad477 | 2010-02-16 19:28:15 +0000 | [diff] [blame] | 12 | |
| 13 | namespace PR6161 { |
| 14 | template<typename _CharT> |
| 15 | class numpunct : public locale::facet // expected-error{{use of undeclared identifier 'locale'}} \ |
Douglas Gregor | 869853e | 2010-11-10 19:44:59 +0000 | [diff] [blame] | 16 | // expected-error{{expected class name}} |
Douglas Gregor | 71ad477 | 2010-02-16 19:28:15 +0000 | [diff] [blame] | 17 | { |
Jeffrey Yasskin | 4e150f8 | 2010-04-07 23:29:58 +0000 | [diff] [blame] | 18 | static locale::id id; // expected-error{{use of undeclared identifier}} |
Douglas Gregor | 71ad477 | 2010-02-16 19:28:15 +0000 | [diff] [blame] | 19 | }; |
Douglas Gregor | 869853e | 2010-11-10 19:44:59 +0000 | [diff] [blame] | 20 | numpunct<char>::~numpunct(); // expected-error{{expected the class name after '~' to name a destructor}} |
Douglas Gregor | 71ad477 | 2010-02-16 19:28:15 +0000 | [diff] [blame] | 21 | } |
Richard Smith | 5001ec9 | 2013-07-02 18:08:50 +0000 | [diff] [blame] | 22 | |
| 23 | namespace PR12331 { |
| 24 | template<typename T> struct S { |
| 25 | struct U { static const int n = 5; }; |
| 26 | enum E { e = U::n }; // expected-note {{implicit instantiation first required here}} |
| 27 | int arr[e]; |
| 28 | }; |
| 29 | template<> struct S<int>::U { static const int n = sizeof(int); }; // expected-error {{explicit specialization of 'U' after instantiation}} |
| 30 | } |
Richard Smith | 3298368 | 2013-12-14 03:18:05 +0000 | [diff] [blame^] | 31 | |
| 32 | namespace PR18246 { |
| 33 | template<typename T> |
| 34 | class Baz { |
| 35 | public: |
| 36 | template<int N> void bar(); |
| 37 | }; |
| 38 | |
| 39 | template<typename T> |
| 40 | template<int N> |
| 41 | void Baz<T>::bar() { |
| 42 | } |
| 43 | |
| 44 | // FIXME: Don't suggest the 'template<>' correction here, because this cannot |
| 45 | // be an explicit specialization. |
| 46 | template<typename T> |
| 47 | void Baz<T>::bar<0>() { // expected-error {{requires 'template<>'}} |
| 48 | } |
| 49 | } |