return Success(E->getOpcode() == BO_EQ ? Equal : !Equal, E);
}
+ if (LHSTy->isNullPtrType()) {
+ assert(E->isComparisonOp() && "unexpected nullptr operation");
+ assert(RHSTy->isNullPtrType() && "missing pointer conversion");
+ // C++11 [expr.rel]p4, [expr.eq]p3: If two operands of type std::nullptr_t
+ // are compared, the result is true of the operator is <=, >= or ==, and
+ // false otherwise.
+ BinaryOperator::Opcode Opcode = E->getOpcode();
+ return Success(Opcode == BO_EQ || Opcode == BO_LE || Opcode == BO_GE, E);
+ }
+
if (!LHSTy->isIntegralOrEnumerationType() ||
!RHSTy->isIntegralOrEnumerationType()) {
// We can't continue from here for non-integral types.
int array1[__is_pod(nullptr_t)? 1 : -1];
int array2[sizeof(nullptr_t) == sizeof(void*)? 1 : -1];
-// FIXME: when we implement constexpr, this will be testable.
-#if 0
int relational0[nullptr < nullptr? -1 : 1];
int relational1[nullptr > nullptr? -1 : 1];
int relational2[nullptr <= nullptr? 1 : -1];
int relational3[nullptr >= nullptr? 1 : -1];
int equality[nullptr == nullptr? 1 : -1];
int inequality[nullptr != nullptr? -1 : 1];
-#endif
+
+int relational0_a[0 < nullptr? -1 : 1];
+int relational1_a[0 > nullptr? -1 : 1];
+int relational2_a[0 <= nullptr? 1 : -1];
+int relational3_a[0 >= nullptr? 1 : -1];
+int equality_a[0 == nullptr? 1 : -1];
+int inequality_a[0 != nullptr? -1 : 1];
+
+int relationalnullptr_b[nullptr < 0? -1 : 1];
+int relational1_b[nullptr > 0? -1 : 1];
+int relational2_b[nullptr <= 0? 1 : -1];
+int relational3_b[nullptr >= 0? 1 : -1];
+int equality_b[nullptr == 0? 1 : -1];
+int inequality_b[nullptr != 0? -1 : 1];
namespace overloading {
int &f1(int*);