mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 09:46:02 +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:
parent
4dc6e1fdc6
commit
74962ae0c5
1 changed files with 16 additions and 0 deletions
|
@ -3278,4 +3278,20 @@ public class AST2Tests extends AST2BaseTest {
|
||||||
public void testBug80171() throws Exception {
|
public void testBug80171() throws Exception {
|
||||||
parseAndCheckBindings( "static var;"); //$NON-NLS-1$
|
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() );
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Add table
Reference in a new issue