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


1641. Assignment in member initializer

Section: 11.9.3  [class.base.init]     Status: NAD     Submitter: John Spicer     Date: 2013-03-15

There appears to be no prohibition of assignments in member initializer expressions (neither mem-initializers nor brace-or-equal-initializers):

  struct A {
    int x;
    int y = x = 37;

This seems surprising. Should it be allowed?

Rationale (April, 2013):

CWG saw no problems with the example. It did note, however, that the assignment to x is not an initialization, so x would not be considered to have been initialized by this example.