This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: can't reinterpret_cast to/from the same type
- From: "Jonathan Wakely" <jwakely dot gcc at gmail dot com>
- To: "Peter A. Felvegi" <petschy at praire-chicken dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sat, 8 Sep 2007 17:51:39 +0100
- Subject: Re: can't reinterpret_cast to/from the same type
- References: <46E032CC.6020003@praire-chicken.com>
On 06/09/2007, Peter A. Felvegi <petschy@praire-chicken.com> wrote:
> i don't know if it's a bug, please clarify:
> int y = reinterpret_cast<int>(x);
> rc.cpp:4: error: invalid cast from type 'int' to type 'int'
5.2.10 in the C++ standard lists the conversions allowed by
reinterpret_cast. This is not one of the listed conversions, so GCC is
correct to give an error.
Regards,
Jon