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

tests for last commit:

- types of conditional, new & delete expressions
- handle typedefs in conversions for bug 96655
This commit is contained in:
Andrew Niefer 2005-05-25 18:16:22 +00:00
parent 353cad011a
commit c1bbb62c95

View file

@ -4452,4 +4452,36 @@ public class AST2CPPTests extends AST2BaseTest {
tu.accept(col);
assertNoProblemBindings( col );
}
public void testBug96655() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append("void copy( void * ); \n"); //$NON-NLS-1$
buffer.append("typedef struct {} A; \n"); //$NON-NLS-1$
buffer.append("void f( A * a ) { \n"); //$NON-NLS-1$
buffer.append(" copy( a ); \n"); //$NON-NLS-1$
buffer.append("} \n"); //$NON-NLS-1$
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.CPP );
CPPNameCollector col = new CPPNameCollector();
tu.accept(col);
ICPPFunction copy = (ICPPFunction) col.getName(0).resolveBinding();
assertSame( copy, col.getName(7).resolveBinding() );
}
public void testNewExpressionType() throws Exception {
StringBuffer buffer = new StringBuffer();
buffer.append("struct A {}; \n"); //$NON-NLS-1$
buffer.append("void copy( A * ); \n"); //$NON-NLS-1$
buffer.append("void f( ) { \n"); //$NON-NLS-1$
buffer.append(" copy( new A() ); \n"); //$NON-NLS-1$
buffer.append("} \n"); //$NON-NLS-1$
IASTTranslationUnit tu = parse( buffer.toString(), ParserLanguage.CPP );
CPPNameCollector col = new CPPNameCollector();
tu.accept(col);
ICPPFunction copy = (ICPPFunction) col.getName(1).resolveBinding();
assertSame( copy, col.getName(5).resolveBinding() );
}
}