[Bug c++/61543] static_cast<void *>(static_cast<int>(enum_value)) doesn't get an error

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Aug 5 03:27:19 GMT 2021


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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |9.0
      Known to work|                            |9.1.0
         Resolution|---                         |FIXED

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC 8+ rejects the first "// accepted" in the reduced testcase.
GCC 9+ rejects both.

Note both are only with C++11 standard (or greater).

Because in C++98 the constant expression which evulates to 0 is considered a
null pointer :).


More information about the Gcc-bugs mailing list