Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Douglas Gregor | ddc29e1 | 2009-02-06 22:42:48 +0000 | [diff] [blame] | 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 | |
Douglas Gregor | ed4ec8f | 2009-05-03 17:18:57 +0000 | [diff] [blame^] | 17 | template<class U> class A; // expected-note{{previous template declaration is here}} |
Douglas Gregor | ddc29e1 | 2009-02-06 22:42:48 +0000 | [diff] [blame] | 18 | |
| 19 | template<int N> class A; // expected-error{{template parameter has a different kind in template redeclaration}} |
| 20 | |
Douglas Gregor | ddc29e1 | 2009-02-06 22:42:48 +0000 | [diff] [blame] | 21 | template<int N> class NonTypeTemplateParm; |
| 22 | |
| 23 | typedef int INT; |
| 24 | |
Chris Lattner | d0344a4 | 2009-02-19 23:45:49 +0000 | [diff] [blame] | 25 | 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] | 26 | |
| 27 | template<long> class NonTypeTemplateParm; // expected-error{{template non-type parameter has a different type 'long' in template redeclaration}} |
| 28 | |
| 29 | template<template<typename T> class X> class TemplateTemplateParm; |
| 30 | |
| 31 | template<template<class> class Y> class TemplateTemplateParm; // expected-note{{previous template declaration is here}} \ |
| 32 | // expected-note{{previous template template parameter is here}} |
| 33 | |
| 34 | template<typename> class TemplateTemplateParm; // expected-error{{template parameter has a different kind in template redeclaration}} |
| 35 | |
| 36 | template<template<typename T, int> class X> class TemplateTemplateParm; // expected-error{{too many template parameters in template template parameter redeclaration}} |
| 37 | |
| 38 | #if 0 |
| 39 | // FIXME: parse template declarations in these scopes, so that we can |
| 40 | // complain about the one at function scope. |
| 41 | class X { |
| 42 | public: |
| 43 | template<typename T> class C; |
| 44 | }; |
| 45 | |
| 46 | void f() { |
| 47 | template<typename T> class X; |
| 48 | } |
| 49 | #endif |