<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 569</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="569"></A><H4>569.
  
Spurious semicolons at namespace scope should be allowed
</H4>
<B>Section: </B>9.1&#160; [<A href="https://wg21.link/dcl.pre">dcl.pre</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Matt Austern
 &#160;&#160;&#160;

 <B>Date: </B>20 March 2006<BR>


<P>[Voted into the WP at the March, 2009 meeting.]</P>

<P>The grammar in 9.1 [<A href="https://wg21.link/dcl.pre#1">dcl.pre</A>] paragraph 1 says that a
<I>declaration-seq</I> is either <I>declaration</I>
or <I>declaration-seq declaration</I>. Some declarations end with
semicolons and others (e.g. function definitions and namespace
declarations) don't. This means that users who put a semicolon after
every declaration are technically writing ill-formed code. The trouble
is that in this respect the standard is out of sync with reality. It's
convenient to allow semicolons after every declaration, and there's no
implementation difficulty in doing so. All existing compilers accept
this, except in extra-pedantic mode. When all implementations disagree
with the standard, it's time for the standard to change.</P>

<P>Suggested resolution:</P>

<P>In the grammar in 9.1 [<A href="https://wg21.link/dcl.pre#11">dcl.pre</A>] paragraph 11, change the
second line in the definition of <I>declaration-seq</I> to</P>

<UL>
<I>declaration-seq</I> <TT>;</TT><I><SUB>opt</SUB> declaration</I>
</UL>

<P><B>Proposed resolution (October, 2006):</B></P>

<OL>
<LI><P>Add the indicated lines to the grammar definitions in
9.1 [<A href="https://wg21.link/dcl.pre#1">dcl.pre</A>] paragraph 1:</P></LI>

<BLOCKQUOTE>

<I>declaration:</I><BR>
<UL>
...<BR>
<I>namespace-definition</I><BR>
<I><INS>empty-declaration</INS></I>
</UL>
<BR>
...
<BR><BR>
<I>static_assert-declaration:</I><BR>
<UL>
<TT>static_assert ( </TT><I>constant-expression</I><TT> , </TT>
<I>string-literal</I><TT> ) ;</TT>
</UL>
<BR><BR>
<INS>
<I>empty-declaration:</I><BR>
<UL><INS><TT>;</TT></INS></UL>
</INS>

</BLOCKQUOTE>

<LI><P>Add the following as a new paragraph after 9.1 [<A href="https://wg21.link/dcl.pre#4">dcl.pre</A>] paragraph 4:
</P></LI>

<BLOCKQUOTE>

An <I>empty-declaration</I> has no effect.

</BLOCKQUOTE>
</OL>

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