1 // RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple %s -o - | FileCheck %s 2 3 // CHECK-DAG: _ZZN7PR219047GetDataIiEERKibE1i = internal global i32 4 4 // CHECK-DAG: _ZZN7PR219047GetDataIiEERKibE1i_0 = internal global i32 2 5 6 template<typename T, typename U> 7 T* next(T* ptr, const U& diff); 8 9 template<typename T, typename U> 10 T* next(T* ptr, const U& diff) { 11 return ptr + diff; 12 } 13 14 void test(int *iptr, float *fptr, int diff) { 15 // CHECK: _Z4nextIiiEPT_S1_RKT0_ 16 iptr = next(iptr, diff); 17 18 // CHECK: _Z4nextIfiEPT_S1_RKT0_ 19 fptr = next(fptr, diff); 20 } 21 22 template<typename T, typename U> 23 T* next(T* ptr, const U& diff); 24 25 void test2(int *iptr, double *dptr, int diff) { 26 iptr = next(iptr, diff); 27 28 // CHECK: _Z4nextIdiEPT_S1_RKT0_ 29 dptr = next(dptr, diff); 30 } 31 32 namespace PR21904 { 33 template <typename> 34 const int &GetData(bool); 35 36 template <> 37 const int &GetData<int>(bool b) { 38 static int i = 4; 39 if (b) { 40 static int i = 2; 41 return i; 42 } 43 return i; 44 } 45 } 46