<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 1775</TITLE>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<STYLE TYPE="text/css">
  INS { text-decoration:none; font-weight:bold; background-color:#A0FFA0 }
  .INS { text-decoration:none; background-color:#D0FFD0 }
  DEL { text-decoration:line-through; background-color:#FFA0A0 }
  .DEL { text-decoration:line-through; background-color: #FFD0D0 }
  @media (prefers-color-scheme: dark) {
    HTML { background-color:#202020; color:#f0f0f0; }
    A { color:#5bc0ff; }
    A:visited { color:#c6a8ff; }
    A:hover, a:focus { color:#afd7ff; }
    INS { background-color:#033a16; color:#aff5b4; }
    .INS { background-color: #033a16; }
    DEL { background-color:#67060c; color:#ffdcd7; }
    .DEL { background-color:#67060c; }
  }
  SPAN.cmnt { font-family:Times; font-style:italic }
</STYLE>
</HEAD>
<BODY>
<P><EM>This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21
  Core Issues List revision 118b.
  See http://www.open-std.org/jtc1/sc22/wg21/ for the official
  list.</EM></P>
<P>2025-09-28</P>
<HR>
<A NAME="1775"></A><H4>1775.
  
Undefined behavior of line splice in raw string literal
</H4>
<B>Section: </B>5.2&#160; [<A href="https://wg21.link/lex.phases">lex.phases</A>]
 &#160;&#160;&#160;

 <B>Status: </B>C++14
 &#160;&#160;&#160;

 <B>Submitter: </B>Canada
 &#160;&#160;&#160;

 <B>Date: </B>2013-09-24<BR><BR>


<A href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n3903.html#CA26">N3690 comment
  CA&#160;26<BR></A>

<P>[Moved to DR at the February, 2014 meeting.]</P>

<P>According to phase 2 of 5.2 [<A href="https://wg21.link/lex.phases#1">lex.phases</A>] paragraph 1,</P>

<BLOCKQUOTE>

Each instance of a backslash character (<TT>\</TT>) immediately followed by
a new-line character is deleted, splicing physical source lines to form
logical source lines. Only the last backslash on any physical source line
shall be eligible for being part of such a splice. If, as a result, a
character sequence that matches the syntax of a universal-character-name is
produced, the behavior is undefined.

</BLOCKQUOTE>

<P>There does not appear to be a good reason for the behavior to be
undefined when the line splice occurs within a raw string literal, since
the splicing will be reverted (5.5 [<A href="https://wg21.link/lex.pptoken#3">lex.pptoken</A>] paragraph 3).</P>

<P><B>Proposed resolution (September, 2013):</B></P>

<P>Change 5.2 [<A href="https://wg21.link/lex.phases#1">lex.phases</A>] paragraph 1 phase 2 as follows:</P>

<OL start="2">
<LI>

<P>Each instance of a backslash character (<TT>\</TT>) immediately followed
by a new-line character is deleted, splicing physical source lines to form
logical source lines. Only the last backslash on any physical source line
shall be eligible for being part of such a splice. <DEL>If, as a
result,</DEL> <INS>Except for splices reverted in a raw string literal, if
a splice results in</INS> a character sequence that matches the syntax of a
universal-character-name <DEL>is produced</DEL>, the behavior is
undefined. A source file that is not empty and that does not end in a
new-line character, or that ends in a new-line character immediately
preceded by a backslash character before any such splicing takes place,
shall be processed as if an additional new-line character were appended to
the file.</P>
</LI>

</OL>

<BR><BR>
</BODY>
</HTML>
