mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
fix bug 105852
This commit is contained in:
parent
f1fa62b185
commit
416f05ffe1
2 changed files with 25 additions and 4 deletions
|
@ -1899,4 +1899,29 @@ public class AST2TemplateTests extends AST2BaseTest {
|
||||||
ICPPMethod f = (ICPPMethod) col.getName(8).resolveBinding();
|
ICPPMethod f = (ICPPMethod) col.getName(8).resolveBinding();
|
||||||
assertSame( f, col.getName(10).resolveBinding() );
|
assertSame( f, col.getName(10).resolveBinding() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void testBug105852() throws Exception {
|
||||||
|
StringBuffer buffer = new StringBuffer();
|
||||||
|
buffer.append("template< class T1, int q > class C {}; \n"); //$NON-NLS-1$
|
||||||
|
buffer.append("template< class T1, class T2> class A {}; \n"); //$NON-NLS-1$
|
||||||
|
buffer.append("template< class T1, class T2, int q1, int q2>\n"); //$NON-NLS-1$
|
||||||
|
buffer.append("class A< C<T1, q1>, C<T2, q2> > {}; \n"); //$NON-NLS-1$
|
||||||
|
buffer.append("class N {}; \n"); //$NON-NLS-1$
|
||||||
|
buffer.append("typedef A<C<N,1>, C<N,1> > myType; \n"); //$NON-NLS-1$
|
||||||
|
buffer.append("void m(){ \n"); //$NON-NLS-1$
|
||||||
|
buffer.append(" myType t; \n"); //$NON-NLS-1$
|
||||||
|
buffer.append("} \n"); //$NON-NLS-1$
|
||||||
|
|
||||||
|
IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.CPP, true, true );
|
||||||
|
CPPNameCollector col = new CPPNameCollector();
|
||||||
|
tu.accept( col );
|
||||||
|
|
||||||
|
ITypedef myType = (ITypedef) col.getName(31).resolveBinding();
|
||||||
|
ICPPClassType A = (ICPPClassType) myType.getType();
|
||||||
|
|
||||||
|
ICPPSpecialization Aspec = (ICPPSpecialization) col.getName(10).resolveBinding();
|
||||||
|
|
||||||
|
assertTrue( A instanceof ICPPTemplateInstance );
|
||||||
|
assertSame( ((ICPPTemplateInstance)A).getTemplateDefinition(), Aspec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,6 @@ import org.eclipse.cdt.core.dom.ast.IASTNode;
|
||||||
import org.eclipse.cdt.core.dom.ast.IBinding;
|
import org.eclipse.cdt.core.dom.ast.IBinding;
|
||||||
import org.eclipse.cdt.core.dom.ast.IScope;
|
import org.eclipse.cdt.core.dom.ast.IScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateId;
|
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPScope;
|
||||||
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
|
import org.eclipse.cdt.core.dom.ast.cpp.ICPPUsingDeclaration;
|
||||||
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
import org.eclipse.cdt.core.parser.util.ArrayUtil;
|
||||||
|
@ -62,9 +61,6 @@ abstract public class CPPScope implements ICPPScope{
|
||||||
//name belongs to a different scope, don't add it here
|
//name belongs to a different scope, don't add it here
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if( name instanceof ICPPASTTemplateId )
|
|
||||||
name = ((ICPPASTTemplateId)name).getTemplateName();
|
|
||||||
|
|
||||||
char [] c = name.toCharArray();
|
char [] c = name.toCharArray();
|
||||||
Object o = bindings.get( c );
|
Object o = bindings.get( c );
|
||||||
if( o != null ){
|
if( o != null ){
|
||||||
|
|
Loading…
Add table
Reference in a new issue