Shih-wei Liao | f8fd82b | 2010-02-10 11:10:31 -0800 | [diff] [blame^] | 1 | // RUN: %clang_cc1 -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 | |
| 19 | template<int N> class A; // expected-error{{template parameter has a different kind in template redeclaration}} |
| 20 | |
| 21 | template<int N> class NonTypeTemplateParm; |
| 22 | |
| 23 | typedef int INT; |
| 24 | |
| 25 | template<INT M> class NonTypeTemplateParm; // expected-note{{previous non-type template parameter with type 'INT' (aka 'int') is here}} |
| 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 | template<typename T> |
| 39 | struct test {}; // expected-note{{previous definition}} |
| 40 | |
| 41 | template<typename T> |
| 42 | struct test : T {}; // expected-error{{redefinition}} |
| 43 | |
| 44 | class X { |
| 45 | public: |
| 46 | template<typename T> class C; |
| 47 | }; |
| 48 | |
| 49 | void f() { |
| 50 | template<typename T> class X; // expected-error{{expression}} |
| 51 | } |
| 52 | |
| 53 | template<typename T> class X1 { } var; // expected-error{{declared as a template}} |