1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Provide correct argMap to deferred class instantiations.

This commit is contained in:
Markus Schorn 2008-05-19 13:22:07 +00:00
parent b7b12ba6d8
commit 5965feb288
3 changed files with 15 additions and 13 deletions

View file

@ -71,17 +71,14 @@ public class CPPClassTemplatePartialSpecialization extends CPPClassTemplate impl
return null;
}
boolean argsContainDependentType= false;
ObjectMap argMap = new ObjectMap( specArgs.length );
int numSpecArgs = specArgs.length;
for( int i = 0; i < numSpecArgs; i++ ){
IType spec = specArgs[i];
IType arg = args[i];
//If the argument is a template parameter, we can't instantiate yet, defer for later
if( CPPTemplates.isDependentType( arg ) ){
// mstodo the argmap may be partially filled
return deferredInstance( argMap, args );
}
argsContainDependentType= argsContainDependentType || CPPTemplates.isDependentType(arg);
try {
if( !CPPTemplates.deduceTemplateArgument( argMap, spec, arg ) )
return null;
@ -90,6 +87,10 @@ public class CPPClassTemplatePartialSpecialization extends CPPClassTemplate impl
}
}
if (argsContainDependentType) {
return deferredInstance( argMap, args );
}
ICPPTemplateParameter [] params = getTemplateParameters();
int numParams = params.length;
for( int i = 0; i < numParams; i++ ){

View file

@ -1875,9 +1875,9 @@ public class CPPTemplates {
result = bindings[0];
}
}
if (unknown instanceof ICPPUnknownClassInstance && result instanceof ICPPTemplateDefinition) {
if (unknown instanceof ICPPUnknownClassInstance && result instanceof ICPPInternalTemplateInstantiator) {
IType[] newArgs = CPPTemplates.instantiateTypes(((ICPPUnknownClassInstance) unknown).getArguments(), argMap, null);
result = CPPTemplates.instantiateTemplate((ICPPTemplateDefinition) result, newArgs, null);
result = ((ICPPInternalTemplateInstantiator) result).instantiate(newArgs);
}
}
}

View file

@ -181,17 +181,14 @@ class PDOMCPPClassTemplatePartialSpecialization extends
return null;
}
boolean argsContainDependentType= false;
ObjectMap argMap = new ObjectMap( specArgs.length );
int numSpecArgs = specArgs.length;
for( int i = 0; i < numSpecArgs; i++ ){
IType spec = specArgs[i];
IType arg = args[i];
//If the argument is a template parameter, we can't instantiate yet, defer for later
if( CPPTemplates.isDependentType( arg ) ){
// mstodo argMap may be partially initialized.
return deferredInstance( argMap, args );
}
argsContainDependentType= argsContainDependentType || CPPTemplates.isDependentType(arg);
try {
if( !CPPTemplates.deduceTemplateArgument( argMap, spec, arg ) )
return null;
@ -199,7 +196,11 @@ class PDOMCPPClassTemplatePartialSpecialization extends
return null;
}
}
if (argsContainDependentType) {
return deferredInstance( argMap, args );
}
ICPPTemplateParameter [] params = getTemplateParameters();
int numParams = params.length;
for( int i = 0; i < numParams; i++ ){