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

2024-03-20


790. Concatenation of raw and non-raw string literals

Section: 5.13.5  [lex.string]     Status: CD2     Submitter: JP     Date: 3 March, 2009

N2800 comment JP 5

[Voted into WP at October, 2009 meeting.]

The description of concatenation of string literals in 5.13.5 [lex.string] paragraph 11 does not mention raw strings explicitly, so it is not clear whether, and if so, how, they combine with non-raw strings.

Notes from the March, 2009 meeting:

A raw string should be considered equivalent to the corresponding non-raw string in string literal concatenation.

Proposed resolution (September, 2009):

  1. In 5.13.5 [lex.string], replace the definition of string-literal with:


  2. Change 5.13.5 [lex.string] paragraph 5 as follows:

  3. A After translation phase 6, a string literal that does not begin with u8, u, U, or L an encoding-prefix is an ordinary string literal, and is initialized with the given characters.
  4. Change 5.13.5 [lex.string] paragraph 12 as follows:

  5. In translation phase 6 (5.2 [lex.phases]), adjacent string literals are concatenated. If both string literals have the same prefix encoding-prefix, the resulting concatenated string literal has that prefix encoding-prefix. If one string literal has no prefix encoding-prefix, it is treated as a string literal of the same prefix encoding-prefix as the other operand. If a UTF-8 string literal token is adjacent to a wide string literal token, the program is ill-formed. Any other concatenations are conditionally supported with implementation-defined behavior. [Note: This concatenation is an interpretation, not a conversion. Because the interpretation happens in translation phase 6 (after each character from each literal has been translated into a value from the appropriate character set), a string literal's initial rawness has no effect on the interpretation or well-formedness of the concatenation.end note] [Example:...

(Note: this resolution also resolves issue 834.)