<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2299</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="2299"></A><H4>2299.
  
<TT>constexpr</TT> vararg functions
</H4>
<B>Section: </B>9.2.6&#160; [<A href="https://wg21.link/dcl.constexpr">dcl.constexpr</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Daveed Vandevoorde
 &#160;&#160;&#160;

 <B>Date: </B>2016-04-11<BR>


<P>[Accepted as a DR at the March, 2018 (Jacksonville) meeting.]</P>

<P>It is not clear whether a <TT>constexpr</TT> function can be a vararg
function or not. In particular, it is unclear if <TT>va_list</TT> is a
literal type and whether <TT>va_start</TT>, <TT>va_arg</TT>, and
<TT>va_end</TT> produce constant expressions.</P>

<P><B>Proposed resolution (November, 2017)</B></P>

<OL>
<LI><P>Add a new bullet to the list in 7.7 [<A href="https://wg21.link/expr.const#2">expr.const</A>] paragraph 2,
 and update the text as follows:</P></LI>

<BLOCKQUOTE>

<P>An expression <TT>e</TT>
is a core constant expression unless the evaluation of <TT>e</TT>,
following the rules of the abstract machine (6.10.1 [<A href="https://wg21.link/intro.execution">intro.execution</A>]),
would evaluate one of the following expressions:</P>

<UL>
<LI><P>...</P></LI>

<LI><P>a relational (7.6.9 [<A href="https://wg21.link/expr.rel">expr.rel</A>]) or equality
(7.6.10 [<A href="https://wg21.link/expr.eq">expr.eq</A>]) operator where the result is
unspecified; <DEL>or</DEL>
</P></LI>

<LI><P>a <I>throw-expression</I> (7.6.18 [<A href="https://wg21.link/expr.throw">expr.throw</A>])<DEL>.</DEL>
<INS>; or</INS>
</P></LI>

<LI><P><INS>an invocation of the <TT>va_arg</TT> macro
(17.14.2 [<A href="https://wg21.link/cstdarg.syn">cstdarg.syn</A>]).</INS></P></LI>

</UL>

<P>If <TT>e</TT> satisfies the constraints of a core constant expression,
but evaluation of <TT>e</TT> would evaluate an operation that has undefined
behavior as specified in Clause 16 [<A href="https://wg21.link/library">library</A>] through
Clause 32 [<A href="https://wg21.link/thread">thread</A>] of this document, <INS>or an invocation of the
<TT>va_start</TT> macro (17.14.2 [<A href="https://wg21.link/cstdarg.syn">cstdarg.syn</A>]),</INS> it is
unspecified whether <TT>e</TT> is a core constant expression.</P>

</BLOCKQUOTE>

</OL>

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