2014-01-15 03:35:09 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - | FileCheck %s
|
2014-12-16 12:52:14 +08:00
|
|
|
|
|
|
|
// CHECK-DAG: _ZZN7PR219047GetDataIiEERKibE1i = internal global i32 4
|
|
|
|
// CHECK-DAG: _ZZN7PR219047GetDataIiEERKibE1i_0 = internal global i32 2
|
|
|
|
|
2009-06-30 04:59:39 +08: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-09-17 12:02:31 +08:00
|
|
|
// CHECK: _Z4nextIiiEPT_S1_RKT0_
|
2009-06-30 04:59:39 +08:00
|
|
|
iptr = next(iptr, diff);
|
2009-09-17 12:02:31 +08:00
|
|
|
|
|
|
|
// CHECK: _Z4nextIfiEPT_S1_RKT0_
|
2009-06-30 04:59:39 +08: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-09-17 12:02:31 +08:00
|
|
|
|
|
|
|
// CHECK: _Z4nextIdiEPT_S1_RKT0_
|
2009-06-30 04:59:39 +08:00
|
|
|
dptr = next(dptr, diff);
|
2009-07-28 05:00:51 +08:00
|
|
|
}
|
2014-12-16 12:52:14 +08:00
|
|
|
|
|
|
|
namespace PR21904 {
|
|
|
|
template <typename>
|
|
|
|
const int &GetData(bool);
|
|
|
|
|
|
|
|
template <>
|
|
|
|
const int &GetData<int>(bool b) {
|
|
|
|
static int i = 4;
|
|
|
|
if (b) {
|
|
|
|
static int i = 2;
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
return i;
|
|
|
|
}
|
|
|
|
}
|