This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
cpp bug with 3.2(now 3.3), 3.1.1 and 2.96
- From: "Nitin Gupta, Noida" <niting at noida dot hcltech dot com>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 2 Aug 2002 15:07:43 +0530
- Subject: cpp bug with 3.2(now 3.3), 3.1.1 and 2.96
Hi,
The following test program does not link when
g++ [3.2 20020722 (experimental)] is invoked with
default options. The test case compiles successfully
when -O2 option is used. The same behavior is shown
by g++ version 2.96 20000731 (Red Hat Linux 7.3 2.96-110)
and g++ 3.1. However the SUN native compiler builds it
with default options too.
With g++ 3.2 20020722 (experimental) and g++ 3..1.1 I'm
using binutils 1.12
The test program
#include<iostream.h>
namespace nm
{
int i = 15 ;
int j ;
class c
{
public:
int k ;
int funct()
{
return 10 ;
} ;
} ;
extern c dc ;
int funct1()
{
int tempi = 0 ;
tempi = dc.funct() ;
return tempi ;
}
}
nm::c dc ;
int
main()
{
int ni,nj ;
ni = dc.funct() ;
cout << ni ;
nj = nm::funct1() ;
cout << endl << nj ;
}
Regards.
Nitin.
PS : The commands I'm giving:
$ i686-pc-linux-gnu-g++ --verbose
Reading specs from
/home2/i386/tools/bin/../lib/gcc-lib/i686-pc-linux-gnu/3.2/specs
Configured with: /home/niting/gcc3_2/gcc/configure
--prefix=/home/niting/gcc3_2/i386/tools/
--enable-languages=c,c++ --with-gnu-ld --with-gnu-as
Thread model: single
gcc version 3.2 20020722 (experimental)
$ i686-pc-linux-gnu-g++ test.cc
In file included from
/home2/i386/tools/include/c++/3.2/backward/iostream.h:31,
from test.cc:10:
/home2/i386/tools/include/c++/3.2/backward/backward_warning.h:32:2: warning:
#warning This file includes at least one deprecated or
antiquated header.
Please consider using one of the 32 headers found in section
17.4.1.2
of the C++ standard. Examples include substituting the <X>
header for the <X.h>
header for C++ includes, or <sstream> instead of the
deprecated header <strstream.h>.
To disable this warning use -Wno-deprecated.
/tmp/ccp2xw1m.o: In function `nm::funct1()':
/tmp/ccp2xw1m.o(.text+0x10): undefined reference to `nm::dc'
collect2: ld returned 1 exit status
With -O2 success:
$ i686-pc-linux-gnu-g++ -O2 test.cc
In file included from
/home2/i386/tools/include/c++/3.2/backward/iostream.h:31,
from test.cc:10:
/home2/i386/tools/include/c++/3.2/backward/backward_warning.h:32:2: warning:
#warning This file includes at least one deprecated or
antiquated header.
Please consider using one of the 32 headers found in section
17.4.1.2 of the C++ standard. Examples include substituting
the <X> header for the
<X.h> header for C++ includes, or <sstream> instead of the
deprecated header
<strstream.h>. To disable this warning use -Wno-deprecated.
$