https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95158
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> --- That the issue goes away when templates are not involved seems an useful hint: are we trying to optimize too early? Sorry, for the time being I don't feel like assigning the bug to me, I'm in the middle of too many other things...