1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc template<typename T, typename U>
3*f4a2713aSLionel Sambuc struct X {
fX4*f4a2713aSLionel Sambuc T f(T x, U y) { return x + y; }
5*f4a2713aSLionel Sambuc
gX6*f4a2713aSLionel Sambuc unsigned g(T x, U y) { return sizeof(f(x, y)); }
7*f4a2713aSLionel Sambuc };
8*f4a2713aSLionel Sambuc
test(X<int,int> * xii,X<int *,int> * xpi,X<int,int * > * xip)9*f4a2713aSLionel Sambuc void test(X<int, int> *xii, X<int*, int> *xpi, X<int, int*> *xip) {
10*f4a2713aSLionel Sambuc (void)xii->f(1, 2);
11*f4a2713aSLionel Sambuc (void)xpi->f(0, 2);
12*f4a2713aSLionel Sambuc (void)sizeof(xip->f(2, 0)); // okay: does not instantiate
13*f4a2713aSLionel Sambuc (void)xip->g(2, 0); // okay: does not instantiate
14*f4a2713aSLionel Sambuc }
15*f4a2713aSLionel Sambuc
16*f4a2713aSLionel Sambuc template<typename T, typename U>
add(T t,U u)17*f4a2713aSLionel Sambuc T add(T t, U u) {
18*f4a2713aSLionel Sambuc return t + u; // expected-error{{invalid operands}}
19*f4a2713aSLionel Sambuc }
20*f4a2713aSLionel Sambuc
test_add(char * cp,int i,int * ip)21*f4a2713aSLionel Sambuc void test_add(char *cp, int i, int *ip) {
22*f4a2713aSLionel Sambuc char* cp2 = add(cp, i);
23*f4a2713aSLionel Sambuc add(cp, cp); // expected-note{{instantiation of}}
24*f4a2713aSLionel Sambuc (void)sizeof(add(ip, ip));
25*f4a2713aSLionel Sambuc }
26