From c058c352321738e41d2cb9cb6a5f367aa23d0088 Mon Sep 17 00:00:00 2001 From: Andrew Niefer Date: Thu, 21 Jul 2005 14:43:46 +0000 Subject: [PATCH] testing bug 104390 --- .../cdt/core/parser/tests/ast2/AST2Tests.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java index 9bcfa335a70..66348f75327 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/core/parser/tests/ast2/AST2Tests.java @@ -3336,4 +3336,23 @@ public class AST2Tests extends AST2BaseTest { IASTExpressionStatement es = (IASTExpressionStatement) labelStmt.getNestedStatement(); assertTrue( es.getExpression() instanceof IASTUnaryExpression ); } + + public void testBug104390_2() throws Exception { + StringBuffer buffer = new StringBuffer(); + buffer.append("void f() { \n"); //$NON-NLS-1$ + buffer.append(" int x; \n"); //$NON-NLS-1$ + buffer.append(" for( int x; ; ) \n"); //$NON-NLS-1$ + buffer.append(" blah: x; \n"); //$NON-NLS-1$ + buffer.append("} \n"); //$NON-NLS-1$ + + IASTTranslationUnit tu = parse(buffer.toString(), ParserLanguage.C, true); + CNameCollector col = new CNameCollector(); + tu.accept(col); + + IVariable x = (IVariable) col.getName(1).resolveBinding(); + IVariable x2 = (IVariable) col.getName(2).resolveBinding(); + assertNotSame( x, x2 ); + assertSame( x2, col.getName(4).resolveBinding() ); + assertTrue( col.getName(3).resolveBinding() instanceof ILabel ); + } } \ No newline at end of file