1 // RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
2 // expected-no-diagnostics
4 // Various tests related to partial ordering of variadic templates.
5 template<typename
...Types
> struct tuple
;
7 template<typename Tuple
>
9 static const unsigned value
= 0;
12 template<typename Head
, typename
...Tail
>
13 struct X1
<tuple
<Head
, Tail
...> > {
14 static const unsigned value
= 1;
17 template<typename Head
, typename
...Tail
>
18 struct X1
<tuple
<Head
, Tail
&...> > {
19 static const unsigned value
= 2;
22 template<typename Head
, typename
...Tail
>
23 struct X1
<tuple
<Head
&, Tail
&...> > {
24 static const unsigned value
= 3;
27 int check0
[X1
<tuple
<>>::value
== 0? 1 : -1];
28 int check1
[X1
<tuple
<int>>::value
== 2? 1 : -1];
29 int check2
[X1
<tuple
<int, int>>::value
== 1? 1 : -1];
30 int check3
[X1
<tuple
<int, int&>>::value
== 2? 1 : -1];
31 int check4
[X1
<tuple
<int&, int&>>::value
== 3? 1 : -1];
33 // Partial ordering of function templates.
34 template<typename T1
, typename T2
, typename
...Rest
>
35 int &f0(T1
, T2
, Rest
...);
37 template<typename T1
, typename T2
>
41 int &ir1
= f0(1, 2.0, 'a');
42 float &fr1
= f0(1, 2.0);
45 template<typename T1
, typename T2
, typename
...Rest
>
46 int &f1(T1
, T2
, Rest
...);
48 template<typename T1
, typename T2
>
49 float &f1(T1
, T2
, ...);
52 int &ir1
= f1(1, 2.0, 'a');
55 template<typename T1
, typename T2
, typename
...Rest
>
56 int &f2(T1
, T2
, Rest
...);
61 int &ir1
= f2(1, 2.0, 'a');