p3-0x.cpp revision a03478231363c67ea0e1f4bc1bc708e064040e56
1// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
2
3template <class T> struct eval; // expected-note 3{{template is declared here}}
4
5template <template <class, class...> class TT, class T1, class... Rest>
6struct eval<TT<T1, Rest...>> { };
7
8template <class T1> struct A;
9template <class T1, class T2> struct B;
10template <int N> struct C;
11template <class T1, int N> struct D;
12template <class T1, class T2, int N = 17> struct E;
13
14eval<A<int>> eA;
15eval<B<int, float>> eB;
16eval<C<17>> eC; // expected-error{{implicit instantiation of undefined template 'eval<C<17> >'}}
17eval<D<int, 17>> eD; // expected-error{{implicit instantiation of undefined template 'eval<D<int, 17> >'}}
18eval<E<int, float>> eE; // expected-error{{implicit instantiation of undefined template 'eval<E<int, float, 17> >}}
19
20template<template <int ...N> class TT> struct X0 { }; // expected-note{{previous non-type template parameter with type 'int' is here}}
21template<int I, int J, int ...Rest> struct X0a;
22template<int ...Rest> struct X0b;
23template<int I, long J> struct X0c; // expected-note{{template non-type parameter has a different type 'long' in template argument}}
24
25X0<X0a> inst_x0a;
26X0<X0b> inst_x0b;
27X0<X0c> inst_x0c; // expected-error{{template template argument has different template parameters than its corresponding template template parameter}}
28
29template<typename T,
30         template <T ...N> class TT>  // expected-note{{previous non-type template parameter with type 'short' is here}}
31struct X1 { };
32template<int I, int J, int ...Rest> struct X1a;
33template<long I, long ...Rest> struct X1b;
34template<short I, short J> struct X1c;
35template<short I, long J> struct X1d; // expected-note{{template non-type parameter has a different type 'long' in template argument}}
36
37X1<int, X1a> inst_x1a;
38X1<long, X1b> inst_x1b;
39X1<short, X1c> inst_x1c;
40X1<short, X1d> inst_x1d; // expected-error{{template template argument has different template parameters than its corresponding template template paramete}}
41