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

Enea Zaffanella zaffanella at cs.unipr.it
Fri Sep 2 09:03:55 PDT 2011


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.

Regards,
Enea.



More information about the cfe-dev mailing list