1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-30 21:55:31 +02:00

Bug 516338 - Avoid calling instantiateType() on arguments of non-dependent template instances

Change-Id: I51628e9b6ca569943879f48d4c0d0b740bdc23b8
This commit is contained in:
Nathan Ridge 2017-05-29 01:39:56 -04:00
parent 1dceabb0eb
commit bd4656755c

View file

@ -1484,7 +1484,7 @@ public class CPPTemplates {
public static IType instantiateType(final IType type, InstantiationContext context) {
if (context.getParameterMap() == null)
return type;
TypeInstantiationRequest instantiationRequest = new TypeInstantiationRequest(type, context);
if (!instantiationsInProgress.get().add(instantiationRequest)) {
return type instanceof ICPPFunctionType ?
@ -1575,21 +1575,6 @@ public class CPPTemplates {
return (IType) ((ICPPClassSpecialization) newOwner).specializeMember(typeAsBinding, context.getPoint());
}
}
if (unwound instanceof ICPPTemplateInstance && !(unwound instanceof ICPPDeferredClassInstance)) {
// Argument of a class specialization can be a nested class subject to specialization.
final ICPPTemplateInstance classInstance = (ICPPTemplateInstance) unwound;
final IBinding origClass = classInstance.getSpecializedBinding();
if (origClass instanceof ICPPClassType) {
ICPPTemplateArgument[] args = classInstance.getTemplateArguments();
ICPPTemplateArgument[] newArgs = instantiateArguments(args, context, false);
if (newArgs != args) {
CPPTemplateParameterMap tparMap =
instantiateArgumentMap(classInstance.getTemplateParameterMap(), context);
return new CPPClassInstance((ICPPClassType) origClass, classInstance.getOwner(), tparMap, args);
}
}
}
}
// An alias template instance may have dependent arguments that don't contribute