blob: 4a79fb1d6747b3c93f1bc7612045b259c9cc4785 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
Douglas Gregor127102b2009-06-29 20:59:39 +00002template<typename T, typename U>
3T* next(T* ptr, const U& diff);
4
5template<typename T, typename U>
6T* next(T* ptr, const U& diff) {
7 return ptr + diff;
8}
9
10void test(int *iptr, float *fptr, int diff) {
Anders Carlsson03c9d532009-09-17 04:02:31 +000011 // CHECK: _Z4nextIiiEPT_S1_RKT0_
Douglas Gregor127102b2009-06-29 20:59:39 +000012 iptr = next(iptr, diff);
Anders Carlsson03c9d532009-09-17 04:02:31 +000013
14 // CHECK: _Z4nextIfiEPT_S1_RKT0_
Douglas Gregor127102b2009-06-29 20:59:39 +000015 fptr = next(fptr, diff);
16}
17
18template<typename T, typename U>
19T* next(T* ptr, const U& diff);
20
21void test2(int *iptr, double *dptr, int diff) {
22 iptr = next(iptr, diff);
Anders Carlsson03c9d532009-09-17 04:02:31 +000023
24 // CHECK: _Z4nextIdiEPT_S1_RKT0_
Douglas Gregor127102b2009-06-29 20:59:39 +000025 dptr = next(dptr, diff);
Owen Andersonbc0a2222009-07-27 21:00:51 +000026}