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.