This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


1497. Aggregate initialization with parenthesized string literal

Section: 9.4.2  [dcl.init.aggr]     Status: NAD     Submitter: Daveed Vandevoorde     Date: 2012-04-25

Existing practice appears to be to allow C++03-style aggregate initialization from a parenthesized string literal, e.g.,

  struct S {
    char arr[4];
  } s = {("abc")};

This should be standardized, to allow examples like

  struct S {
    char arr[4];
  };
  void f(S);
  void g() {
    f({("abc")});
  }

Rationale (October, 2012):

CWG agreed that this is already permitted by virtue of _N4567_.5.1.1 [expr.prim.general] paragraph 6.