🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #241

Re: gcc 2.1

#241
From: Mike Stump
Date: Wed, 08 Apr 1992 07:13
59 lines
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 --------
Technical Details
Message-ID: <9204080713.AA00725@cygnus.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrs

Show Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrs
From: mrs@cygnus.com (Mike Stump)
Subject: Re:  gcc 2.1
Message-ID: <9204080713.AA00725@cygnus.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 8 Apr 1992 07:13:58 GMT
Approved: bug-gcc@prep.ai.mit.edu
Lines: 60