1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Bug 265070. Fix and extended test case.

This commit is contained in:
Sergey Prigogin 2009-02-17 18:12:20 +00:00
parent 022068033d
commit 976b300b70
2 changed files with 9 additions and 3 deletions

View file

@ -3839,7 +3839,8 @@ public class AST2TemplateTests extends AST2BaseTest {
// };
//
// int x = A<0>::e;
public void _testEnumeratorInTemplateInstance_265070() throws Exception {
// A<0>::E y;
public void testEnumeratorInTemplateInstance_265070() throws Exception {
String code= getAboveComment();
parseAndCheckBindings(code, ParserLanguage.CPP);
}

View file

@ -35,6 +35,8 @@ import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration;
import org.eclipse.cdt.core.dom.ast.IArrayType;
import org.eclipse.cdt.core.dom.ast.IBasicType;
import org.eclipse.cdt.core.dom.ast.IBinding;
import org.eclipse.cdt.core.dom.ast.IEnumeration;
import org.eclipse.cdt.core.dom.ast.IEnumerator;
import org.eclipse.cdt.core.dom.ast.IFunction;
import org.eclipse.cdt.core.dom.ast.IFunctionType;
import org.eclipse.cdt.core.dom.ast.IParameter;
@ -678,8 +680,8 @@ public class CPPTemplates {
return instance;
}
public static ICPPSpecialization createSpecialization(ICPPClassSpecialization owner, IBinding decl) {
ICPPSpecialization spec = null;
public static IBinding createSpecialization(ICPPClassSpecialization owner, IBinding decl) {
IBinding spec = null;
final ICPPTemplateParameterMap tpMap= owner.getTemplateParameterMap();
if (decl instanceof ICPPClassTemplatePartialSpecialization) {
try {
@ -709,6 +711,9 @@ public class CPPTemplates {
spec = new CPPFunctionSpecialization(decl, owner, tpMap);
} else if (decl instanceof ITypedef) {
spec = new CPPTypedefSpecialization(decl, owner, tpMap);
} else if (decl instanceof IEnumeration || decl instanceof IEnumerator) {
// TODO(sprigogin): Deal with a case when an enumerator value depends on a template parameter.
spec = decl;
}
return spec;
}