https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93222
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID --- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- I don't see why you need that cast anyway, just do: auto localTail = _xHead.pPrev; That avoids the undefined behaviour.