Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s |
Douglas Gregor | dd0574e | 2009-02-10 00:24:35 +0000 | [diff] [blame] | 2 | |
| 3 | template<template<typename T> class X> struct A; // expected-note 2{{previous template template parameter is here}} |
| 4 | |
| 5 | template<template<typename T, int I> class X> struct B; // expected-note{{previous template template parameter is here}} |
| 6 | |
| 7 | template<template<int I> class X> struct C; // expected-note{{previous non-type template parameter with type 'int' is here}} |
| 8 | |
| 9 | template<class> struct X; // expected-note{{too few template parameters in template template argument}} |
| 10 | template<int N> struct Y; // expected-note{{template parameter has a different kind in template argument}} |
| 11 | template<long N> struct Ylong; // expected-note{{template non-type parameter has a different type 'long' in template argument}} |
| 12 | |
| 13 | namespace N { |
| 14 | template<class> struct Z; |
| 15 | } |
| 16 | template<class, class> struct TooMany; // expected-note{{too many template parameters in template template argument}} |
| 17 | |
| 18 | |
| 19 | A<X> *a1; |
| 20 | A<N::Z> *a2; |
| 21 | A< ::N::Z> *a3; |
| 22 | |
Douglas Gregor | 39a8de1 | 2009-02-25 19:37:18 +0000 | [diff] [blame] | 23 | A<Y> *a4; // expected-error{{template template argument has different template parameters than its corresponding template template parameter}} |
| 24 | A<TooMany> *a5; // expected-error{{template template argument has different template parameters than its corresponding template template parameter}} |
| 25 | B<X> *a6; // expected-error{{template template argument has different template parameters than its corresponding template template parameter}} |
Douglas Gregor | dd0574e | 2009-02-10 00:24:35 +0000 | [diff] [blame] | 26 | C<Y> *a7; |
Douglas Gregor | 39a8de1 | 2009-02-25 19:37:18 +0000 | [diff] [blame] | 27 | C<Ylong> *a8; // expected-error{{template template argument has different template parameters than its corresponding template template parameter}} |
Douglas Gregor | dd0574e | 2009-02-10 00:24:35 +0000 | [diff] [blame] | 28 | |
| 29 | template<typename T> void f(int); |
| 30 | |
| 31 | // FIXME: we're right to provide an error message, but it should say |
| 32 | // that we need a class template. We won't get this right until name |
| 33 | // lookup of 'f' returns a TemplateDecl. |
Douglas Gregor | 39a8de1 | 2009-02-25 19:37:18 +0000 | [diff] [blame] | 34 | A<f> *a9; // expected-error{{template argument for template template parameter must be a template}} |
Douglas Gregor | dd0574e | 2009-02-10 00:24:35 +0000 | [diff] [blame] | 35 | |
| 36 | // FIXME: The code below is ill-formed, because of the evil digraph '<:'. |
| 37 | // We should provide a much better error message than we currently do. |
| 38 | // A<::N::Z> *a10; |