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:
parent
b7b12ba6d8
commit
5965feb288
3 changed files with 15 additions and 13 deletions
|
@ -71,17 +71,14 @@ public class CPPClassTemplatePartialSpecialization extends CPPClassTemplate impl
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean argsContainDependentType= false;
|
||||||
ObjectMap argMap = new ObjectMap( specArgs.length );
|
ObjectMap argMap = new ObjectMap( specArgs.length );
|
||||||
int numSpecArgs = specArgs.length;
|
int numSpecArgs = specArgs.length;
|
||||||
for( int i = 0; i < numSpecArgs; i++ ){
|
for( int i = 0; i < numSpecArgs; i++ ){
|
||||||
IType spec = specArgs[i];
|
IType spec = specArgs[i];
|
||||||
IType arg = args[i];
|
IType arg = args[i];
|
||||||
|
|
||||||
//If the argument is a template parameter, we can't instantiate yet, defer for later
|
argsContainDependentType= argsContainDependentType || CPPTemplates.isDependentType(arg);
|
||||||
if( CPPTemplates.isDependentType( arg ) ){
|
|
||||||
// mstodo the argmap may be partially filled
|
|
||||||
return deferredInstance( argMap, args );
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if( !CPPTemplates.deduceTemplateArgument( argMap, spec, arg ) )
|
if( !CPPTemplates.deduceTemplateArgument( argMap, spec, arg ) )
|
||||||
return null;
|
return null;
|
||||||
|
@ -90,6 +87,10 @@ public class CPPClassTemplatePartialSpecialization extends CPPClassTemplate impl
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argsContainDependentType) {
|
||||||
|
return deferredInstance( argMap, args );
|
||||||
|
}
|
||||||
|
|
||||||
ICPPTemplateParameter [] params = getTemplateParameters();
|
ICPPTemplateParameter [] params = getTemplateParameters();
|
||||||
int numParams = params.length;
|
int numParams = params.length;
|
||||||
for( int i = 0; i < numParams; i++ ){
|
for( int i = 0; i < numParams; i++ ){
|
||||||
|
|
|
@ -1875,9 +1875,9 @@ public class CPPTemplates {
|
||||||
result = bindings[0];
|
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);
|
IType[] newArgs = CPPTemplates.instantiateTypes(((ICPPUnknownClassInstance) unknown).getArguments(), argMap, null);
|
||||||
result = CPPTemplates.instantiateTemplate((ICPPTemplateDefinition) result, newArgs, null);
|
result = ((ICPPInternalTemplateInstantiator) result).instantiate(newArgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,17 +181,14 @@ class PDOMCPPClassTemplatePartialSpecialization extends
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean argsContainDependentType= false;
|
||||||
ObjectMap argMap = new ObjectMap( specArgs.length );
|
ObjectMap argMap = new ObjectMap( specArgs.length );
|
||||||
int numSpecArgs = specArgs.length;
|
int numSpecArgs = specArgs.length;
|
||||||
for( int i = 0; i < numSpecArgs; i++ ){
|
for( int i = 0; i < numSpecArgs; i++ ){
|
||||||
IType spec = specArgs[i];
|
IType spec = specArgs[i];
|
||||||
IType arg = args[i];
|
IType arg = args[i];
|
||||||
|
|
||||||
//If the argument is a template parameter, we can't instantiate yet, defer for later
|
argsContainDependentType= argsContainDependentType || CPPTemplates.isDependentType(arg);
|
||||||
if( CPPTemplates.isDependentType( arg ) ){
|
|
||||||
// mstodo argMap may be partially initialized.
|
|
||||||
return deferredInstance( argMap, args );
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
if( !CPPTemplates.deduceTemplateArgument( argMap, spec, arg ) )
|
if( !CPPTemplates.deduceTemplateArgument( argMap, spec, arg ) )
|
||||||
return null;
|
return null;
|
||||||
|
@ -200,6 +197,10 @@ class PDOMCPPClassTemplatePartialSpecialization extends
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (argsContainDependentType) {
|
||||||
|
return deferredInstance( argMap, args );
|
||||||
|
}
|
||||||
|
|
||||||
ICPPTemplateParameter [] params = getTemplateParameters();
|
ICPPTemplateParameter [] params = getTemplateParameters();
|
||||||
int numParams = params.length;
|
int numParams = params.length;
|
||||||
for( int i = 0; i < numParams; i++ ){
|
for( int i = 0; i < numParams; i++ ){
|
||||||
|
|
Loading…
Add table
Reference in a new issue