1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

fix bug 95714

This commit is contained in:
Andrew Niefer 2005-05-19 18:59:20 +00:00
parent a5843c1e7e
commit 68e0514086
2 changed files with 20 additions and 1 deletions

View file

@ -4355,4 +4355,23 @@ public class AST2CPPTests extends AST2BaseTest {
IASTDeclarator d = ((IASTSimpleDeclaration)ds.getDeclaration()).getDeclarators()[0];
assertTrue( d.getName().resolveBinding() instanceof IVariable );
}
public void testBug95714() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append("typedef struct xs { \n"); //$NON-NLS-1$
buffer.append(" int state; \n"); //$NON-NLS-1$
buffer.append("} xs; \n"); //$NON-NLS-1$
buffer.append("void f( xs *ci ) { \n"); //$NON-NLS-1$
buffer.append(" ci->state; \n"); //$NON-NLS-1$
buffer.append(" (ci - 1)->state; \n"); //$NON-NLS-1$
buffer.append("} \n"); //$NON-NLS-1$
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.CPP );
CPPNameCollector col = new CPPNameCollector();
tu.accept(col);
ICPPField state = (ICPPField) col.getName(1).resolveBinding();
assertSame( state, col.getName(7).resolveBinding() );
assertSame( state, col.getName(9).resolveBinding() );
}
}

View file

@ -1691,7 +1691,7 @@ public class CPPSemantics {
((ICPPSpecialization)temp).getSpecializedBinding() == type )
{
//ok, stay with the template, the specialization, if applicable, will come out during instantiation
} else if( type != temp ) {
} else if( type != temp && !((IType)type).isSameType( (IType) temp )) {
return new ProblemBinding( data.astName, IProblemBinding.SEMANTIC_AMBIGUOUS_LOOKUP, data.name );
}
} else if( temp instanceof IFunction ){