This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/14211] New: missing lvalue check ?
- From: "d dot binderman at virgin dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 Feb 2004 15:06:45 -0000
- Subject: [Bug c++/14211] New: missing lvalue check ?
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
// 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