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


2301. Value-initialization and constexpr constructor evaluation

Section: 7.7  [expr.const]     Status: open     Submitter: Daveed Vandevoorde     Date: 2016-04-18

Consider the following example:

  union A {
    constexpr A(int) : x(++x) { }
    int x;
    char* y;
  union B {
    A a = 5;
  int arr[B().a.x];

Value-initialization of the object created by B() zero-initializes the object (9.4 [dcl.init] bullet 8.2), which should mean that the ++x in the mem-initilizer for A operates on a zero-initialized object, but current implementations reject this code as non-constant. It is not clear what in the current wording justifies this treatment.