>> + // If the types of the underlying templates match, compare >> + // their constraints. The declarations could differ there. >> + if (types_match) >> + types_match = equivalent_constraints (get_constraints >> (olddecl), >> + current_template_reqs); > > > We can't assume that current_template_reqs will always apply to newdecl > here, as decls_match is called in overload resolution as well. What's the > problem with attaching the requirements to the declaration before we get to > duplicate_decls?
It's because newdecl doesn't have a template_info at the point at which this is called, and the constraints are associated through that information. This seems like another good reason for keeping constraints with template decls. Until I change that, I can just test to see if newdecl has template info. If so, I'll use its constraints. If not, I'll use the current requirements. Andrew