From 5b5213adf556effae6ded208c8f0157b8b7bbdab Mon Sep 17 00:00:00 2001 From: Jatin Chaudhary Date: Fri, 1 Dec 2023 13:07:37 +0000 Subject: [PATCH] SWDEV-431399 - add const cast to pointer before casting it to function type. C++ does not allow const qualifier on function type, even if we add it it will get ignored and clang will fail with failed cast from const void* to func*. const_cast here is necessary to make it work. Change-Id: I72cec8d9e715bdf9e163cb9b08393dd733dafaf2 --- hipamd/src/hip_intercept.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hipamd/src/hip_intercept.cpp b/hipamd/src/hip_intercept.cpp index 2445ef2fa3..637c90640c 100644 --- a/hipamd/src/hip_intercept.cpp +++ b/hipamd/src/hip_intercept.cpp @@ -48,7 +48,7 @@ const char* hipKernelNameRefByPtr(const void* host_function, hipStream_t stream) void hipRegisterTracerCallback(const void* function) { typedef int (*fptr)(activity_domain_t domain, uint32_t operation_id, void* data); - fptr my_fptr = reinterpret_cast(function); + fptr my_fptr = reinterpret_cast(const_cast(function)); activity_prof::report_activity.store(my_fptr, std::memory_order_relaxed); }