Re: Fwd: mozilla::TemporaryRef is gone; please use already_AddRefed

2015-07-06 Thread Michael Layzell
I suppose that the general problem is that we are using an nsRefPtr lvalue in one side of the branch, and an nsRefPtr xvalue on the other (as the nullptr is being cast to an nsRefPtr, which has to live in a temporary making it an xvalue). This is reasonable in a situation where we actually want

Re: Fwd: mozilla::TemporaryRef is gone; please use already_AddRefed

2015-07-06 Thread Neil
Michael Layzell wrote: In summary, the nsRefPtr is copied into a temporary in its side of the conditional. The nullptr is cast to a struct Foo*, which is constructed into a nsRefPtr, which is bound to a temporary, and then moved around a bit between temporaries. The resulting temporary xvalue

Fwd: mozilla::TemporaryRef is gone; please use already_AddRefed

2015-07-03 Thread Michael Layzell
With regard to what #2 is doing, I threw the following into a file with nsRefPtr, and got clang to dump the AST: struct Foo {void AddRef() {} void Release() {}}; nsRefPtr bar; void foo() { Foo* x = true ? nullptr : bar; } `-FunctionDecl 0x103805750 line:943:6 foo 'void (void)' `-CompoundStmt