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]
Other format: [Raw text]

[Bug c++/14211] New: missing lvalue check ?


// 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


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