llvm::BasicBlock *FalseBlock) {
if (const ParenExpr *PE = dyn_cast<ParenExpr>(Cond))
return EmitBranchOnBoolExpr(PE->getSubExpr(), TrueBlock, FalseBlock);
+ if (const CastExpr *E = dyn_cast<CastExpr>(Cond))
+ if (E->getCastKind() == CastExpr::CK_UserDefinedConversion) {
+ if (const CXXFunctionalCastExpr *CXXFExpr =
+ dyn_cast<CXXFunctionalCastExpr>(E)) {
+ EmitCXXFunctionalCastExpr(CXXFExpr);
+ return;
+ }
+ else if (isa<CStyleCastExpr>(E))
+ return EmitBranchOnBoolExpr(E->getSubExpr(), TrueBlock, FalseBlock);
+ assert(false && "EmitBranchOnBoolExpr - Expected CStyleCastExpr");
+ }
if (const BinaryOperator *CondBOp = dyn_cast<BinaryOperator>(Cond)) {
// Handle X && Y in a condition.
Y y;
+int count=0;
+class O { // ...
+public:
+ operator int(){ return ++iO; }
+ O() : iO(count++) {}
+ int iO;
+};
+
+void g(O a, O b)
+{
+ int i = (a) ? 1+a : 0;
+ int j = (a&&b) ? a+b : i;
+ if (a) { }
+ printf("i = %d j = %d a.iO = %d b.iO = %d\n", i, j, a.iO, b.iO);
+}
+
int main() {
int c = X(Z(y)); // OK: y.operator Z().operator X().operator int()
printf("c = %d\n", c);
int e = (int)((X)((Z)y));
printf("e = %d\n", e);
+ O o1, o2;
+ g(o1, o2);
}
// CHECK-LP64: .globl __ZN1ScviEv
// CHECK-LP64-NEXT: __ZN1ScviEv: