Hello.
We have a question related to ImplicitCastExpr nodes.
Consider the following program:
void* foo(char c) {
return (void*) c;
}
When fed to clang, we obtain the following AST:
void *foo(char c) (CompoundStmt 0x2a0bb90 <bug.c:1:19, line:3:1>
(ReturnStmt 0x2a0de10 <line:2:3, col:18>
(CStyleCastExpr 0x2a0c8c0 <col:10, col:18> 'void *'
(ImplicitCastExpr 0x2a094b0 <col:18> 'int'
(DeclRefExpr 0x2a09470 <col:18> 'char' ParmVar='c' 0x2a0dd70)))))
Namely, the use of the char 'c' is first implicitly converted to 'int' and then immediately cast to 'void*'. We guess that the ImplicitCastExpr node was added to model the integer promotion of the c-style cast operator.
However, according to our understanding of the C99 standard, the operator of a C-style cast expression is not subject to promotions.
Footnote 48 to C99 6.3.1.1p2 (page 43) says: