blob: e1b9bb4874f791367ea5bd2c8081ae7f962817cd [file] [log] [blame]
Douglas Gregor85e0f662009-02-10 00:24:35 +00001// RUN: clang -fsyntax-only -verify %s
2
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
23A<Y> *a4; // expected-error{{template template argument has different template parameters than its corresponding template template parameter}} \
24 // FIXME::expected-error{{expected unqualified-id}}
25A<TooMany> *a5; // expected-error{{template template argument has different template parameters than its corresponding template template parameter}} \
26 // FIXME::expected-error{{expected unqualified-id}}
27B<X> *a6; // expected-error{{template template argument has different template parameters than its corresponding template template parameter}} \
28 // FIXME::expected-error{{expected unqualified-id}}
29C<Y> *a7;
30C<Ylong> *a8; // expected-error{{template template argument has different template parameters than its corresponding template template parameter}} \
31 // FIXME::expected-error{{expected unqualified-id}}
32
33template<typename T> void f(int);
34
35// FIXME: we're right to provide an error message, but it should say
36// that we need a class template. We won't get this right until name
37// lookup of 'f' returns a TemplateDecl.
Douglas Gregor0e558532009-02-11 16:16:59 +000038A<f> *a9; // expected-error{{template argument for template template parameter must be a template}} \
39 // expected-error{{unqualified-id}}
Douglas Gregor85e0f662009-02-10 00:24:35 +000040
41// FIXME: The code below is ill-formed, because of the evil digraph '<:'.
42// We should provide a much better error message than we currently do.
43// A<::N::Z> *a10;