<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 676</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="676"></A><H4>676.
  
<I>static_assert-declaration</I>s and general requirements for declarations
</H4>
<B>Section: </B>6.2&#160; [<A href="https://wg21.link/basic.def">basic.def</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Alisdair Meredith
 &#160;&#160;&#160;

 <B>Date: </B>12 February, 2008<BR>


<P>[Voted into WP at August, 2010 meeting.]</P>

<P>6.2 [<A href="https://wg21.link/basic.def">basic.def</A>] makes statements about declarations that do
not appear to apply to <I>static_assert-declaration</I>s.  For example,
paragraph 1 says,</P>

<BLOCKQUOTE>

A declaration (9.1 [<A href="https://wg21.link/dcl.pre">dcl.pre</A>]) introduces names into a
translation unit or redeclares names introduced by previous
declarations.  A declaration specifies the interpretation and
attributes of these names.

</BLOCKQUOTE>

<P>What name is being declared or described by
a <I>static_assert-declaration</I>?</P>

<P>Also, paragraph 2 lists the kinds of declarations that are not
definitions, and a <I>static_assert-declaration</I> is not among them.
Is it intentional that <I>static_assert-declaration</I>s are
definitions?</P>

<P><B>Proposed resolution (March, 2010):</B></P>

<P>Change 6.2 [<A href="https://wg21.link/basic.def">basic.def</A>] paragraphs 1-2 as follows:</P>

<BLOCKQUOTE>

<P>A declaration (9.1 [<A href="https://wg21.link/dcl.pre">dcl.pre</A>]) <INS>may</INS>
introduce<DEL>s</DEL> <INS>one or more</INS> names into a
translation unit or redeclare<DEL>s</DEL> names introduced by
previous declarations. <DEL>A</DEL> <INS>If so, the</INS>
declaration specifies the interpretation and attributes of these
names.  <INS>A declaration may also have effects
including</INS>
</P>

<UL>
<LI><P><INS>a static assertion (9.1 [<A href="https://wg21.link/dcl.pre">dcl.pre</A>]),</INS></P></LI>

<LI><P><INS>controlling template instantiation (13.9.3 [<A href="https://wg21.link/temp.explicit">temp.explicit</A>],</INS></P></LI>

<LI><P><INS>use of attributes (9.1 [<A href="https://wg21.link/dcl.pre">dcl.pre</A>], or</INS></P></LI>

<LI><P><INS>nothing (in the case of an
<I>empty-declaration</I>).</INS></P></LI>

</UL>

<P>A declaration is a definition unless it declares a function
without specifying the function's body (9.6 [<A href="https://wg21.link/dcl.fct.def">dcl.fct.def</A>]), it contains the <TT>extern</TT> specifier
(9.2.2 [<A href="https://wg21.link/dcl.stc">dcl.stc</A>]) or a
<I>linkage-specification</I><SUP>25</SUP> (9.12 [<A href="https://wg21.link/dcl.link">dcl.link</A>]) and neither an <I>initializer</I> nor a
<I>function-body</I>, it declares a static data member in a class
definition (11.4.9 [<A href="https://wg21.link/class.static">class.static</A>]), it is a class name
declaration (11.3 [<A href="https://wg21.link/class.name">class.name</A>]), it is an
<I>opaque-enum-declaration</I> (9.8.1 [<A href="https://wg21.link/dcl.enum">dcl.enum</A>]), or it
is a <TT>typedef</TT> declaration (9.2.4 [<A href="https://wg21.link/dcl.typedef">dcl.typedef</A>]), a
<I>using-declaration</I> (9.10 [<A href="https://wg21.link/namespace.udecl">namespace.udecl</A>]), <INS>a
<I>static_assert-declaration</I> (9.1 [<A href="https://wg21.link/dcl.pre">dcl.pre</A>]),
an <I>attribute-declaration</I> (9.1 [<A href="https://wg21.link/dcl.pre">dcl.pre</A>]),
an <I>empty-declaration</I> (9.1 [<A href="https://wg21.link/dcl.pre">dcl.pre</A>]),</INS> or a <I>using-directive</I> (9.9.4 [<A href="https://wg21.link/namespace.udir">namespace.udir</A>]). [<I>Example:</I>...</P>

</BLOCKQUOTE>

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