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

Re: deprecated conversion from string constant to 'char *'

Here's a test-case for you.  Save the attached source file as
/tmp/test.cpp and run the following g++ invocation:

g++ -c -g -O0 -fno-strict-aliasing -Wall -W -Wno-format-y2k \
  -Wpointer-arith -Wwrite-strings -o /tmp/test.o /tmp/test.cpp

When I run this command against the attached file I get:

/tmp/test.cpp: In function ‘int do_test()’:
/tmp/test.cpp:14: warning: deprecated conversion from string constant to ‘char*’'

But if you look the argument IS a const, just through a typedef.
I'm using g++ 4.1.1-1 on FC5:

Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj- --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.1 20060525 (Red Hat 4.1.1-1)


Attachment: test.cpp
Description: test case showing erroneous warning

       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL:    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available

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