From c1bbb62c953d7d2964958fd9a5d0e5dc93d0864d Mon Sep 17 00:00:00 2001 From: Andrew Niefer Date: Wed, 25 May 2005 18:16:22 +0000 Subject: [PATCH] tests for last commit: - types of conditional, new & delete expressions - handle typedefs in conversions for bug 96655 --- .../core/parser/tests/ast2/AST2CPPTests.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java index d48355b4de0..22e225f411e 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2CPPTests.java @@ -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() ); + } }