https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77656
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Jakub Jelinek from comment #1) > Perhaps tsubst of TEMPLATE_PARM_INDEX instead of just > return convert_from_reference (unshare_expr (arg)); > also convert it to the TEMPLATE_PARM_INDEX's type (if it is integral type > only, or when?)? That would work, but the arg ought to already have the right type from convert_nontype_argument. I'll take a look.