Title
Value-initialized objects may be constants
Status
nad
Section
7.7 [expr.const]
Submitter
Richard Smith

Created on 2011-12-24.00:00:00 last changed 38 months ago

Messages

Date: 2021-02-15.00:00:00

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.

Date: 2017-02-15.00:00:00

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).

Date: 2021-02-17.00:00:00

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
History
Date User Action Args
2021-02-17 00:00:00adminsetmessages: + msg6508
2021-02-17 00:00:00adminsetstatus: drafting -> nad
2018-02-27 00:00:00adminsetmessages: + msg5900
2011-12-24 00:00:00admincreate