From: Adrian McCarthy Date: Mon, 9 Oct 2017 17:50:01 +0000 (+0000) Subject: Fix after r315079 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=24dbfe7f156cf4f01e0196e1b43450cf95fd88c6;p=llvm Fix after r315079 Microsoft's debug implementation of std::copy checks if the destination is an array and then does some bounds checking. This was causing an assertion failure in fs::rename_internal which copies to a buffer of the appropriate size but that's type-punned to an array of length 1 for API compatibility reasons. Fix is to make make the destination a pointer rather than an array. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@315222 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/Windows/Path.inc b/lib/Support/Windows/Path.inc index fbed7f8b025..045734c3694 100644 --- a/lib/Support/Windows/Path.inc +++ b/lib/Support/Windows/Path.inc @@ -372,7 +372,7 @@ static std::error_code rename_internal(HANDLE FromHandle, const Twine &To, RenameInfo.ReplaceIfExists = ReplaceIfExists; RenameInfo.RootDirectory = 0; RenameInfo.FileNameLength = ToWide.size(); - std::copy(ToWide.begin(), ToWide.end(), RenameInfo.FileName); + std::copy(ToWide.begin(), ToWide.end(), &RenameInfo.FileName[0]); if (!SetFileInformationByHandle(FromHandle, FileRenameInfo, &RenameInfo, RenameInfoBuf.size()))