Article View: gnu.gcc.bug
Article #155gcc 2.1
From: Norbert Hoelken
Date: Mon, 06 Apr 1992 20:08
Date: Mon, 06 Apr 1992 20:08
50 lines
1447 bytes
1447 bytes
I just received version 2.1 of GNU CC, but there seems to be a bug with static
data members in C++.
I installed gcc 2.1 on a Sun4/75 running SunOS 4.1.1 using 'configure sparc'.
Using this compiler i installed libg++ 2.0.
The following program was compiled without any options (only saying
g++ <name>.cc) and produced the linker error
undefined reference to `__4test$Global_Value'
I tried all combinations of GNU as/ld and systems as/ld with the same result.
The error disappeares when i try to initialize the static member Global_Value
(commented out in the example).
The program works fine with an old release of g++ (g++ 1.37.1).
--- example -----
#include <stream.h>
class test
{
public:
test();
~test() {}
static int Global_Value;
};
test::test()
{
cout << Global_Value << "\n";
}
// int test::Global_Value = 1;
int main()
{
test *t_ptr;
t_ptr = new test;
}
------ end --------
Thanks,
Norbert Hoelken
FhG-IML
Emil-Figge-Str. 75
D-4600 Dortmund 50 (FRG)
email: hoelken@iml.fhg.de
Technical Details
Message-ID:
<9204061608.AA00897@iml.fhg.de>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!iml.fhg.DE!hoelkenShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!iml.fhg.DE!hoelken From: hoelken@iml.fhg.DE (Norbert Hoelken) Subject: gcc 2.1 Message-ID: <9204061608.AA00897@iml.fhg.de> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Mon, 6 Apr 1992 20:08:01 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 52