[Bug c++/29043] Constructor for POD type with const member without member initializer accepted

fang at csl dot cornell dot edu gcc-bugzilla@gcc.gnu.org
Wed Sep 13 03:00:00 GMT 2006

------- Comment #1 from fang at csl dot cornell dot edu  2006-09-13 03:00 -------
As you've written it, class C doesn't have any non-static members.  Struct C::s
hasn't been declared as a member object of C.  const int i is a member of C::s,
not C, so C() without member initializers should be acceptable.  

Note, if you write just :

struct s {
  const int i;

// This, however, doesn't give any diagnostics until an instance of s is

s foo;

struct.cc:7: error: structure 'foo' with uninitialized const members

Now, I'd need to lookup the standard to determine whether or not a diagnostic
is appropriate...


fang at csl dot cornell dot edu changed:

           What    |Removed                     |Added
                 CC|                            |fang at csl dot cornell dot
                   |                            |edu


More information about the Gcc-bugs mailing list