From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrey Slepuhin To: gcc@gcc.gnu.org Subject: Re: [gcc-3.0 bug?] C++ symbols treated as C Date: Tue, 24 Apr 2001 03:29:00 -0000 Message-id: <20010424142909.B1853@glade.nmd.msu.ru> References: <20010423093415.H4326@glade.nmd.msu.ru> X-SW-Source: 2001-04/msg01110.html On Mon, Apr 23, 2001 at 09:34:15AM +0400, Andrey Slepuhin wrote: > Hi, > > Trying to upgrade from 20010311 to 20010419 gcc snapshot > (taken from CodeSourcery) I got undefined references > when linking my C++ code. Looking into assembler output I see the > things like following: [snip] Ok, I found a test case which localizes a problem. Compiling the following program with 20010422 snapshot: ------------------------------------------------------- #include namespace A { int abcdef; template class X { public: inline X () { extern int abcdef; printf("%d\n", abcdef); } }; } using namespace A; int main (int argc, char* argv[]) { X x; return 0; } ------------------------------------------------------------ I got the following error: /tmp/ccWmhmdS.o: In function `A::X::X()': /tmp/ccWmhmdS.o(.gnu.linkonce.t._ZN1A1XIiEC1Ev+0xb): undefined reference to `abcdef' collect2: ld returned 1 exit status Assembler output shows that "extern int abcdef;" is not considered as a member of namespace A. 20010311 snapshot compiles this program without errors. Making X non-template class also removes errors. Regards, Andrey. -- A right thing should be simple (tm)