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++/15773] New: Error, if compiled with -O3 (gettext method name)


#include <string>
#include <iostream>

class foo
{
   std::string s;
   public:
     foo (const char *a) : s(a) {}

     std::string gettext (void) { return s; }
};

int main (int argc, char **argv)
{
   foo f("test");
   std::string a;

   a=f.gettext();

   std::cout << "Test: " << a << std::endl;

   return 0;
}

Compiled and linked with:
g++ -o t1 t1.cxx
./t1
Test: test

And now with -O3:
g++ -O3 -o t1 t1.cxx
t1.cxx:11: error: parse error before `,' token
t1.cxx:11: error: variable declaration is not allowed here
t1.cxx:11: error: syntax error before `{' token
t1.cxx:12: error: parse error before `}' token
t1.cxx: In function `int main(int, char**)':
t1.cxx:19: error: parse error before `,' token
t1.cxx:19: error: `dcgettext' undeclared (first use this function)
t1.cxx:19: error: (Each undeclared identifier is reported only once for
each
  function it appears in.)

g++ -v
Reading specs from /usr/lib/gcc-lib/i486-linux/3.3.3/specs
Configured with: ../src/configure -v
--enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared
--with-system-zlib --enable-nls --without-included-gettext
--enable-__cxa_atexit --enable-clocale=gnu --enable-debug
--enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
Thread model: posix
gcc version 3.3.3 (Debian 20040401)

And now the old compiler 2.95:
g++-2.95 -O3 -o t1 t1.cxx
./t1
Test: test

g++-2.95 -v
Reading specs from /usr/lib/gcc-lib/i386-linux/2.95.4/specs
gcc version 2.95.4 20011002 (Debian prerelease)

-- 
           Summary: Error, if compiled with -O3 (gettext method name)
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: herbert at linuxhacker dot at
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15773


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