From 976b300b70fb68d257bab38054d1820f9ddd2277 Mon Sep 17 00:00:00 2001 From: Sergey Prigogin Date: Tue, 17 Feb 2009 18:12:20 +0000 Subject: [PATCH] Bug 265070. Fix and extended test case. --- .../cdt/core/parser/tests/ast2/AST2TemplateTests.java | 3 ++- .../core/dom/parser/cpp/semantics/CPPTemplates.java | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java index 375a8d78619..58a8e5af278 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2TemplateTests.java @@ -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); } diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java index 18dd8bbf2ef..08f9d3caebe 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/semantics/CPPTemplates.java @@ -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; }