[cfe-dev] Nested implicit casts?

Sebastian Redl sebastian.redl at getdesigned.at
Mon Jan 11 12:18:17 CST 2010


Enea Zaffanella wrote:
> Hello.
>
> Dumping the AST for the following program:
>
> int f(signed char v) { return v < 1U; }
>
> we obtain an implicit cast expression that (immediately) contains 
> another implicit cast expression:
>
> int f(signed char v) (CompoundStmt 0x174c530 <test.c:1:22, col:39>
>    (ReturnStmt 0x174c510 <col:24, col:35>
>      (BinaryOperator 0x174c4d0 <col:31, col:35> 'int' '<'
>        (ImplicitCastExpr 0x174c4a0 <col:31> 'unsigned int' <Unknown>
>          (ImplicitCastExpr 0x174c470 <col:31> 'int' <IntegralCast>
>            (DeclRefExpr 0x174c3f8 <col:31> 'signed char' ParmVar='v' 
> 0x174c2c0)))
>        (IntegerLiteral 0x174c430 <col:35> 'unsigned int' 1))))
>
>
> Is that meant to be OK?
>   
No, unknown casts should never appear in the AST in the first place;
they're a transitional construct.

Sebastian


More information about the cfe-dev mailing list