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:
parent
e25410c174
commit
2cf4f5acdf
2 changed files with 18 additions and 5 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,11 +963,11 @@ 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) {
|
||||
parentScope= unit.getScope();
|
||||
}
|
||||
else if (parentScope instanceof IIndexScope) {
|
||||
parentScope= unit.mapToASTScope((IIndexScope) parentScope);
|
||||
if (parentScope == null
|
||||
&& (scope instanceof IIndexScope || scope instanceof ICPPClassSpecializationScope)) {
|
||||
parentScope = unit.getScope();
|
||||
} else if (parentScope instanceof IIndexScope) {
|
||||
parentScope = unit.mapToASTScope((IIndexScope) parentScope);
|
||||
}
|
||||
}
|
||||
return (ICPPScope) parentScope;
|
||||
|
|
Loading…
Add table
Reference in a new issue