https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61909

--- Comment #4 from lukeocamden at gmail dot com ---
(In reply to Jonathan Wakely from comment #3)
> (In reply to lukeocamden from comment #2)
> > (In reply to Jonathan Wakely from comment #1)
> > > This is by design.
> > 
> > I don't really follow - do you mean a consequence of the design, or does the
> > standard mandate copying/moving the object into the heap, or does using the
> > heap have some other benefit?
> 
> None of the above.
> 
> I mean the author of our std::function intentionally chose to only avoid the
> heap for function pointers
> 
>   /**
>    *  Trait identifying "location-invariant" types, meaning that the
>    *  address of the object (or any of its members) will not escape.
>    *  Also implies a trivial copy constructor and assignment operator.
>    */

If this doesn't offer a clear advantage, should I try to come up with a patch
to support small objects too?

Reply via email to