<div dir="ltr">Many thanks for the reply,<div>right, this is what the discussion is about.</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Sep 28, 2020 at 10:57 AM David Blaikie <<a href="mailto:dblaikie@gmail.com">dblaikie@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">To clarify, this is a discussion around whether given some move-only type X, implicitly convertible to Y and the code "Y func() { X x; return x; }" is that valid in LLVM? (and, as a corollary, if the type isn't move-only, is that code efficient (does it move rather than copying) - as in the vector example given)<br><br>I /believe/ the answer is that it is not valid. I think the set of compilers supported includes those that do not implement this rule. (either due to the language version we compile with, or due to it being a DR that some supported compiler versions do not implement). But that's just my rough guess.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sat, Sep 26, 2020 at 3:17 PM Alexander Shaposhnikov via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello everyone!<div><div><div>It looks like in the LLVM codebase (including subprojects) there are some inconsistencies <br><div>in how values are returned from functions with the following (or similar) signature:</div><div> Expected<std::vector<int>> createVector() {</div><div> std::vector<int> V;</div><div> ... </div><div> }</div><div>It would be interesting to find out your opinion on this.</div><div>After some investigation I have found <a href="https://reviews.llvm.org/D70963" target="_blank">https://reviews.llvm.org/D70963</a> and <a href="https://reviews.llvm.org/D43322" target="_blank">https://reviews.llvm.org/D43322</a> which have some additional context regarding </div></div><div>the problem. The aforementioned diffs (and the comments on them) contain a lot of</div></div></div><div>details and the history of the problem (whether one should use the cast or not).</div><div>If I am not mistaken a part of the problem is that compilers' behaviors have changed over time, and e.g. the latest versions would use a move constructor while the older ones could use a copy constructor. So the question is where we stand at the moment / what is the recommended approach for the new code.</div><div><br></div><div>Many thanks in advance,</div><div>Alexander Shaposhnikov</div><div><br></div></div>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div>
</blockquote></div>