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

amylaar at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Sep 12 21:02:00 GMT 2006


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



More information about the Gcc-bugs mailing list