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

Parent scope of specializations based on index, bug 267013.

This commit is contained in:
Markus Schorn 2009-03-04 13:32:32 +00:00
parent e25410c174
commit 2cf4f5acdf
2 changed files with 18 additions and 5 deletions

View file

@ -1576,4 +1576,16 @@ public class IndexCPPTemplateResolutionTest extends IndexBindingResolutionTestBa
public void testDefaultTemplateArgInHeader_264988() throws Exception {
ICPPTemplateInstance ti= getBindingFromASTName("XT<>", 4, ICPPTemplateInstance.class);
}
// typedef int TInt;
// template <typename T> class XT {
// void m();
// };
// template<> void XT<int>::m() {
// TInt t;
// }
public void testParentScopeOfSpecialization_267013() throws Exception {
ITypedef ti= getBindingFromASTName("TInt", 4, ITypedef.class);
}
}

View file

@ -162,6 +162,7 @@ import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPUsingDeclaration;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPUsingDirective;
import org.eclipse.cdt.internal.core.dom.parser.cpp.CPPVariable;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPASTInternalScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPClassSpecializationScope;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPDeferredClassInstance;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalBinding;
import org.eclipse.cdt.internal.core.dom.parser.cpp.ICPPInternalUnknownScope;
@ -962,10 +963,10 @@ public class CPPSemantics {
IScope parentScope= scope.getParent();
// the index cannot return the translation unit as parent scope
if (unit != null) {
if (parentScope == null && scope instanceof IIndexScope) {
if (parentScope == null
&& (scope instanceof IIndexScope || scope instanceof ICPPClassSpecializationScope)) {
parentScope = unit.getScope();
}
else if (parentScope instanceof IIndexScope) {
} else if (parentScope instanceof IIndexScope) {
parentScope = unit.mapToASTScope((IIndexScope) parentScope);
}
}