List-initialization from a string literal
9.4.5 [dcl.init.list]
Daveed Vandevoorde

Created on 2012-03-29.00:00:00 last changed 49 months ago


Date: 2014-11-15.00:00:00

[Moved to DR at the November, 2014 meeting.]

Date: 2014-06-15.00:00:00

Proposed resolution (June, 2014):

This issue is resolved by the resolution of issue 1467.

Date: 2012-10-15.00:00:00

Notes from the October, 2012 meeting:

CWG agreed that the first example should be permitted, but not the second.

Date: 2012-03-29.00:00:00

Initialization of an array of characters from a string literal is handled by the third bullet of 9.4 [dcl.init] paragraph 16, branching off to 9.4.3 [dcl.init.string]. However, list initialization is handled by the first bullet, branching off to 9.4.5 [dcl.init.list], and there is no corresponding special case in 9.4.5 [dcl.init.list] paragraph 3 for an array of characters initialized by a brace-enclosed string literal. That is, an initialization like

  char s[4]{"abc"};

is ill-formed, which could be surprising. Similarly,


is plausible but also not permitted.

Date User Action Args
2017-02-06 00:00:00adminsetstatus: drwp -> cd4
2015-05-25 00:00:00adminsetstatus: dr -> drwp
2015-04-13 00:00:00adminsetmessages: + msg5387
2014-11-24 00:00:00adminsetstatus: ready -> dr
2014-07-07 00:00:00adminsetstatus: drafting -> ready
2014-03-03 00:00:00adminsetmessages: + msg4887
2012-11-03 00:00:00adminsetmessages: + msg4095
2012-11-03 00:00:00adminsetstatus: open -> drafting
2012-03-29 00:00:00admincreate