home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!polstra!jdp
- From: jdp@polstra.uucp (John Polstra)
- Subject: Re: Initialization {} of Aggregates with Static Members
- Message-ID: <BzB888.DKA@polstra.uucp>
- Organization: Polstra & Co., Inc., Seattle, WA
- References: <BzA5oG.Bwu@polstra.uucp> <1992Dec15.094709.5566@eua.ericsson.se>
- Date: Tue, 15 Dec 1992 16:52:56 GMT
- Lines: 30
-
- In article <1992Dec15.094709.5566@eua.ericsson.se> euamts@eua.ericsson.se writes:
- > class testbase
- > {
- > public:
- > int y; // If I remove this line...
- > };
- >
- > class test : public testbase
- > {
- > public:
- > int myVal;
- > const test* myNext;
- > };
- >
- > const test t1 = {7,1,0}; // If I remove "7,"
- >
- > [Remainder of program and description of symptoms deleted]
-
- I don't think the above is legal. ARM section 8.4.1 says that
- curly-brace initialization may be used for *aggregates*, and that an
- *aggregate* (by definition) has no base classes. Your class "test" has a
- base class, thus it is not an aggregate, thus it may not be initialized
- using curly braces.
-
- At least, that's my reading of the ARM.
- --
- John Polstra polstra!jdp@uunet.uu.net
- John D. Polstra & Co., Inc. ...!uunet!polstra!jdp
- Seattle, Washington USA Phone (206) 932-6482, FAX (206) 935-1262
- "Self-knowledge is always bad news." -- John Barth
-