1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 16:56:04 +02:00

Fixed Bug 79067 Parser error: Invalid arithmetic conversion when using enum instance in arithmetic expression

Committed test case.
This commit is contained in:
John Camelon 2005-07-12 19:47:58 +00:00
parent 4dc6e1fdc6
commit 74962ae0c5

View file

@ -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() );
}
}