[Bug c++/51270] constness violation is accepted without any warning but leads to a required function call being eliminated during optimization

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Nov 22 16:11:00 GMT 2011


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |diagnostic

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-11-22 15:55:41 UTC ---
This variation is a bit closer to your original and doesn't get a warning:

int*& faulty_compiled_function(char*& val)
{
  char const* const& tmp = (const char*)val;
  return (int*&)tmp;
}

So maybe there is a missed warning bug.  Other compilers miss it too.



More information about the Gcc-bugs mailing list