Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / SemaTemplate / temp_func_order.cpp
blob908354b58ed2b286b6415a8261515bbd450ef72f
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 template<typename T>
3 int &f0(T);
5 template<typename T>
6 float &f0(T*);
8 void test_f0(int i, int *ip) {
9 int &ir = f0(i);
10 float &fr = f0(ip);
13 template<typename T, typename U>
14 int &f1(T, U);
16 template<typename T>
17 float &f1(T, T);
19 void test_f1(int i, float f) {
20 int &ir = f1(i, f);
21 float &fr1 = f1(i, i);
22 float &fr2 = f1(f, f);
25 template<typename T, typename U>
26 struct A { };
28 template<typename T>
29 int &f2(T);
31 template<typename T, typename U>
32 float &f2(A<T, U>);
34 template<typename T>
35 double &f2(A<T, T>);
37 void test_f2(int i, A<int, float> aif, A<int, int> aii) {
38 int &ir = f2(i);
39 float &fr = f2(aif);
40 double &dr = f2(aii);
43 template<typename T, typename U>
44 int &f3(T*, U); // expected-note{{candidate}}
46 template<typename T, typename U>
47 float &f3(T, U*); // expected-note{{candidate}}
49 void test_f3(int i, int *ip, float *fp) {
50 int &ir = f3(ip, i);
51 float &fr = f3(i, fp);
52 f3(ip, ip); // expected-error{{ambiguous}}
55 template<typename T>
56 int &f4(T&);
58 template<typename T>
59 float &f4(const T&);
61 void test_f4(int i, const int ic) {
62 int &ir1 = f4(i);
63 float &fr1 = f4(ic);
66 template<typename T, typename U>
67 int &f5(T&, const U&); // expected-note{{candidate}}
69 template<typename T, typename U>
70 float &f5(const T&, U&); // expected-note{{candidate}}
72 void test_f5(int i, const int ic) {
73 f5(i, i); // expected-error{{ambiguous}}
76 template<typename T, typename U>
77 int &f6(T&, U&);
79 template<typename T, typename U>
80 float &f6(const T&, U&);
82 void test_f6(int i, const int ic) {
83 int &ir = f6(i, i);
84 float &fr = f6(ic, ic);
87 struct CrazyFun {
88 template<typename T, typename U> operator A<T, U>();
89 template<typename T> operator A<T, T>();
92 void fun(CrazyFun cf) {
93 A<int, float> aif = cf;
94 A<int, int> aii = cf;