mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +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:
parent
f6957b73ab
commit
48d5341bf7
2 changed files with 25 additions and 2 deletions
|
@ -2383,4 +2383,24 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
|
||||||
public void testAmbiguousBaseClassLookup_413406() throws Exception {
|
public void testAmbiguousBaseClassLookup_413406() throws Exception {
|
||||||
getProblemFromASTName("eof();", 3);
|
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));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,8 +114,11 @@ public abstract class CPPTemplateDefinition extends PlatformObject implements IC
|
||||||
final ICPPClassTemplate ib = getIndexBinding();
|
final ICPPClassTemplate ib = getIndexBinding();
|
||||||
if (ib instanceof ICPPInstanceCache) {
|
if (ib instanceof ICPPInstanceCache) {
|
||||||
ICPPTemplateInstance cand= ((ICPPInstanceCache) ib).getInstance(arguments);
|
ICPPTemplateInstance cand= ((ICPPInstanceCache) ib).getInstance(arguments);
|
||||||
if (cand instanceof IIndexBinding &&
|
if (cand instanceof IIndexBinding) {
|
||||||
getTemplateName().getTranslationUnit().getIndexFileSet().containsDeclaration((IIndexBinding) cand)) {
|
if (getTemplateName().getTranslationUnit().getIndexFileSet().containsDeclaration((IIndexBinding) cand)) {
|
||||||
|
return cand;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
return cand;
|
return cand;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue