[Bug c++/60284] New: Default-initialization without user-provided constructor allowed

potswa at mac dot com gcc-bugzilla@gcc.gnu.org
Thu Feb 20 08:52:00 GMT 2014


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60284

            Bug ID: 60284
           Summary: Default-initialization without user-provided
                    constructor allowed
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: potswa at mac dot com

This declaration is ill-formed according to the last sentence of [dcl.init]
§8.5/7, "If a program calls for the default initialization of an object of a
const-qualified type T, T shall be a class type with a user-provided default
constructor":

struct a {} const o;

There is actually a very nice diagnostic implemented by r179170 and PR42844,
but it's only activated when the class has an uninitialized member, per the
notes of CWG DR 253. However those notes aren't normative and Clang diagnoses
the error, http://stackoverflow.com/q/21900237/153285 .


More information about the Gcc-bugs mailing list