https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69836
--- Comment #5 from Jason Merrill <jason at gcc dot gnu.org> --- (In reply to Jason Merrill from comment #4) > Here, the > problem looks to be that we're re-calculating the type of w_counter inside > the function definition (where the current function is in the overload set) > rather than using the actual parameter type (which is calculated before the > current function is in the overload set). Ah, the actual problem is regenerate_decl_from_template changing the type of w_counter.