blob: eb6a4500306e78ab45862447d3dfb41191871d0a [file] [log] [blame]
Douglas Gregore704c9d2009-08-27 16:57:43 +00001// RUN: clang-cc -fsyntax-only -verify %s
2
3template<typename T>
4struct X0 {
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}}
8};
9
10X0<int> x0i;
11X0<void> x0v;
12X0<int&> x0ir; // expected-note{{instantiation}}
13
14void test_X0(int *ip, double *dp) {
15 X0<int> xi;
16 int i1 = xi.f0(ip);
17 double *&dpr = xi.f1(ip, dp);
18 xi.f1(dp, dp); // expected-error{{no matching}}
19
20 X0<void> xv;
21 double *&dpr2 = xv.f1(ip, dp);
22}
Douglas Gregora654dd82009-08-28 17:37:35 +000023
Douglas Gregor01afeef2009-08-28 20:31:08 +000024template<typename T>
25struct X1 {
26 template<typename U>
27 struct Inner0 {
28 U x;
29 T y; // expected-error{{void}}
30 };
31
32 template<typename U>
33 struct Inner1 {
34 U x; // expected-error{{void}}
35 T y;
36 };
37};
38
39void test_X1() {
40 X1<void>::Inner0<int> *xvip; // okay
41 X1<void>::Inner0<int> xvi; // expected-note{{instantiation}}
42
43 X1<int>::Inner1<void> *xivp; // okay
44 X1<int>::Inner1<void> xiv; // expected-note{{instantiation}}
45}