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

David Blaikie via llvm-commits llvm-commits at
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> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the llvm-commits mailing list