[cfe-dev] Missing implicit cast inside CXXFunctionalCastExpr node.

Eli Friedman eli.friedman at gmail.com
Fri Sep 2 10:42:19 PDT 2011


On Fri, Sep 2, 2011 at 9:03 AM, Enea Zaffanella <zaffanella at cs.unipr.it> wrote:
> Hello.
>
> It looks like clang++ forgets the addition of implicit casts when
> applying functional casts having an enum type as target type:
>
> $ cat enum.cc
> enum E { a };
>
> void foo(void) {
>  E(1U);
>  E(1.9);
> }
>
> $ clang++ -cc1 -ast-dump enum.cc
> [...]
> void foo() (CompoundStmt 0x4a0b0f8 <enum.cc:3:16, line:6:1>
>  (CXXFunctionalCastExpr 0x4a0b070 <line:4:3, col:6> 'enum E' functional
> cast to enum E
>    (IntegerLiteral 0x4a0b048 <col:5> 'int' 1))
>  (CXXFunctionalCastExpr 0x4a0b0d0 <line:5:3, col:8> 'enum E' functional
> cast to enum E
>    (FloatingLiteral 0x4a0b0a8 <col:5> 'double' 1.900000e+00)))
>
>
> As far as I recall, CXXFunctionalCastExpr is just a syntactic wrapper
> and the semantics of the cast (eventually CK_NoOp) has to be found in an
> embedded ImplicitCastExpr node.

CXXFunctionalCastExpr can have a cast kind... it should be visible
with -ast-dump (and correct) with r139011.

-Eli




More information about the cfe-dev mailing list