Article View: gnu.g++.bug
Article #1041gcc 2.2.2 (C++)
From: S Manoharan
Date: Fri, 09 Oct 1992 11:26
Date: Fri, 09 Oct 1992 11:26
40 lines
1320 bytes
1320 bytes
Static members of user defined-type generate link-time errors.
#include <stdio.h>
class Foo {
private:
int dummy;
public:
Foo() { dummy = 10; }
int bar() { return 2*dummy; }
};
class Test {
protected:
static Foo s;
public:
virtual int show() { return s.bar(); }
};
class Test2 : public Test {
public:
virtual int show() { return (s.bar() + 2); }
};
int main()
{
Test t1;
printf("%d\n", t1.show());
Test t[10];
printf("%d\n", t[0].show());
Test2 t21;
printf("%d\n", t21.show());
Test2 t2[10];
printf("%d\n", t2[0].show());
}
---
S Manoharan Email : mano@acri.fr
Advanced Computer Research Institute Fax : +33 72 35 84 10
1 Boulevard Marius Vivier-Merle Voice : +33 72 35 84 00
69443 Lyon Cedex 03 France
Technical Details
Message-ID:
<1992Oct9.112604.16202@acri.fr>Path:
arc1-ca.pugleaf.net!sparky!uunet!convex!linac!pacific.mps.ohio-state.edu!cis.ohio-state.edu!arch04.acri.FR!manoShow Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug Path: arc1-ca.pugleaf.net!sparky!uunet!convex!linac!pacific.mps.ohio-state.edu!cis.ohio-state.edu!arch04.acri.FR!mano From: mano@arch04.acri.FR (S Manoharan) Subject: gcc 2.2.2 (C++) Message-ID: <1992Oct9.112604.16202@acri.fr> Sender: gnulists@ai.mit.edu Reply-To: mano@arch04.acri.fr Organization: Advanced Computer Research Institute Distribution: gnu Date: Fri, 9 Oct 1992 11:26:04 GMT Approved: bug-g++@prep.ai.mit.edu Lines: 41