https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99088
Patrick Palka <ppalka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ppalka at gcc dot gnu.org --- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> --- GCC 11 appears to be much slower than GCC 10 here because snapshots of trunk are by default built with extra checking enabled, and your testcase is exercising a check in the type comparison code that seems to be quadratic in the depth of the template instantiation. Release builds (by default) don't perform this particular check, which is why GCC 10 appears to be much faster. You can disable most of these sanity checks when using snapshots of trunk by passing -fno-checking to the compile command line.