<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>Michael,</div><div><br></div>In lld, we have places that used nested a ErrorOr<std::unique_ptr<xx>> and I often hit compiler errors that require breaking up expressions to work around.   Do you have suggestions on how to code the following simple examples to not error?  Can some of these be fixed in ErrorOr.h?  Or am I totally not getting something?<div><br></div><div>-Nick<br><div><br></div><div><br><font face="Monaco" size="1">struct Foo { void doit(); };<br><br><br>std::unique_ptr<Foo> factoryU() {<br>  std::unique_ptr<Foo> f(new Foo);<br>  return f;  // works as expected<br>}<br><br>ErrorOr<Foo*> factoryE() {<br>  ErrorOr<Foo*> f = new Foo;<br>  return f;  // works as expected<br>}<br><br>ErrorOr<std::unique_ptr<Foo>> factoryEU() {<br>  std::unique_ptr<Foo> f(new Foo);<br>  return f; // ERROR: call to implicitly-deleted copy constructor of 'std::__1::unique_ptr<Foo, std::__1::default_delete<Foo> >’<br>}<br><br><br>void sinkU(std::unique_ptr<Foo> f) {<br>  f->doit();  // works as expected<br>}<br><br>void sinkE(ErrorOr<Foo*> f) {<br>  f->doit(); // ERROR: member reference base type 'typename remove_reference<Foo *>::type' (aka 'Foo *') is not a structure or union'<br>}<br><br>void sinkEU(ErrorOr<std::unique_ptr<Foo>> f) {<br>  f->doit(); // ERROR: no member named 'doit' in 'std::__1::unique_ptr<Foo, std::__1::default_delete<Foo> >'<br>}<br><br></font><br></div></div></body></html>