The following C++ code should not compile: class C { C() { } struct s { const int i; }; };
The C++ standard clause 12.6.2 ; 4 says that for each non-static data member of a POD class type containing a member of a const-qualified type, there must be a member initialiser, or else the program is ill-formed. -- Summary: Constructor for POD type with const member without member initializer accepted Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: amylaar at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29043