• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2 
3 // Check for template type parameter pack (mis-)matches with template
4 // type parameters.
5 template<typename ...T> struct X0t;
6 template<typename ...T> struct X0t;
7 
8 template<typename ...T> struct X1t; // expected-note{{previous template type parameter pack declared here}}
9 template<typename T> struct X1t; // expected-error{{template type parameter conflicts with previous template type parameter pack}}
10 
11 template<typename T> struct X2t; // expected-note{{previous template type parameter declared here}}
12 template<typename ...T> struct X2t; // expected-error{{template type parameter pack conflicts with previous template type parameter}}
13 
14 template<template<typename ...T> class> struct X0t_intt;
15 template<template<typename ...T> class> struct X0t_intt;
16 
17 template<template<typename ...T> class> struct X1t_intt; // expected-note{{previous template type parameter pack declared here}}
18 template<template<typename T> class> struct X1t_intt; // expected-error{{template type parameter conflicts with previous template type parameter pack}}
19 
20 template<template<typename T> class> struct X2t_intt; // expected-note{{previous template type parameter declared here}}
21 template<template<typename ...T> class> struct X2t_intt; // expected-error{{template type parameter pack conflicts with previous template type parameter}}
22 
23 template<int ...Values> struct X1nt; // expected-note{{previous non-type template parameter pack declared here}}
24 template<int Values> struct X1nt; // expected-error{{non-type template parameter conflicts with previous non-type template parameter pack}}
25 
26 template<template<class T> class> class X1tt; // expected-note{{previous template template parameter declared here}}
27 template<template<class T> class...> class X1tt; // expected-error{{template template parameter pack conflicts with previous template template parameter}}
28 
29 // Check for matching with out-of-line definitions
30 namespace rdar8859985 {
31   template<typename ...> struct tuple { };
32   template<int ...> struct int_tuple { };
33 
34   template<typename T>
35   struct X {
36     template<typename ...Args1, int ...Indices1>
37     X(tuple<Args1...>, int_tuple<Indices1...>);
38   };
39 
40   template<typename T>
41   template<typename ...Args1, int ...Indices1>
X(tuple<Args1...>,int_tuple<Indices1...>)42   X<T>::X(tuple<Args1...>, int_tuple<Indices1...>) {}
43 }
44