From 74962ae0c594b09abd2f2b86e04285ee80d4ed35 Mon Sep 17 00:00:00 2001 From: John Camelon Date: Tue, 12 Jul 2005 19:47:58 +0000 Subject: [PATCH] Fixed Bug 79067 Parser error: Invalid arithmetic conversion when using enum instance in arithmetic expression Committed test case. --- .../cdt/core/parser/tests/ast2/AST2Tests.java | 16 ++++++++++++++++ 1 file changed, 16 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 99e2454f652..f3d904d8483 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 @@ -3278,4 +3278,20 @@ public class AST2Tests extends AST2BaseTest { public void testBug80171() throws Exception { parseAndCheckBindings( "static var;"); //$NON-NLS-1$ } + + public void testBug79067() throws Exception { + StringBuffer buffer = new StringBuffer("enum E_OPTIONCODE {\n" ); //$NON-NLS-1$ + buffer.append(" red = 1,\n" ); //$NON-NLS-1$ + buffer.append("black = 2,\n" ); //$NON-NLS-1$ + buffer.append("};\n" ); //$NON-NLS-1$ + buffer.append("void arithConversionTest(enum E_OPTIONCODE eOption)\n" ); //$NON-NLS-1$ + buffer.append("{\n" ); //$NON-NLS-1$ + buffer.append("int myColor = 5;\n" ); //$NON-NLS-1$ + buffer.append("int temp = eOption - myColor; /* Syntax error */\n" ); //$NON-NLS-1$ + buffer.append("if(eOption-myColor) /* Invalid arithmetic conversion */\n" ); //$NON-NLS-1$ + buffer.append("{\n" ); //$NON-NLS-1$ + buffer.append("}\n" ); //$NON-NLS-1$ + buffer.append("}\n" ); //$NON-NLS-1$ + parseAndCheckBindings( buffer.toString() ); + } } \ No newline at end of file