On Sat, 2003-05-31 at 10:35, Martin v. Löwis wrote: > Herbert Valerio Riedel <[EMAIL PROTECTED]> writes: > > ...so... is _still_ not a buggy behaviour?? > > No. Look at 8.5/9: > > # If no initializer is specified for an object, and the object is of > # (possibly cv-qualified) non-POD class type (or array thereof), the > # object shall be default-initialized; if the object is of > # const-qualified type, the underlying class type shall have a > # user-declared default constructor. [..] # Otherwise, if no initializer is specified for anobject, the object # and its subobjects, if any, have an indeterminate initial value; if # the object or any of its subobjects are of const-qualified type, the # program is ill-formed.
> Your objects have const-qualified type, and the underlying class has > no user-declared default constructor, hence your program is > ill-formed. alright, then g++'s fault is to fail to recognize the ill-formed-ness of at least the following cases, happily succeeds compiling them...: struct foo { virtual void f(void); }; struct bar { bar (); // user defined default constructor }; struct doo { bar m_bar; // non-POD member w/ u.d.d.c }; struct zoo: public bar { }; // inherited u.d.d.c const foo a_foo; // ill-formed - foo has no user-declared def-cons const bar a_bar; // ok const doo a_doo; // ill-formed - doo has no user-declared def-cons const zoo a_zoo; // ill-formed? not sure about this one... reagards, -- Herbert Valerio Riedel / Phone: (EUROPE) +43-1-58801-18840 Email: [EMAIL PROTECTED] / Finger [EMAIL PROTECTED] for GnuPG Public Key GnuPG Key Fingerprint: 7BB9 2D6C D485 CE64 4748 5F65 4981 E064 883F 4142