diff --git a/llvm/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp b/llvm/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp index 9d768d97f389..cdc52a39b5f2 100644 --- a/llvm/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp +++ b/llvm/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp @@ -514,7 +514,13 @@ TEST_F(MCJITCAPITest, addGlobalMapping) { buildMCJITOptions(); buildMCJITEngine(); - LLVMAddGlobalMapping(Engine, MappedFn, reinterpret_cast(&localTestFunc)); + union { + int (*raw)(); + void *usable; + } functionPointer; + functionPointer.raw = &localTestFunc; + + LLVMAddGlobalMapping(Engine, MappedFn, functionPointer.usable); buildAndRunPasses();