https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123134

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
http://eel.is/c++draft/conv.ptr#1 talks just about integer literals.
null_ptr_cst_p (tree t)
uses for C++11 and above
      STRIP_ANY_LOCATION_WRAPPER (t);

      /* Core issue 903 says only literal 0 is a null pointer constant.  */
      if (TREE_CODE (t) == INTEGER_CST
          && !TREE_OVERFLOW (t)
          && TREE_CODE (type) == INTEGER_TYPE
          && integer_zerop (t)
          && !char_type_p (type))
        return true;
and so is happy about any zero values INTEGER_CST, which includes both 0UL
(correctly) and (unsigned long)0 or (unsigned long)0UL (incorrectly).

Reply via email to