freebsd-dev/test/CodeGenCXX/function-template-specialization.cpp

27 lines
591 B
C++
Raw Normal View History

2010-01-01 10:34:51 +00:00
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
2009-07-04 13:58:54 +00:00
template<typename T, typename U>
T* next(T* ptr, const U& diff);
template<typename T, typename U>
T* next(T* ptr, const U& diff) {
return ptr + diff;
}
void test(int *iptr, float *fptr, int diff) {
2009-10-14 18:03:49 +00:00
// CHECK: _Z4nextIiiEPT_S1_RKT0_
2009-07-04 13:58:54 +00:00
iptr = next(iptr, diff);
2009-10-14 18:03:49 +00:00
// CHECK: _Z4nextIfiEPT_S1_RKT0_
2009-07-04 13:58:54 +00:00
fptr = next(fptr, diff);
}
template<typename T, typename U>
T* next(T* ptr, const U& diff);
void test2(int *iptr, double *dptr, int diff) {
iptr = next(iptr, diff);
2009-10-14 18:03:49 +00:00
// CHECK: _Z4nextIdiEPT_S1_RKT0_
2009-07-04 13:58:54 +00:00
dptr = next(dptr, diff);
2009-10-14 18:03:49 +00:00
}