This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: can't reinterpret_cast to/from the same type


On Sat, Sep 08, 2007 at 05:51:39PM +0100, Jonathan Wakely wrote:
> 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.

It still seems odd, and this restriction could make the coding of
templates more complex.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]