namespace std {
class nullptr_t {
public:
// Required in order to create const nullptr_t objects without an
// explicit initializer in GCC 4.5, a la:
//
// const std::nullptr_t nullptr;
nullptr_t() { }
// Make nullptr convertible to any pointer type.
template<typename T> operator T*() const { return 0; }
// Make nullptr convertible to any member pointer type.
template<typename C, typename T> operator T C::*() { return 0; }
private:
// Do not allow taking the address of nullptr.
void operator&();
};
}
const std::nullptr_t nullptr;
int main(int argc, char** argv)
{
const char* case1 = nullptr; // working
unsigned* case4 = argc > 1 ? nullptr : nullptr; //works
unsigned* case5 = argc > 2 ? (unsigned*)0 : nullptr; //not working. (It is the major issue as of now)
unsigned* case6 = nullptr;
return 0;
}
bmFtZXNwYWNlIHN0ZCB7CmNsYXNzIG51bGxwdHJfdCB7CnB1YmxpYzoKICAgIC8vIFJlcXVpcmVkIGluIG9yZGVyIHRvIGNyZWF0ZSBjb25zdCBudWxscHRyX3Qgb2JqZWN0cyB3aXRob3V0IGFuCiAgICAvLyBleHBsaWNpdCBpbml0aWFsaXplciBpbiBHQ0MgNC41LCBhIGxhOgogICAgLy8KICAgIC8vIGNvbnN0IHN0ZDo6bnVsbHB0cl90IG51bGxwdHI7CiAgICBudWxscHRyX3QoKSB7IH0KCiAgICAvLyBNYWtlIG51bGxwdHIgY29udmVydGlibGUgdG8gYW55IHBvaW50ZXIgdHlwZS4KICAgIHRlbXBsYXRlPHR5cGVuYW1lIFQ+IG9wZXJhdG9yIFQqKCkgY29uc3QgeyByZXR1cm4gMDsgfQogICAgLy8gTWFrZSBudWxscHRyIGNvbnZlcnRpYmxlIHRvIGFueSBtZW1iZXIgcG9pbnRlciB0eXBlLgogICAgdGVtcGxhdGU8dHlwZW5hbWUgQywgdHlwZW5hbWUgVD4gb3BlcmF0b3IgVCBDOjoqKCkgeyByZXR1cm4gMDsgfQpwcml2YXRlOgogICAgLy8gRG8gbm90IGFsbG93IHRha2luZyB0aGUgYWRkcmVzcyBvZiBudWxscHRyLgogICAgdm9pZCBvcGVyYXRvciYoKTsKfTs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