https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112908
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> --- I've taken a look and may have a WIP patch. I *think* the problem is that we aren't implementing this bullet properly: Otherwise, VAL<T> is a prvalue that initially has type T. because ref_xes_from_temporary uses build_trait_object + force_rvalue/rvalue, but that actually gets us an xvalue. Every xvalue is an rvalue so the functions work correctly, but here we want a prvalue so that copy elision works. We currently do not seem to have a helper function to get a prvalue given a type T.
