<div dir="ltr"><a href="http://en.cppreference.com/w/cpp/memory/unique_ptr/unique_ptr">http://en.cppreference.com/w/cpp/memory/unique_ptr/unique_ptr</a> - the 6th ctor is the one that would be used here.<br><br>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).<br></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jun 5, 2017 at 11:50 AM Zachary Turner <<a href="mailto:zturner@google.com">zturner@google.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">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>.<div><br></div><div>I *think* this is correct, but if not maybe I need to investigate further?</div></div><br><div class="gmail_quote"><div dir="ltr">On Mon, Jun 5, 2017 at 11:42 AM David Blaikie <<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Is the llvm::cast necessary here? I can't quite spot why it would be.</div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jun 2, 2017 at 1:00 PM Zachary Turner via llvm-commits <<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: zturner<br>
Date: Fri Jun  2 15:00:10 2017<br>
New Revision: 304589<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=304589&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=304589&view=rev</a><br>
Log:<br>
Fix build error with clang and gcc.<br>
<br>
Modified:<br>
    llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp<br>
<br>
Modified: llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp?rev=304589&r1=304588&r2=304589&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp?rev=304589&r1=304588&r2=304589&view=diff</a><br>
==============================================================================<br>
--- llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp (original)<br>
+++ llvm/trunk/lib/ObjectYAML/CodeViewYAMLDebugSections.cpp Fri Jun  2 15:00:10 2017<br>
@@ -261,7 +261,7 @@ std::unique_ptr<DebugSubsection> YAMLLin<br>
       }<br>
     }<br>
   }<br>
-  return Result;<br>
+  return llvm::cast<DebugSubsection>(std::move(Result));<br>
 }<br>
<br>
 std::unique_ptr<DebugSubsection><br>
@@ -282,7 +282,7 @@ YAMLInlineeLinesSubsection::toCodeViewSu<br>
       Result->addExtraFile(EF);<br>
     }<br>
   }<br>
-  return Result;<br>
+  return llvm::cast<DebugSubsection>(std::move(Result));<br>
 }<br>
<br>
 static Expected<SourceFileChecksumEntry><br>
<br>
<br>
_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits</a><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>