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-30


2977. Initialization with string literals

Section: 9.4.1  [dcl.init.general]     Status: open     Submitter: Jiang An     Date: 2024-12-27

(From submission #661.)

Subclause 9.4.1 [dcl.init.general] bullet 16.3 specifies:

However, the initializer will be of the form = string-literal or (string-literal), neither of which is a string-literal, obviously.

On a slightly related note, implementations other than EDG and gcc in strict modes support parenthesized string literals, e.g.

  const char s1[] = ("foo");
  const char s2[] = {("foo")};

The latter is clearly not covered by 9.4.5 [dcl.init.list] bullet 3.3:

Possible resolution:

Subclause 9.4.1 [dcl.init.general] bullet 16.3 specifies: