Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 100641

Summary: Binary bitwise & expression parsed as Cast Expression
Product: [Tools] CDT Reporter: Andrew Niefer <aniefer>
Component: cdt-parserAssignee: Project Inbox <cdt-core-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 3.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Andrew Niefer CLA 2005-06-17 14:50:48 EDT
void isTrue( int field, int bit ){
   return ( (field) & (bit) );
}

The (field) & (bit) is being parsed as a cast expression instead of as a binary
expression.

This was found in the DOTL project (http://sourceforge.net/projects/dotl/) where
it takes the form of a macro 
#define IS_SET(flag,bit)  ((flag) & (bit))
Comment 1 John Camelon CLA 2005-06-20 10:56:29 EDT
This is an ambiguity. 
If field was a type rather than an parm passed in, it could even be valid.
Comment 2 Doug Schaefer CLA 2007-08-21 10:59:49 EDT
Future means you commit to fix it in the Future. Inboxes can't make committments. Moving to '--'.
Comment 3 Markus Schorn CLA 2008-02-13 08:36:48 EST
Created testcase AST2Tests.testBug100641_106279_castAmbiguity().
Fixed with bug 168924.

*** This bug has been marked as a duplicate of bug 168924 ***