diff --git a/lib/Object/MachOObject.cpp b/lib/Object/MachOObject.cpp index a64db1c60f0..529bdf97e59 100644 --- a/lib/Object/MachOObject.cpp +++ b/lib/Object/MachOObject.cpp @@ -44,7 +44,8 @@ static void ReadInMemoryStruct(const MachOObject &MOO, } // Check whether we can return a direct pointer. - struct_type *Ptr = (struct_type *) (Buffer.data() + Base); + struct_type *Ptr = reinterpret_cast( + const_cast(Buffer.data() + Base)); if (!MOO.isSwappedEndian()) { Res = Ptr; return;