1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-30 20:35:38 +02:00

Bug 401820 - Explicit specialization of template declared in header

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>
This commit is contained in:
Nathan Ridge 2013-12-12 21:49:33 -05:00 committed by Sergey Prigogin
parent f6957b73ab
commit 48d5341bf7
2 changed files with 25 additions and 2 deletions

View file

@ -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));
}
}

View file

@ -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;
}
}