https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87847
--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> --- An idea would be to hash TEMPLATE_TEMPLATE_PARMs differently in iterative_hash_template_arg: hash its TEMPLATE_TYPE_PARM_INDEX and TEMPLATE_TEMPLATE_PARM_TEMPLATE_DECL, so that when they compare equal, they hash equal.