IIRC, it was when we changed Option:::get to return a const ref. Some
callers of 'Option<V> hashmap<K,V>::get()' were grabbing a const ref to the
temporary coming from the option (case 1 in your markdown), and it then
became a temporary to a temporary's member (case 2 in your markdown):

E.g.: https://reviews.apache.org/r/18386/diff/#6

Re: optimizations

Do you know what the state of the art is for RVO and NRVO? When is the
compiler unable to perform these optimizations?
I noticed you didn't mention move constructors. It looks like move
constructors guarantee we elide the copy into the caller's object, which
seems to be the whole motivation behind capturing a const ref?

On Mon, Mar 30, 2015 at 12:15 PM, Jie Yu <[email protected]> wrote:

> I am a +1 on this too. We had a similar bug long time ago when we changed
> the return value of Try::get() to be const ref.
>
> On Mon, Mar 30, 2015 at 11:52 AM, Niklas Nielsen <[email protected]>
> wrote:
>
> > Big +1; You could also mention the recent bug in the Two fold
> > authentication patch that you guys discovered with this bug.
> >
> > Niklas
> >
> > On 30 March 2015 at 10:49, Joris Van Remoortere <[email protected]>
> > wrote:
> >
> > > I would like to propose we disallow capturing temporaries using a
> > constant
> > > reference:
> > > const T& val = f();
> > >
> > > *The reasons, and examples for this are outlined in the proposal here:*
> > > [Review Board]: https://reviews.apache.org/r/32630/
> > > [original markdown version]:
> > > https://gist.github.com/jmlvanre/8a3de53ae88c2d19b375
> > >
> > >
> > > Please feel free to comment here on the dev-list, though I also urge
> you
> > to
> > > comment on the Review Request as putting proposal markdowns on RB is
> > > something new we're trying!
> > >
> > > Joris
> > >
> >
>

Reply via email to