[Bug c++/25525] 'const' modifier is ignored in static_cast specifier

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Dec 21 22:54:00 GMT 2005



------- Comment #1 from pinskia at gcc dot gnu dot org  2005-12-21 22:54 -------
GCC is correct:
const PTR mycast(const A *a) {
  return (static_cast<const PTR>(a));


a is a pointer to a const A.  While the cast you are trying to use is a
constant pointer to B.  And that is invalid C++ to use static_cast to remove a
const.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25525



More information about the Gcc-bugs mailing list