This is the mail archive of the gcc-bugs@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]

bugreport(egcs19990502):static_cast casting away const


static_cast casts away const from const void*,
but to my knowlede const void* is not special:
The error is not detected for any target pointer type not just int* !
------------bug.cpp-------------
int main() {
	const int i=10;
	const void* a=&i;
	int* p=static_cast<int*>(a); //bug:casting away const not detected
	return 0;
}
--------------------------------
.)environment:
%uname -a
Linux pc 2.2.5 #3 Sat May 8 09:27:54 MEST 1999 i686 unknown
%g++ -v
Reading specs from
/home/am/gcc/egcs_current/usr/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.93.21/specs
gcc version egcs-2.93.21 19990502 (gcc2 ss-980929 experimental)
.)build: (from memory)
%home/am/gcc/egcs_current/egcs-19990502/configure \
--prefix=/home/am/gcc/egcs_current/usr \
--enable-shared --with-gnu-as --with-gnu-ld
%make bootstrap
%make install
.)compile:
%g++ bug.cpp
.)notes:
same with egcs1.1.2

Alfred


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