Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Mike Stump
Wed, 08 Apr 1992 07:13
Re: gcc 2.1
Author: Mike Stump
Date: Wed, 08 Apr 1992 07:13
Date: Wed, 08 Apr 1992 07:13
59 lines
1800 bytes
1800 bytes
> From: Norbert Hoelken <hoelken@iml.fhg.de>
> Date: Mon, 6 Apr 92 18:08:01 +0200
> Message-Id: <9204061608.AA00897@iml.fhg.de>
The gcc bug list/group is not the right place to report your problem.
Please use g++-bug for future problems with the C++ compiler.
> I just received version 2.1 of GNU CC, but there seems to be a bug
> with static data members in C++.
No, there is no bug.
> The following program was compiled without any options (only saying
> g++ <name>.cc) and produced the linker error
> undefined reference to `__4test$Global_Value'
This is correct behavior.
> I tried all combinations of GNU as/ld and systems as/ld with the
> same result.
As it should be.
> The error disappeares when i try to initialize the static member Global_Value
> (commented out in the example).
That is correct beahvior.
> The program works fine with an old release of g++ (g++ 1.37.1).
That is true, but does not matter. It is a desupported feature if you
will. Please read a recent ANSI draft or the ARM. The short of it
is, the commented out line IS necessary.
> --- 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 --------
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads