2009-08-21 08:16:32 +08:00
|
|
|
// RUN: clang-cc -fsyntax-only -verify %s
|
2009-08-21 06:52:58 +08:00
|
|
|
|
|
|
|
struct X {
|
2009-08-21 08:16:32 +08:00
|
|
|
template<typename T> T& f0(T);
|
|
|
|
|
|
|
|
void g0(int i, double d) {
|
|
|
|
int &ir = f0(i);
|
|
|
|
double &dr = f0(d);
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename T> T& f1(T);
|
|
|
|
template<typename T, typename U> U& f1(T, U);
|
|
|
|
|
|
|
|
void g1(int i, double d) {
|
|
|
|
int &ir1 = f1(i);
|
|
|
|
int &ir2 = f1(d, i);
|
|
|
|
int &ir3 = f1(i, i);
|
|
|
|
}
|
2009-08-21 06:52:58 +08:00
|
|
|
};
|
2009-08-21 08:16:32 +08:00
|
|
|
|
|
|
|
void test_X_f0(X x, int i, float f) {
|
|
|
|
int &ir = x.f0(i);
|
|
|
|
float &fr = x.f0(f);
|
|
|
|
}
|
|
|
|
|
|
|
|
void test_X_f1(X x, int i, float f) {
|
|
|
|
int &ir1 = x.f1(i);
|
|
|
|
int &ir2 = x.f1(f, i);
|
|
|
|
int &ir3 = x.f1(i, i);
|
2009-08-22 02:42:58 +08:00
|
|
|
}
|
2009-08-22 07:32:45 +08:00
|
|
|
|
|
|
|
void test_X_f0_address() {
|
|
|
|
int& (X::*pm1)(int) = &X::f0;
|
|
|
|
float& (X::*pm2)(float) = &X::f0;
|
|
|
|
}
|
|
|
|
|
|
|
|
void test_X_f1_address() {
|
|
|
|
int& (X::*pm1)(int) = &X::f1;
|
|
|
|
float& (X::*pm2)(float) = &X::f1;
|
|
|
|
int& (X::*pm3)(float, int) = &X::f1;
|
|
|
|
}
|
2009-08-22 08:34:47 +08:00
|
|
|
|
2009-09-01 05:16:32 +08:00
|
|
|
void test_X_f0_explicit(X x, int i, long l) {
|
|
|
|
int &ir1 = x.f0<int>(i);
|
|
|
|
int &ir2 = x.f0<>(i);
|
2009-09-01 08:37:14 +08:00
|
|
|
long &il1 = x.f0<long>(i);
|
2009-09-01 05:16:32 +08:00
|
|
|
}
|
|
|
|
|
2009-08-22 08:34:47 +08:00
|
|
|
// PR4608
|
|
|
|
class A { template <class x> x a(x z) { return z+y; } int y; };
|
2009-09-03 06:59:36 +08:00
|
|
|
|