blob: 91eb53beffc101feeb6d4624761a5757083b77e3 [file] [log] [blame]
Douglas Gregor6b906862009-08-21 00:16:32 +00001// RUN: clang-cc -fsyntax-only -verify %s
Douglas Gregor37b372b2009-08-20 22:52:58 +00002
3struct X {
Douglas Gregor6b906862009-08-21 00:16:32 +00004 template<typename T> T& f0(T);
5
6 void g0(int i, double d) {
7 int &ir = f0(i);
8 double &dr = f0(d);
9 }
10
11 template<typename T> T& f1(T);
12 template<typename T, typename U> U& f1(T, U);
13
14 void g1(int i, double d) {
15 int &ir1 = f1(i);
16 int &ir2 = f1(d, i);
17 int &ir3 = f1(i, i);
18 }
Douglas Gregor37b372b2009-08-20 22:52:58 +000019};
Douglas Gregor6b906862009-08-21 00:16:32 +000020
21void test_X_f0(X x, int i, float f) {
22 int &ir = x.f0(i);
23 float &fr = x.f0(f);
24}
25
26void test_X_f1(X x, int i, float f) {
27 int &ir1 = x.f1(i);
28 int &ir2 = x.f1(f, i);
29 int &ir3 = x.f1(i, i);
Douglas Gregordec06662009-08-21 18:42:58 +000030}
Douglas Gregor15612482009-08-21 23:32:45 +000031
32void test_X_f0_address() {
33 int& (X::*pm1)(int) = &X::f0;
34 float& (X::*pm2)(float) = &X::f0;
35}
36
37void test_X_f1_address() {
38 int& (X::*pm1)(int) = &X::f1;
39 float& (X::*pm2)(float) = &X::f1;
40 int& (X::*pm3)(float, int) = &X::f1;
41}
Douglas Gregord83d0402009-08-22 00:34:47 +000042
43// PR4608
44class A { template <class x> x a(x z) { return z+y; } int y; };