<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2345</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="2345"></A><H4>2345.
  
Jumping across initializers in <I>init-statement</I>s and <I>condition</I>s
</H4>
<B>Section: </B>8.5.2&#160; [<A href="https://wg21.link/stmt.if">stmt.if</A>]
 &#160;&#160;&#160;

 <B>Status: </B>CD5
 &#160;&#160;&#160;

 <B>Submitter: </B>John Spicer
 &#160;&#160;&#160;

 <B>Date: </B>2017-04-25<BR>


<P>According to 8.5.2 [<A href="https://wg21.link/stmt.if#1">stmt.if</A>] paragraph 1,</P>

<BLOCKQUOTE>

If the condition (8.5 [<A href="https://wg21.link/stmt.select">stmt.select</A>]) yields <TT>true</TT> the first
substatement is executed. If the <TT>else</TT> part of the selection
statement is present and the condition yields <TT>false</TT>, the second
substatement is executed. If the first substatement is reached via a label,
the condition is not evaluated and the second substatement is not executed.

</BLOCKQUOTE>

<P>Although 8.10 [<A href="https://wg21.link/stmt.dcl#3">stmt.dcl</A>] paragraph 3 forbids bypassing a
declaration with initialization, a <I>condition</I> is not syntactically a
declaration, and the permission to jump into a <TT>then</TT> clause and the
statement that the condition &#8220;is not evaluated&#8221; could be read
to indicate that a jump across a <I>condition</I> with initialization is
permitted. Presumably the prohibition in 8.10 [<A href="https://wg21.link/stmt.dcl">stmt.dcl</A>] would
apply to an <I>init-statement</I>, since it can be a declaration
syntactically, but one would expect the same restrictions to apply to both.
</P>

<P><B>Notes from the April, 2018 teleconference:</B></P>

<P>This issue will be handled editorially (see editorial issue
<A HREF="https://github.com/cplusplus/draft/pull/1949">1949</A>) and will
be left in "review" status until CWG verifies that the necessary changes
have been made.</P>

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