Skip to content

Commit 9972690

Browse files
[SYCL] Add LIT regression test for ambiguous call to memcpy (#14995)
`detail::memcpy`, even though in a different namespace, can cause ambiguity with libc's memcpy, due to argument dependent lookup (ADL). This compile-only test checks for ambiguity in call to `detail::memcpy`. As discussed in #14836 (comment) --------- Co-authored-by: Steffen Larsen <steffen.larsen@intel.com>
1 parent 99a69c0 commit 9972690

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// RUN: %clang -fsycl -fsycl-device-only -fsyntax-only %s
2+
3+
// detail::memcpy, even though in a different namespace, can cause ambiguity
4+
// with libc's memcpy, due to argument dependent lookup (ADL). This compile-only
5+
// test checks for ambiguity in call to detail::memcpy.
6+
7+
#include <sycl/vector.hpp>
8+
9+
template <typename T> void foo(T *dst, T *src, size_t count) {
10+
memcpy(dst, src, count * sizeof(T));
11+
}
12+
13+
using T = sycl::vec<int, 1>;
14+
15+
SYCL_EXTERNAL void bar(T *dst, T *src, size_t count) {
16+
foo(dst, src, count * sizeof(T));
17+
}

0 commit comments

Comments
 (0)