diff --git a/lldb/unittests/Host/NativeProcessProtocolTest.cpp b/lldb/unittests/Host/NativeProcessProtocolTest.cpp index 39d636207a54..298c2909b616 100644 --- a/lldb/unittests/Host/NativeProcessProtocolTest.cpp +++ b/lldb/unittests/Host/NativeProcessProtocolTest.cpp @@ -131,7 +131,8 @@ llvm::Expected> FakeMemory::Read(addr_t Addr, return llvm::createStringError(llvm::inconvertibleErrorCode(), "Address out of range."); Size = std::min(Size, Data.size() - (size_t)Addr); - return std::vector(&Data[Addr], &Data[Addr + Size]); + auto Begin = std::next(Data.begin(), Addr); + return std::vector(Begin, std::next(Begin, Size)); } llvm::Expected FakeMemory::Write(addr_t Addr,