diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java index 8d3003fc04f..d3c26a57bd6 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/includes/BindingClassifier.java @@ -91,7 +91,9 @@ import org.eclipse.cdt.core.dom.ast.cpp.ICPPMethod; import org.eclipse.cdt.core.dom.ast.cpp.ICPPNamespace; import org.eclipse.cdt.core.dom.ast.cpp.ICPPReferenceType; import org.eclipse.cdt.core.dom.ast.cpp.ICPPSpecialization; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument; import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateDefinition; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap; import org.eclipse.cdt.core.index.IIndexMacro; import org.eclipse.cdt.core.index.IndexFilter; @@ -276,9 +278,20 @@ public class BindingClassifier { } if (binding instanceof ICPPSpecialization) { + ICPPTemplateParameterMap parameterMap = ((ICPPSpecialization) binding).getTemplateParameterMap(); + for (Integer position : parameterMap.getAllParameterPositions()) { + ICPPTemplateArgument argument = parameterMap.getArgument(position); + IType type = argument.getTypeValue(); + // Normally we don't need to define parameters of a template specialization that + // were not specified explicitly. __gnu_cxx::hash is an exception from that rule. + if (type instanceof IBinding && "hash".equals(((IBinding) type).getName())) { //$NON-NLS-1$ + IBinding owner = ((IBinding) type).getOwner(); + if (owner instanceof ICPPNamespace && "__gnu_cxx".equals(owner.getName())) //$NON-NLS-1$ + bindings.add((IBinding) type); + } + } // Get the specialized binding - e.g. get the binding for X if the current binding is - // for the template specialization X. Resolution of the specialization - // (i.e. template) arguments is handled separately by the caller of this method. + // for the template specialization X. binding = ((ICPPSpecialization) binding).getSpecializedBinding(); }