This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 112c. See for the official list.


1452. Value-initialized objects may be constants

Section: 7.7  [expr.const]     Status: NAD     Submitter: Richard Smith     Date: 2011-12-24

Some classes that would produce a constant when initialized by value-initialization are not considered literal types. For example:

   struct A { int a; };       // non-constexpr default constructor
   struct B : A {};           // non-literal type
   constexpr int i = B().a;   // OK, trivial constructor not called
   constexpr B b = b ();      // error, constexpr object of non-literal type

Additional note (February, 2017):

This is effectively issue 644, which was resolved once, then had its resolution backed out via the resolution of issue 1071 (actual drafting in issue 981).

Rationale (February, 2021):

The adoption of paper P1331R2 (at the July, 2019 meeting) rendered the question in the issue moot, as the requirement that a constexpr constructor initialize all its non-static data members was removed, so the defaulted B default constructor is now constexpr.