1
0
Fork 0
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:
Andrew Niefer 2005-11-10 23:47:33 +00:00
parent f1fa62b185
commit 416f05ffe1
2 changed files with 25 additions and 4 deletions

View file

@ -1899,4 +1899,29 @@ public class AST2TemplateTests extends AST2BaseTest {
ICPPMethod f = (ICPPMethod) col.getName(8).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);
}
}

View file

@ -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.IScope;
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.ICPPUsingDeclaration;
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
return;
}
if( name instanceof ICPPASTTemplateId )
name = ((ICPPASTTemplateId)name).getTemplateName();
char [] c = name.toCharArray();
Object o = bindings.get( c );
if( o != null ){