On 10/3/22 23:53, Jason Merrill wrote: > On 9/30/22 18:50, Iain Sandoe wrote: >> Hi Jason, >> >>> On 30 Sep 2022, at 23:06, Jason Merrill wrote: >>> >>> You can't use CONVERT_EXPR to convert between two class types, and it >>> was >>> breaking copy elision. >>> >>> Unfortunately, this patch breaks symmetric-transfer-00-basic.C, where >>> susp_type is Loopy::handle_type.  How is this supposed to work? >> >> We are trying to save a type-erased handle (which the symmetric >> transfer makes >> and indirect call through, nothing else). > > The problem is you're treating one class directly as another class here, > without the indirection involved in usual type-erasure idioms. > > It does seem that the gimplifier handles this fine, but it doesn't > correspond to anything in the language and much of the front end assumes > that CONVERT_EXPR is only used for scalars.  VIEW_CONVERT_EXPR would > better express that we're not doing anything to the value, just cheating > the type system.  That's still dodgy from a language perspective, but > probably safe enough in this case. So I'm applying this: