Skip to content

Commit 4fab4ab

Browse files
authored
[SYCLomatic] Fix replace_if/replace_copy_if for corner case (#584)
* [SYCLomatic] Fix replace_copy_if for long long Signed-off-by: Lu, John <[email protected]> * [SYClomatic] fix replace_if/replace_copy_if corner case Signed-off-by: Lu, John <[email protected]> * Deal with corner case of replace_copy_if. long -> long long Signed-off-by: Lu, John <[email protected]> --------- Signed-off-by: Lu, John <[email protected]>
1 parent cb60ceb commit 4fab4ab

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clang/runtime/dpct-rt/include/dpl_extras/algorithm.h.inc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void replace_if(Policy &&policy, Iter1 first, Iter1 last, Iter2 mask, Pred p,
6969
std::random_access_iterator_tag>::value,
7070
"Iterators passed to algorithms must be random-access iterators.");
7171
std::transform(std::forward<Policy>(policy), first, last, mask, first,
72-
internal::replace_if_fun<T, Pred>(p, new_value));
72+
internal::replace_if_fun<typename std::iterator_traits<Iter1>::value_type, Pred>(p, new_value));
7373
}
7474
// DPCT_LABEL_END
7575

@@ -91,7 +91,7 @@ Iter3 replace_copy_if(Policy &&policy, Iter1 first, Iter1 last, Iter2 mask,
9191
std::random_access_iterator_tag>::value,
9292
"Iterators passed to algorithms must be random-access iterators.");
9393
return std::transform(std::forward<Policy>(policy), first, last, mask, result,
94-
internal::replace_if_fun<T, Pred>(p, new_value));
94+
internal::replace_if_fun<typename std::iterator_traits<Iter3>::value_type, Pred>(p, new_value));
9595
}
9696
// DPCT_LABEL_END
9797

clang/test/dpct/helper_files_ref/include/dpl_extras/algorithm.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ void replace_if(Policy &&policy, Iter1 first, Iter1 last, Iter2 mask, Pred p,
3030
std::random_access_iterator_tag>::value,
3131
"Iterators passed to algorithms must be random-access iterators.");
3232
std::transform(std::forward<Policy>(policy), first, last, mask, first,
33-
internal::replace_if_fun<T, Pred>(p, new_value));
33+
internal::replace_if_fun<typename std::iterator_traits<Iter1>::value_type, Pred>(p, new_value));
3434
}
3535

3636
template <typename Policy, typename Iter1, typename Iter2, typename Iter3,
@@ -46,7 +46,7 @@ Iter3 replace_copy_if(Policy &&policy, Iter1 first, Iter1 last, Iter2 mask,
4646
std::random_access_iterator_tag>::value,
4747
"Iterators passed to algorithms must be random-access iterators.");
4848
return std::transform(std::forward<Policy>(policy), first, last, mask, result,
49-
internal::replace_if_fun<T, Pred>(p, new_value));
49+
internal::replace_if_fun<typename std::iterator_traits<Iter3>::value_type, Pred>(p, new_value));
5050
}
5151

5252
template <typename Policy, typename Iter1, typename Iter2, typename Pred>

0 commit comments

Comments
 (0)