r-char: any member of the source character set, except a right parenthesis ) followed by the initial d-char-sequence (which may be empty) followed by a double quote ".
d-char: any member of the basic source character set except: space, the left parenthesis (, the right parenthesis ), the backslash \, and the control characters representing horizontal tab, vertical tab, form feed, and newline.
An ordinary string literal
has type “array of nconstchar”
where n is the size of the string as defined below,
has static storage duration ([basic.stc]), and
is initialized with the given characters.
A UTF-8 string literal
has type “array of nconstchar8_t”,
where n is the size of the string as defined below;
each successive element of the object representation ([basic.types]) has
the value of the corresponding code unit of the UTF-8 encoding of the string.
A UTF-16 string literal has
type “array of nconstchar16_t”, where n is the
size of the string as defined below;
each successive element of the array
has the value of the corresponding code unit of
the UTF-16 encoding of the string.
A UTF-32 string literal has
type “array of nconstchar32_t”, where n is the
size of the string as defined below;
each successive element of the array
has the value of the corresponding code unit of
the UTF-32 encoding of the string.
A wide string literal has type “array of nconstwchar_t”, where n is the size of the string as defined below; it
is initialized with the given characters.
This
concatenation is an interpretation, not a conversion.
Because the interpretation happens in translation phase 6 (after each character from a
string-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
]
Table 11 has some examples of valid concatenations.
After any necessary concatenation, in translation phase
7 ([lex.phases]), '\0' is appended to every
string-literal so that programs that scan a string can find its end.
Escape sequences and universal-character-names in non-raw string literals
have the same meaning as in character-literals ([lex.ccon]), except that
the single quote ' is representable either by itself or by the escape sequence
\', and the double quote " shall be preceded by a
\,
and except that a universal-character-name in a
UTF-16 string literal may yield a surrogate pair.
The
size of a char32_t or wide string literal is the total number of
escape sequences, universal-character-names, and other characters, plus
one for the terminating U'\0' or
L'\0'.
The size of a UTF-16 string
literal is the total number of escape sequences,
universal-character-names, and other characters, plus one for each
character requiring a surrogate pair, plus one for the terminating
u'\0'.
The size of a narrow string literal is
the total number of escape sequences and other characters, plus at least
one for the multibyte encoding of each universal-character-name, plus
one for the terminating '\0'.
Evaluating a string-literal results in a string literal object
with static storage duration, initialized from the given characters as
specified above.
Whether all string-literals are distinct (that is, are stored in
nonoverlapping objects) and whether successive evaluations of a
string-literal yield the same or a different object is
unspecified.