Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] template partial specialization

If a simple class is defined in two translation unit then the PDOM contains two IBindings. That seems valid, the definitions are independent and could be completely different.

However when a template class is partially specialized in two translation units, the PDOM has only one IBinding. I don’t think this is valid because those definitions are actually just as independent as the simple class case, they could be completely different from each other. Further, the single IBinding has an invalid combination of the two definitions.

There are more details at

The sharing is caused by the binding for the template class which has a list of partials. I think that when looking up values in that list there should be consideration of the point at which the lookup is happening — the partial should be ignored if it is not in the lookup point’s translation unit.

I think the way to do that is to change CPPTemplates.selectSpecialization to pass the point argument when calling template.getPartialSpecializations() (line 2253 in 5d7a265). The filter in #getPartialSpecializations would be something like:


However, that would also affect all other callers of #getPartialSpecializations(), and the point doesn’t always seem to be available.

Does anyone else have thoughts on this?


Back to the top