[cfe-dev] mixed types with BO_Sh[rl]

Roman Divacky rdivacky at freebsd.org
Thu Jan 27 03:19:40 PST 2011


hi,

in a simple expression like:

  unsigned int _x;

  return (_x >> 30);

the BinaryOperator is formed like this:

(BinaryOperator 0x8018dc1a0 'unsigned int' '>>'
  (DeclRefExpr 0x8018dc140 'unsigned int' lvalue Var='_x' 0x80188ff70)
  (IntegerLiteral 0x8018dc170 'int' 30))

note the mixed operands with 'unsigned int' and 'int' types.

Is this by design or by mistake? I guess there should be IntegralCast
for the 'int' 30, right? This happens only for Shr/Shl operators,
all others have the IntegralCast I would expect here.

thank you, roman



More information about the cfe-dev mailing list