CWG Issue 2870 (original) (raw)

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

2025-11-07


2870. Combining absent _encoding-prefix_es

Section: 5.13.5 [lex.string]Status: CD7Submitter: Jan SchultkeDate: 2024-03-09

[Accepted as a DR at the June, 2024 meeting.]

(From submission#511.)

Subclause 5.13.5 [lex.string] paragraph 7 does not properly handle the case where both _encoding-prefix_es are absent:

The common encoding-prefix for a sequence of adjacent _string-literal_s is determined pairwise as follows: If two _string-literal_s have the same encoding-prefix , the common encoding-prefix is that encoding-prefix . If one string-literal has no encoding-prefix , the common encoding-prefix is that of the other string-literal. Any other combinations are ill-formed.

Possible resolution [SUPERSEDED]:

Change in 5.13.5 [lex.string] paragraph 7 as follows:

The common encoding-prefix for a sequence of adjacent string-literal_s is determined pairwise as follows: ~~If two string-literal_s have the same_encoding-prefix, the common encoding-prefix is that_encoding-prefix.~~ If one string-literal has no_encoding-prefix_, the common encoding-prefix is that of the other string-literal or is absent if the other_string-literal_ has no encoding-prefix. Otherwise, both string-literal_s shall have the same_encoding-prefix, and the common encoding-prefix is that_encoding-prefix_. Any other combinations are ill-formed.

CWG 2024-05-03

CWG preferred a holistic instead of a pairwise approach.

Proposed resolution (approved by CWG 2024-05-17):

Change in 5.13.5 [lex.string] paragraph 7 as follows:

The common encoding-prefix for a sequence of adjacent _string-literal_s is determined pairwise as follows: If two _string-literal_s have the same encoding-prefix , the common encoding-prefix is that encoding-prefix . If one string-literal has no encoding-prefix , the common encoding-prefix is that of the other string-literal. Any other combinations are ill-formed.

The _string-literal_s in any sequence of adjacent string-literal_s shall have at most one unique encoding-prefix among them. The common_encoding-prefix of the sequence is that encoding-prefix, if any.