https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97024
--- Comment #1 from John Haiducek <jhaiduce at gmail dot com> --- This bug shows some similarity to 92587 and 82996, but I suspect they are distinct. 92587 had a much more complicated MWE and the OP was unable to reduce it to a single file. 82996 did not involve class polymorphism, which seems to be required to trigger this bug. Someone with better knowledge of the compiler might be able to identify a common cause however.