xref: /llvm-project/clang/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp (revision 9ca5c425826329d5b23300bbc8a1a7c10a19c64d)
1*9ca5c425SRichard Smith // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
22e87ca21SDouglas Gregor 
32e87ca21SDouglas Gregor // Check for template type parameter pack (mis-)matches with template
42e87ca21SDouglas Gregor // type parameters.
52e87ca21SDouglas Gregor template<typename ...T> struct X0t;
62e87ca21SDouglas Gregor template<typename ...T> struct X0t;
72e87ca21SDouglas Gregor 
82e87ca21SDouglas Gregor template<typename ...T> struct X1t; // expected-note{{previous template type parameter pack declared here}}
92e87ca21SDouglas Gregor template<typename T> struct X1t; // expected-error{{template type parameter conflicts with previous template type parameter pack}}
102e87ca21SDouglas Gregor 
112e87ca21SDouglas Gregor template<typename T> struct X2t; // expected-note{{previous template type parameter declared here}}
122e87ca21SDouglas Gregor template<typename ...T> struct X2t; // expected-error{{template type parameter pack conflicts with previous template type parameter}}
132e87ca21SDouglas Gregor 
14cdc62c93SDouglas Gregor template<template<typename ...T> class> struct X0t_intt;
15cdc62c93SDouglas Gregor template<template<typename ...T> class> struct X0t_intt;
162e87ca21SDouglas Gregor 
17cdc62c93SDouglas Gregor template<template<typename ...T> class> struct X1t_intt; // expected-note{{previous template type parameter pack declared here}}
18cdc62c93SDouglas Gregor template<template<typename T> class> struct X1t_intt; // expected-error{{template type parameter conflicts with previous template type parameter pack}}
192e87ca21SDouglas Gregor 
20cdc62c93SDouglas Gregor template<template<typename T> class> struct X2t_intt; // expected-note{{previous template type parameter declared here}}
21cdc62c93SDouglas Gregor template<template<typename ...T> class> struct X2t_intt; // expected-error{{template type parameter pack conflicts with previous template type parameter}}
22f550077eSDouglas Gregor 
23cdc62c93SDouglas Gregor template<int ...Values> struct X1nt; // expected-note{{previous non-type template parameter pack declared here}}
24cdc62c93SDouglas Gregor template<int Values> struct X1nt; // expected-error{{non-type template parameter conflicts with previous non-type template parameter pack}}
25cdc62c93SDouglas Gregor 
26cdc62c93SDouglas Gregor template<template<class T> class> class X1tt; // expected-note{{previous template template parameter declared here}}
27cdc62c93SDouglas Gregor template<template<class T> class...> class X1tt; // expected-error{{template template parameter pack conflicts with previous template template parameter}}
28018778afSDouglas Gregor 
29018778afSDouglas Gregor // Check for matching with out-of-line definitions
30018778afSDouglas Gregor namespace rdar8859985 {
31018778afSDouglas Gregor   template<typename ...> struct tuple { };
32018778afSDouglas Gregor   template<int ...> struct int_tuple { };
33018778afSDouglas Gregor 
34018778afSDouglas Gregor   template<typename T>
35018778afSDouglas Gregor   struct X {
36018778afSDouglas Gregor     template<typename ...Args1, int ...Indices1>
37018778afSDouglas Gregor     X(tuple<Args1...>, int_tuple<Indices1...>);
38018778afSDouglas Gregor   };
39018778afSDouglas Gregor 
40018778afSDouglas Gregor   template<typename T>
41018778afSDouglas Gregor   template<typename ...Args1, int ...Indices1>
X(tuple<Args1...>,int_tuple<Indices1...>)42018778afSDouglas Gregor   X<T>::X(tuple<Args1...>, int_tuple<Indices1...>) {}
43018778afSDouglas Gregor }
44