Just emit e != nullptr for these.
Differential Revision: https://reviews.llvm.org/D148981
return this->emitCast(*FromT, *ToT, CE);
}
+ case CK_PointerToBoolean: {
+ // Just emit p != nullptr for this.
+ if (!this->visit(SubExpr))
+ return false;
+
+ if (!this->emitNullPtr(CE))
+ return false;
+
+ return this->emitNEPtr(CE);
+ }
+
case CK_ToVoid:
return discard(SubExpr);
}
static_assert(gimme(5) == 5, "");
+namespace PointerToBool {
+
+ constexpr void *N = nullptr;
+ constexpr bool B = N;
+ static_assert(!B, "");
+ static_assert(!N, "");
+
+ constexpr float F = 1.0;
+ constexpr const float *FP = &F;
+ static_assert(FP, "");
+ static_assert(!!FP, "");
+}
+
namespace SizeOf {
constexpr int soint = sizeof(int);
constexpr int souint = sizeof(unsigned int);