Skip to content

Commit b8e9549

Browse files
authored
Merge 2021-06 CWG Motion 9
P2201R1 Mixed string literal concatenation
2 parents 62988c9 + 80aa80b commit b8e9549

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

source/compatibility.tex

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,22 @@
2424
\effect
2525
Some identifiers are no longer well-formed.
2626

27+
\diffref{lex.string}
28+
\change
29+
Concatenated \grammarterm{string-literal}s can no longer have
30+
conflicting \grammarterm{encoding-prefix}es.
31+
\rationale
32+
Removal of unimplemented conditionally-supported feature.
33+
\effect
34+
Concatenation of \grammarterm{string-literal}s
35+
with different \grammarterm{encoding-prefix}es
36+
is now ill-formed.
37+
\begin{example}
38+
\begin{codeblock}
39+
auto c = L"a" U"b"; // was conditionally-supported; now ill-formed
40+
\end{codeblock}
41+
\end{example}
42+
2743
\rSec1[diff.cpp17]{\Cpp{} and ISO \CppXVII{}}
2844

2945
\rSec2[diff.cpp17.general]{General}
@@ -1835,6 +1851,21 @@
18351851
\howwide
18361852
Programs which depend upon \tcode{sizeof('x')} are probably rare.
18371853

1854+
\diffref{lex.string}
1855+
\change
1856+
Concatenated \grammarterm{string-literal}s can no longer have
1857+
conflicting \grammarterm{encoding-prefix}es.
1858+
\rationale
1859+
Removal of non-portable feature.
1860+
\effect
1861+
Concatenation of \grammarterm{string-literal}s
1862+
with different \grammarterm{encoding-prefix}es
1863+
is now ill-formed.
1864+
\difficulty
1865+
Syntactic transformation.
1866+
\howwide
1867+
Seldom.
1868+
18381869
\diffref{lex.string}
18391870
\change
18401871
String literals made const.\\

source/lex.tex

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1732,10 +1732,7 @@
17321732
In translation phase 6\iref{lex.phases}, adjacent \grammarterm{string-literal}{s} are concatenated. If
17331733
both \grammarterm{string-literal}{s} have the same \grammarterm{encoding-prefix}, the resulting concatenated \grammarterm{string-literal} has
17341734
that \grammarterm{encoding-prefix}. If one \grammarterm{string-literal} has no \grammarterm{encoding-prefix}, it is treated as a \grammarterm{string-literal} of
1735-
the same \grammarterm{encoding-prefix} as the other operand. If a UTF-8 string literal token is adjacent to a
1736-
wide string literal token, the program is ill-formed. Any other concatenations are
1737-
conditionally-supported with \impldef{concatenation of some types of \grammarterm{string-literal}s}
1738-
behavior.
1735+
the same \grammarterm{encoding-prefix} as the other operand. Any other concatenations are ill-formed.
17391736
\begin{note}
17401737
This concatenation is an interpretation, not a conversion.
17411738
Because the interpretation happens in translation phase 6

0 commit comments

Comments
 (0)