Sorry for the delay in getting back to you on this; I just keep thinking
there has to be a better way to deal with this issue than this
increasingly complex fixup machinery.
The basic problem we're dealing with is that two typedefs from different
contexts are considered identical for the purpose of template argument
comparison, and we are leaving them in non-type template arguments, so
when we look for a pre-existing specialization one typedef gets replaced
by the other, which breaks.
The fixup stuff is a solution to the problem of typedefs with
incompatible template parameters leading to crashes, but it seems to me
that this is just a symptom of the problem of replacing one typedef with
another, and we should attack that underlying problem instead. That
problem is also visible when the typedefs have different names and an
error message ends up talking about the wrong one.
It seems to me that the way to do this is to strip typedefs from
non-type arguments like strip_typedefs does for types. Did we try this
before?
Ideal would be to treat a specialization using the typedef-using
arguments as a typedef to the specialization using the canonical
arguments, but that could follow on later.
Jason