[llvm] r304589 - Fix build error with clang and gcc.
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 5 11:52:54 PDT 2017
http://en.cppreference.com/w/cpp/memory/unique_ptr/unique_ptr - the 6th
ctor is the one that would be used here.
The std::move is necessary except when using a compiler (like Clang) that
implements the relevant C++ Defect Report against C++11 (C++11 said only if
the return expression was /only/ the name of a local variable (no implicit
conversions, etc) would it be treated as a temporary - which gets hung up
in cases like this - the DR allows the "treat it as a temporary even if
there are implicit conversions", basically).
On Mon, Jun 5, 2017 at 11:50 AM Zachary Turner <zturner at google.com> wrote:
> Result is a std::unique_ptr<T> where T is a subclass of DebugSubsection.
> So you can't implicitly convert from unique_ptr<T> to
> unique_ptr<DebugSubsection>.
>
> I *think* this is correct, but if not maybe I need to investigate further?
>
> On Mon, Jun 5, 2017 at 11:42 AM David Blaikie <dblaikie at gmail.com> wrote:
>
>> Is the llvm::cast necessary here? I can't quite spot why it would be.
>>
>> On Fri, Jun 2, 2017 at 1:00 PM Zachary Turner via llvm-commits <
>> llvm-commits at lists.llvm.org> wrote:
>>
>>> Author: zturner
>>> Date: Fri Jun 2 15:00:10 2017
>>> New Revision: 304589
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=304589&view=rev
>>> Log:
>>> Fix build error with clang and gcc.
>>>
>>> Modified:
>>> llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp
>>>
>>> Modified: llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp?rev=304589&r1=304588&r2=304589&view=diff
>>>
>>> ==============================================================================
>>> --- llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp (original)
>>> +++ llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp Fri Jun 2
>>> 15:00:10 2017
>>> @@ -261,7 +261,7 @@ std::unique_ptr<DebugSubsection> YAMLLin
>>> }
>>> }
>>> }
>>> - return Result;
>>> + return llvm::cast<DebugSubsection>(std::move(Result));
>>> }
>>>
>>> std::unique_ptr<DebugSubsection>
>>> @@ -282,7 +282,7 @@ YAMLInlineeLinesSubsection::toCodeViewSu
>>> Result->addExtraFile(EF);
>>> }
>>> }
>>> - return Result;
>>> + return llvm::cast<DebugSubsection>(std::move(Result));
>>> }
>>>
>>> static Expected<SourceFileChecksumEntry>
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170605/2f5fce0e/attachment.html>
More information about the llvm-commits
mailing list