blob: 944acacd8441b149546049515f17fcbff4bcaf7a [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -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;
Douglas Gregor229c2812010-08-06 14:15:26 +000036
37// PR7807
38namespace N {
39 template <typename, typename = int>
40 struct X
41 { };
42
43 template <typename ,int>
44 struct Y
45 { X<int> const_ref(); };
46
47 template <template<typename,int> class TT, typename T, int N>
48 int operator<<(int, TT<T, N> a) { // expected-note{{candidate template ignored}}
49 0 << a.const_ref(); // expected-error{{invalid operands to binary expression ('int' and 'X<int>')}}
50 }
51
52 void f0( Y<int,1> y){ 1 << y; } // expected-note{{in instantiation of function template specialization 'N::operator<<<Y, int, 1>' requested here}}
53}