Douglas Gregor | ddc29e1 | 2009-02-06 22:42:48 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s |
| 2 | |
| 3 | template<typename T> class A; |
| 4 | |
| 5 | extern "C++" { |
| 6 | template<typename T> class B; |
| 7 | } |
| 8 | |
| 9 | namespace N { |
| 10 | template<typename T> class C; |
| 11 | } |
| 12 | |
| 13 | extern "C" { |
| 14 | template<typename T> class D; // expected-error{{templates must have C++ linkage}} |
| 15 | } |
| 16 | |
| 17 | template<class U> class A; // expected-note{{previous template declaration is here}}\ |
| 18 | // expected-note{{previous use is here}} |
| 19 | |
| 20 | template<int N> class A; // expected-error{{template parameter has a different kind in template redeclaration}} |
| 21 | |
| 22 | template<class T> struct A; // expected-error{{use of 'A' with tag type that does not match previous declaration}} |
| 23 | |
| 24 | template<int N> class NonTypeTemplateParm; |
| 25 | |
| 26 | typedef int INT; |
| 27 | |
Chris Lattner | d0344a4 | 2009-02-19 23:45:49 +0000 | [diff] [blame] | 28 | template<INT M> class NonTypeTemplateParm; // expected-note{{previous non-type template parameter with type 'INT' (aka 'int') is here}} |
Douglas Gregor | ddc29e1 | 2009-02-06 22:42:48 +0000 | [diff] [blame] | 29 | |
| 30 | template<long> class NonTypeTemplateParm; // expected-error{{template non-type parameter has a different type 'long' in template redeclaration}} |
| 31 | |
| 32 | template<template<typename T> class X> class TemplateTemplateParm; |
| 33 | |
| 34 | template<template<class> class Y> class TemplateTemplateParm; // expected-note{{previous template declaration is here}} \ |
| 35 | // expected-note{{previous template template parameter is here}} |
| 36 | |
| 37 | template<typename> class TemplateTemplateParm; // expected-error{{template parameter has a different kind in template redeclaration}} |
| 38 | |
| 39 | template<template<typename T, int> class X> class TemplateTemplateParm; // expected-error{{too many template parameters in template template parameter redeclaration}} |
| 40 | |
| 41 | #if 0 |
| 42 | // FIXME: parse template declarations in these scopes, so that we can |
| 43 | // complain about the one at function scope. |
| 44 | class X { |
| 45 | public: |
| 46 | template<typename T> class C; |
| 47 | }; |
| 48 | |
| 49 | void f() { |
| 50 | template<typename T> class X; |
| 51 | } |
| 52 | #endif |