<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<TITLE>
    CWG Issue 2851</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="2851"></A><H4>2851.
  
Allow floating-point conversions in converted constant expressions
</H4>
<B>Section: </B>7.7&#160; [<A href="https://wg21.link/expr.const">expr.const</A>]
 &#160;&#160;&#160;

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

 <B>Submitter: </B>Brian Bi
 &#160;&#160;&#160;

 <B>Date: </B>2023-11-03<BR>


<P>[Accepted as a DR at the March, 2024 meeting.]</P>

<P>(From submission
<A HREF="https://github.com/cplusplus/CWG/issues/456">#456</A>.)</P>

<P>With the adoption of P1907R1, non-type template parameters of
floating-point types have been introduced.  It is surprising that
a <TT>double</TT> value cannot be passed as a template argument for a
template parameter of type <TT>long double</TT>, because
floating-point conversions are not allowed in converted constant
expressions.</P>

<P><B>Proposed resolution (approved by CWG 2024-02-16):</B></P>

<P>Change in 7.7 [<A href="https://wg21.link/expr.const#12">expr.const</A>] paragraph 12 as follows:</P>

<BLOCKQUOTE>

A <I>converted constant expression</I> of type T is an expression,
implicitly converted to type T, where the converted expression is a
constant expression and the implicit conversion sequence contains only
<UL>
<LI>user-defined conversions,</LI>
<LI>lvalue-to-rvalue conversions (7.3.2 [<A href="https://wg21.link/conv.lval">conv.lval</A>]),</LI>
<LI>array-to-pointer conversions (7.3.3 [<A href="https://wg21.link/conv.array">conv.array</A>]),</LI>
<LI>function-to-pointer conversions (7.3.4 [<A href="https://wg21.link/conv.func">conv.func</A>]),</LI>
<LI>qualification conversions (7.3.6 [<A href="https://wg21.link/conv.qual">conv.qual</A>]),</LI>
<LI>integral promotions (7.3.7 [<A href="https://wg21.link/conv.prom">conv.prom</A>]),</LI>
<LI>integral
conversions (7.3.9 [<A href="https://wg21.link/conv.integral">conv.integral</A>]) other than narrowing
conversions (9.5.5 [<A href="https://wg21.link/dcl.init.list">dcl.init.list</A>]),</LI>
<LI class="ins">floating-point promotions (7.3.8 [<A href="https://wg21.link/conv.fpprom">conv.fpprom</A>]),</LI>
<LI class="ins">floating-point conversions
(7.3.10 [<A href="https://wg21.link/conv.double">conv.double</A>]) where the source value can be
represented exactly in the destination type,</LI>
<LI>null pointer
conversions (7.3.12 [<A href="https://wg21.link/conv.ptr">conv.ptr</A>]) from std::nullptr_t,</LI>
<LI>
null member pointer conversions (7.3.13 [<A href="https://wg21.link/conv.mem">conv.mem</A>]) from
std::nullptr_t, and</LI>
<LI>function pointer conversions
(7.3.14 [<A href="https://wg21.link/conv.fctptr">conv.fctptr</A>]),</LI>
</UL>
and where the reference binding (if any) binds directly.

</BLOCKQUOTE>

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