1 // RUN: %clang_cc1 -fsyntax-only -verify %s
5 template<typename U> T f0(U);
6 template<typename U> U& f1(T*, U); // expected-error{{pointer to a reference}} \
7 // expected-note{{candidate}}
12 X0<int&> x0ir; // expected-note{{instantiation}}
14 void test_X0(int *ip, double *dp) {
17 double *&dpr = xi.f1(ip, dp);
18 xi.f1(dp, dp); // expected-error{{no matching}}
21 double *&dpr2 = xv.f1(ip, dp);
29 T y; // expected-error{{void}}
34 U x; // expected-error{{void}}
41 U z; // expected-error{{void}}
48 (void)(t + u); // expected-error{{invalid operands}}
53 return t + u; // expected-error{{cannot initialize return object}}
63 struct X1<T>::Inner4 {
72 U X1<T>::Inner4<U>::value; // expected-error{{reference variable}}
77 V X1<T>::Inner4<U>::f2(T t, U u, V) {
78 return t + u; // expected-error{{cannot initialize return object}}
81 void test_X1(int *ip, int i, double *dp) {
82 X1<void>::Inner0<int> *xvip; // okay
83 X1<void>::Inner0<int> xvi; // expected-note{{instantiation}}
85 X1<int>::Inner1<void> *xivp; // okay
86 X1<int>::Inner1<void> xiv; // expected-note{{instantiation}}
88 X1<int>::Inner2<void>::SuperInner *xisivp; // okay
89 X1<int>::Inner2<void>::SuperInner xisiv; // expected-note{{instantiation}}
91 X1<int*>::Inner3<int> id3;
93 id3.f0(dp, i); // expected-error{{cannot initialize a parameter of type 'int *' with an lvalue of type 'double *'}}
95 id3.f1(ip, i, dp); // expected-note{{instantiation}}
97 X1<int*>::Inner3<double*> id3b;
98 id3b.f0(ip, dp); // expected-note{{instantiation}}
100 X1<int*>::Inner4<int> id4;
101 id4.f2(ip, i, dp); // expected-note{{instantiation}}
103 X1<int*>::Inner4<int>::value = 17;
104 i = X1<int*>::Inner4<int&>::value; // expected-note{{instantiation}}
110 template<T *Ptr> // expected-error{{pointer to a reference}}
113 template<T Value> // expected-error{{cannot have type 'float'}}
117 X2<int&> x2a; // expected-note{{instantiation}}
118 X2<float> x2b; // expected-note{{instantiation}}
125 template<typename T> void f(X0<T>& vals) { g(vals); }
126 template<typename T> void g(X0<T>& vals) { }
129 void test(X1 x1, X0<int> x0i, X0<long> x0l) {
136 template <typename T>
140 template <E e> // subsitute T for E and bug goes away
144 typename sfinae<&U::operator=>::type test(int);
148 template <typename T>
151 template <E e> // subsitute T for E and bug goes away
155 typename sfinae<&U::operator=>::type test(int);