blob: ada244bb5de60b471279eccb4797cb7a843d9c9d [file] [log] [blame]
Daniel Dunbara45cf5b2009-03-24 02:24:46 +00001// RUN: clang-cc -fsyntax-only -verify %s
Douglas Gregor85e0f662009-02-10 00:24:35 +00002
3template<template<typename T> class X> struct A; // expected-note 2{{previous template template parameter is here}}
4
5template<template<typename T, int I> class X> struct B; // expected-note{{previous template template parameter is here}}
6
7template<template<int I> class X> struct C; // expected-note{{previous non-type template parameter with type 'int' is here}}
8
9template<class> struct X; // expected-note{{too few template parameters in template template argument}}
10template<int N> struct Y; // expected-note{{template parameter has a different kind in template argument}}
11template<long N> struct Ylong; // expected-note{{template non-type parameter has a different type 'long' in template argument}}
12
13namespace N {
14 template<class> struct Z;
15}
16template<class, class> struct TooMany; // expected-note{{too many template parameters in template template argument}}
17
18
19A<X> *a1;
20A<N::Z> *a2;
21A< ::N::Z> *a3;
22
Douglas Gregor7f741122009-02-25 19:37:18 +000023A<Y> *a4; // expected-error{{template template argument has different template parameters than its corresponding template template parameter}}
24A<TooMany> *a5; // expected-error{{template template argument has different template parameters than its corresponding template template parameter}}
25B<X> *a6; // expected-error{{template template argument has different template parameters than its corresponding template template parameter}}
Douglas Gregor85e0f662009-02-10 00:24:35 +000026C<Y> *a7;
Douglas Gregor7f741122009-02-25 19:37:18 +000027C<Ylong> *a8; // expected-error{{template template argument has different template parameters than its corresponding template template parameter}}
Douglas Gregor85e0f662009-02-10 00:24:35 +000028
Douglas Gregor9167f8b2009-11-11 01:00:40 +000029template<typename T> void f(int);
Douglas Gregor85e0f662009-02-10 00:24:35 +000030
Douglas Gregor9167f8b2009-11-11 01:00:40 +000031A<f> *a9; // expected-error{{must be a class template}}
Douglas Gregor85e0f662009-02-10 00:24:35 +000032
33// FIXME: The code below is ill-formed, because of the evil digraph '<:'.
34// We should provide a much better error message than we currently do.
35// A<::N::Z> *a10;