fork(1) download
  1. namespace std {
  2. class nullptr_t {
  3. public:
  4. // Required in order to create const nullptr_t objects without an
  5. // explicit initializer in GCC 4.5, a la:
  6. //
  7. // const std::nullptr_t nullptr;
  8. nullptr_t() { }
  9.  
  10. // Make nullptr convertible to any pointer type.
  11. template<typename T> operator T*() const { return 0; }
  12. // Make nullptr convertible to any member pointer type.
  13. template<typename C, typename T> operator T C::*() { return 0; }
  14. private:
  15. // Do not allow taking the address of nullptr.
  16. void operator&();
  17. };
  18. }
  19.  
  20. const std::nullptr_t nullptr;
  21.  
  22. int main(int argc, char** argv)
  23. {
  24. const char* case1 = nullptr; // working
  25. unsigned* case4 = argc > 1 ? nullptr : nullptr; //works
  26. unsigned* case5 = argc > 2 ? (unsigned*)0 : nullptr; //not working. (It is the major issue as of now)
  27. unsigned* case6 = nullptr;
  28.  
  29. return 0;
  30. }
Success #stdin #stdout 0s 2724KB
stdin
Standard input is empty
stdout
Standard output is empty