This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
can't reinterpret_cast to/from the same type
- From: "Peter A. Felvegi" <petschy at praire-chicken dot com>
- To: gcc at gcc dot gnu dot org
- Date: Thu, 06 Sep 2007 19:03:08 +0200
- Subject: can't reinterpret_cast to/from the same type
hello,
i don't know if it's a bug, please clarify:
rc.cpp:
------8<------
void f()
{
int x = 0;
int y = reinterpret_cast<int>(x);
}
------8<------
gcc -v:
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v
--enable-languages=c,c++,fortran,objc,obj-c++,treelang --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --enable-mpfr --with-tune=i686
--enable-checking=release i486-linux-gnu
Thread model: posix
gcc version 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)
gcc -c rc.cpp:
rc.cpp: In function âvoid f()â:
rc.cpp:4: error: invalid cast from type âintâ to type âintâ
i suspected that one could cast from int to int.
google hasn't found any relevant pages for 'gcc reinterpret cast bug'
regards, peter