From 4d3f79f2ad75cf7c366d27466cfced41c395adf9 Mon Sep 17 00:00:00 2001 From: Johannes Doerfert Date: Mon, 27 Mar 2023 22:13:38 -0700 Subject: [PATCH] [OpenMP] Resolve const cast issue introduced in D123446 --- openmp/libomptarget/include/device.h | 2 +- openmp/libomptarget/src/omptarget.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openmp/libomptarget/include/device.h b/openmp/libomptarget/include/device.h index 695f864b5ec66..5f147f9c77e64 100644 --- a/openmp/libomptarget/include/device.h +++ b/openmp/libomptarget/include/device.h @@ -251,7 +251,7 @@ struct HostDataToTargetTy { /// OFFLOAD_SUCCESS. The entry is locked for this operation. template int foreachShadowPointerInfo(CBTy CB) const { for (auto &It : States->ShadowPtrInfos) - if (CB(It) == OFFLOAD_FAIL) + if (CB(const_cast(It)) == OFFLOAD_FAIL) return OFFLOAD_FAIL; return OFFLOAD_SUCCESS; } diff --git a/openmp/libomptarget/src/omptarget.cpp b/openmp/libomptarget/src/omptarget.cpp index 9df1d3637fde2..0459648a4802f 100644 --- a/openmp/libomptarget/src/omptarget.cpp +++ b/openmp/libomptarget/src/omptarget.cpp @@ -1038,7 +1038,7 @@ static int targetDataContiguous(ident_t *Loc, DeviceTy &Device, void *ArgsBase, } if (TPR.getEntry()) { int Ret = TPR.getEntry()->foreachShadowPointerInfo( - [&](const ShadowPtrInfoTy &ShadowPtr) { + [&](ShadowPtrInfoTy &ShadowPtr) { DP("Restoring original target pointer value " DPxMOD " for target " "pointer " DPxMOD "\n", DPxPTR(ShadowPtr.TgtPtrVal), DPxPTR(ShadowPtr.TgtPtrAddr));