[Bug c++/14211] New: missing lvalue check ?
d dot binderman at virgin dot net
gcc-bugzilla@gcc.gnu.org
Thu Feb 19 15:06:00 GMT 2004
// Given the following C++ code
void f( char * str)
{
char * & m = const_cast<char *>( str);
}
/*
then g++ 332 says not a lot.
[dcb@localhost src]$ ~/gnu/gcc332/results/bin/g++ -c -g -O2 -Wall -ansi
-pedantic cc.cc
cc.cc: In function `void f(char*)':
cc.cc:7: warning: unused variable `char*&m'
[dcb@localhost src]$
But Intel C++ 8.0 says
[dcb@localhost src]$ icc cc.cc
cc.cc(7): error: initial value of reference to non-const must be an lvalue
char * & m = const_cast<char *>( str);
^
compilation aborted for cc.cc (code 2)
[dcb@localhost src]$
One compiler must be wrong.
*/
--
Summary: missing lvalue check ?
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: d dot binderman at virgin dot net
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: linux/i386
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14211
More information about the Gcc-bugs
mailing list