This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Bug in EGCS 1.1b (better than 1.0.3a though)
- To: Christopher Curtis <ccurtis at ee dot fit dot edu>
- Subject: Re: Bug in EGCS 1.1b (better than 1.0.3a though)
- From: Alexandre Oliva <oliva at dcc dot unicamp dot br>
- Date: 18 Sep 1998 21:11:21 +-300
- Cc: egcs-bugs at cygnus dot com
- References: <Pine.GSO.3.96.980918102416.24379A-100000@yacht.ee.fit.edu>
Christopher Curtis <ccurtis@ee.fit.edu> writes:
> On 18 Sep 1998, Alexandre Oliva wrote:
>> /home/msc/oliva/test.cc:6: ANSI C++ forbids in-class initialization of
>> non-const static member `References'
> But if it is the spec, I don't get it. How can I ever have a sane
> starting value for 'References'?
Every static data member must be defined outside the class body,
*even* if it is initialized within the class body. So, in your
example, we'd have:
template<class T> class MoreComplex : public complex<T> {
private: static int References; };
template <class T> int MoreComplex<T>::References = 0;
--
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil