opnsense-src/test/CodeGenCXX/function-template-specialization.cpp

27 lines
589 B
C++
Raw Normal View History

2009-10-14 14:03:49 -04:00
// RUN: clang-cc -emit-llvm %s -o - | FileCheck %s
2009-07-04 09:58:54 -04: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 14:03:49 -04:00
// CHECK: _Z4nextIiiEPT_S1_RKT0_
2009-07-04 09:58:54 -04:00
iptr = next(iptr, diff);
2009-10-14 14:03:49 -04:00
// CHECK: _Z4nextIfiEPT_S1_RKT0_
2009-07-04 09:58:54 -04: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 14:03:49 -04:00
// CHECK: _Z4nextIdiEPT_S1_RKT0_
2009-07-04 09:58:54 -04:00
dptr = next(dptr, diff);
2009-10-14 14:03:49 -04:00
}