Bug 270430 - Incorrect binary expression created for IASTCaseStatement with GNU ellipsis operator
Summary: Incorrect binary expression created for IASTCaseStatement with GNU ellipsis o...
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-parser (show other bugs)
Version: 5.0.2   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 6.0   Edit
Assignee: Markus Schorn CLA
QA Contact: Mike Kucera CLA
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2009-03-30 06:31 EDT by Tom Longridge CLA
Modified: 2009-04-01 07:56 EDT (History)
1 user (show)

See Also:


Attachments
Patch so op_ellipses is used for GNU case range expression (6.55 KB, patch)
2009-03-30 07:23 EDT, Richard Miskin CLA
mschorn.eclipse: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Longridge CLA 2009-03-30 06:31:52 EDT
The IASTBinaryExpression created for an IASTCaseStatement which uses the GNU ellipsis operator is incorrectly set with the op_assign operator rather than op_ellipses.

e.g.

switch (a) {
  case 1 ... 3:  <-- An IASTBinaryExpression is created under the
                     IASTCaseStatement, but the operator is op_assign.
     break;
}

(Also, is there a reason why the ellipsis operator is called "op_ellipses" and not "op_ellipsis"?)
Comment 1 Richard Miskin CLA 2009-03-30 07:23:36 EDT
Created attachment 130225 [details]
Patch so op_ellipses is used for GNU case range expression
Comment 2 Richard Miskin CLA 2009-03-30 07:33:19 EDT
The patch I've just added modifies AbstractGNUSourceCodeParser so the correct operator is set.

I modified AST2Tests.testCaseRange_Bug211882() so that this test checks the operator.

I also modified ExpressionWriter and added a test to ASTWriterStatementTestSource.awts. Previously the case statement was being rewritten as:
switch (a) {
  case 1 = 3:
     break;
}


And, finally, I've changed ASTWriterDeclaratorTestSource.awts because the test was failing due to white space. I think my change is valid, but should probably be checked.
Comment 3 Markus Schorn CLA 2009-04-01 07:56:51 EDT
Thanks Richard,
fixed in 6.0 > 20090401.