is this an error ??

Florian Weimer fw@deneb.enyo.de
Mon Oct 8 13:43:00 GMT 2001


fabiosmoker <fabiosmoker@libero.it> writes:

> /**********/
> //this programm don't work 	 
> //       
>       static std::vector<struct prova>::iterator iter = base.begin();
> //
> //is this an error ???      

| The declaration of a static data member in its class definition is
| not a definition and may be of an incomplete type other than
| cv-qualified void.

(ISO/IEC 14882:1998, 9.4.2(2))

The definition of a static data member has to be separate, preferably
in a translation unit which contains other implementation details of
the class in question.

However, your code is not legal even if you fix this problem; you
cannot initialize a static data member using an expression which
refers to a non-static member.



More information about the Gcc-bugs mailing list