PATCH: add a c'tor to ErrorOr that allows us to perform two user defined conversions

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 3 21:41:22 PST 2016


Drop the std::move (this would incorrectly move in this case, I think:

std::string s;
ErrorOr<std::string> g = s;

I think? Perhaps you could add a test case for a case like that to ensure
the move does not occur (you'd need a type that recorded its move
operations, etc)

Other than that, please commit

On Wed, Feb 3, 2016 at 6:58 PM, Nick Lewycky via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> The attached patch changes ErrorOr to make this code:
>
>   ErrorOr<string> test() { return "literal"; }
>
> work. Without this patch it fails because it would require two
> user-defined conversions in a row. Please review!
>
> I'm not sure whether it's correct to describe this as "perfect forwarding"?
>
> Nick
>
>
> _______________________________________________
> 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/20160203/07fb91f0/attachment.html>


More information about the llvm-commits mailing list