<div dir="ltr">Richard, do you think there's anything we could do better here?<br><br>It seems difficult to support proper move semantic behavior for [Sema]DiagnosticBuilder across the two common use cases:<br><br>  DiagnosticBuilder D;<br>  D << x;<br>  D << y;<br>  return D;<br><br>and<br><br>  return DiagnosticBuilder() << x << y;<br><br>The only thing I can imagine is if every one of those op<< were function templates using universal references (I forget, is that the right name for them?) and matching their return value (so in the first case, passed a non-const lvalue ref, they return by non-const lvalue ref, and in the second case, passed an rvalue, they return the same). But that seems painful.<br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Aug 18, 2015 at 1:54 PM, David Blaikie via cfe-commits <span dir="ltr"><<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: dblaikie<br>
Date: Tue Aug 18 15:54:26 2015<br>
New Revision: 245352<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=245352&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project?rev=245352&view=rev</a><br>
Log:<br>
Workaround -Wdeprecated on SemDiagnosticConsumer's tricksy copy ctor.<br>
<br>
Modified:<br>
    cfe/trunk/include/clang/Sema/Sema.h<br>
<br>
Modified: cfe/trunk/include/clang/Sema/Sema.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=245352&r1=245351&r2=245352&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=245352&r1=245351&r2=245352&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/include/clang/Sema/Sema.h (original)<br>
+++ cfe/trunk/include/clang/Sema/Sema.h Tue Aug 18 15:54:26 2015<br>
@@ -1054,6 +1054,14 @@ public:<br>
     SemaDiagnosticBuilder(DiagnosticBuilder &DB, Sema &SemaRef, unsigned DiagID)<br>
       : DiagnosticBuilder(DB), SemaRef(SemaRef), DiagID(DiagID) { }<br>
<br>
+    // This is a cunning lie. DiagnosticBuilder actually performs move<br>
+    // construction in its copy constructor (but due to varied uses, it's not<br>
+    // possible to conveniently express this as actual move construction). So<br>
+    // the default copy ctor here is fine, because the base class disables the<br>
+    // source anyway, so the user-defined ~SemaDiagnosticBuilder is a safe no-op<br>
+    // in that case anwyay.<br>
+    SemaDiagnosticBuilder(const SemaDiagnosticBuilder&) = default;<br>
+<br>
     ~SemaDiagnosticBuilder() {<br>
       // If we aren't active, there is nothing to do.<br>
       if (!isActive()) return;<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div>