From eb5caf452eaa7b30f3985347c8cf13ee06ee3550 Mon Sep 17 00:00:00 2001 From: Markus Schorn Date: Fri, 16 Jan 2009 15:21:11 +0000 Subject: [PATCH] Testcase for bug 261043. --- .../cdt/core/parser/tests/ast2/AST2Tests.java | 15 +++++++++++++++ 1 file changed, 15 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 8760d3dcfae..cbcd3b12ba7 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 @@ -5879,4 +5879,19 @@ public class AST2Tests extends AST2BaseTest { parseAndCheckBindings(code, ParserLanguage.C, true); parseAndCheckBindings(code, ParserLanguage.CPP, true); } + + // void test() { + // int a,b; + // if ((a)+b); + // } + public void testAmbiguityResolutionInIfCondition_Bug261043() throws Exception { + final String code= getAboveComment(); + for (ParserLanguage lang : ParserLanguage.values()) { + IASTTranslationUnit tu= parseAndCheckBindings(code, lang, true); + IASTFunctionDefinition fdef= getDeclaration(tu, 0); + IASTIfStatement ifstmt= getStatement(fdef, 1); + IASTExpression expr= ifstmt.getConditionExpression(); + assertInstance(expr, IASTBinaryExpression.class); + } + } }