summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNathan Ridge2013-12-12 21:49:33 (EST)
committer Sergey Prigogin2013-12-15 02:12:57 (EST)
commit48d5341bf7fdfd5b11540e032ed2dc969e8c32d1 (patch)
tree45dc4cf456a66d9f552dccb39a65d04dd58a7cf2
parentf6957b73aba276392effe789f8dbfc10f401b793 (diff)
downloadorg.eclipse.cdt-48d5341bf7fdfd5b11540e032ed2dc969e8c32d1.zip
org.eclipse.cdt-48d5341bf7fdfd5b11540e032ed2dc969e8c32d1.tar.gz
org.eclipse.cdt-48d5341bf7fdfd5b11540e032ed2dc969e8c32d1.tar.bz2
Bug 401820 - Explicit specialization of template declared in headerrefs/changes/42/19742/2
Change-Id: Ibf2156f880d42e87b1d954772b0faae384f9784b Signed-off-by: Nathan Ridge <zeratul976@hotmail.com> Reviewed-on: https://git.eclipse.org/r/19742 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
-rw-r--r--core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java20
-rw-r--r--core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateDefinition.java7
2 files changed, 25 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
index 86b1aaf..3042996 100644
--- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
+++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/index/tests/IndexCPPTemplateResolutionTest.java
@@ -2383,4 +2383,24 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
public void testAmbiguousBaseClassLookup_413406() throws Exception {
getProblemFromASTName("eof();", 3);
}
+
+ // template <typename = void>
+ // struct S;
+
+ // #include "header.h"
+ // template <>
+ // struct S<void> {
+ // typedef int type;
+ // };
+ //
+ // template <typename>
+ // struct S {
+ // typedef char type;
+ // };
+ //
+ // typedef S<>::type T;
+ public void testExplicitSpecializationOfTemplateDeclaredInHeader_401820() throws Exception {
+ IType T = getBindingFromASTName("T", 1);
+ assertEquals("int", ASTTypeUtil.getType(T));
+ }
}
diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateDefinition.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateDefinition.java
index 79f92c9..9aea40d 100644
--- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateDefinition.java
+++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPTemplateDefinition.java
@@ -114,8 +114,11 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
final ICPPClassTemplate ib = getIndexBinding();
if (ib instanceof ICPPInstanceCache) {
ICPPTemplateInstance cand= ((ICPPInstanceCache) ib).getInstance(arguments);
- if (cand instanceof IIndexBinding &&
- getTemplateName().getTranslationUnit().getIndexFileSet().containsDeclaration((IIndexBinding) cand)) {
+ if (cand instanceof IIndexBinding) {
+ if (getTemplateName().getTranslationUnit().getIndexFileSet().containsDeclaration((IIndexBinding) cand)) {
+ return cand;
+ }
+ } else {
return cand;
}
}