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


2217. constexpr constructors for non-literal types

Section: 9.2.6  [dcl.constexpr]     Status: NAD     Submitter: Daveed Vandevoorde     Date: 2015-12-21

Given an example like:

  struct S {
    constexpr S(): i(42) {  }
    int i;
  double x[S().i];  // Error

such a constexpr constructor is completely useless, but there doesn't appear to be anything in the current wording making it ill-formed. Should it be?

Rationale (November, 2016):

Such constructors can be useful for guaranteeing static initialization of namespace-scope objects.