<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2846: Undefined phrase "effectively cast"</title>
<meta property="og:title" content="Issue 2846: Undefined phrase &quot;effectively cast&quot;">
<meta property="og:description" content="C++ library issue. Status: New">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2846.html">
<meta property="og:type" content="website">
<meta property="og:image" content="http://cplusplus.github.io/LWG/images/cpp_logo.png">
<meta property="og:image:alt" content="C++ logo">
<style>
  p {text-align:justify}
  li {text-align:justify}
  pre code.backtick::before { content: "`" }
  pre code.backtick::after { content: "`" }
  blockquote.note
  {
    background-color:#E0E0E0;
    padding-left: 15px;
    padding-right: 15px;
    padding-top: 1px;
    padding-bottom: 1px;
  }
  ins {background-color:#A0FFA0}
  del {background-color:#FFA0A0}
  table.issues-index { border: 1px solid; border-collapse: collapse; }
  table.issues-index th { text-align: center; padding: 4px; border: 1px solid; }
  table.issues-index td { padding: 4px; border: 1px solid; }
  table.issues-index td:nth-child(1) { text-align: right; }
  table.issues-index td:nth-child(2) { text-align: left; }
  table.issues-index td:nth-child(3) { text-align: left; }
  table.issues-index td:nth-child(4) { text-align: left; }
  table.issues-index td:nth-child(5) { text-align: center; }
  table.issues-index td:nth-child(6) { text-align: center; }
  table.issues-index td:nth-child(7) { text-align: left; }
  table.issues-index td:nth-child(5) span.no-pr { color: red; }
  @media (prefers-color-scheme: dark) {
     html {
        color: #ddd;
        background-color: black;
     }
     ins {
        background-color: #225522
     }
     del {
        background-color: #662222
     }
     a {
        color: #6af
     }
     a:visited {
        color: #6af
     }
     blockquote.note
     {
        background-color: rgba(255, 255, 255, .10)
     }
  }
</style>
</head>
<body>
<hr>
<p><em>This page is a snapshot from the LWG issues list, see the <a href="lwg-active.html">Library Active Issues List</a> for more information and the meaning of <a href="lwg-active.html#New">New</a> status.</em></p>
<h3 id="2846"><a href="lwg-active.html#2846">2846</a>. Undefined phrase "effectively cast"</h3>
<p><b>Section:</b> 29.4.10 <a href="https://wg21.link/cmplx.over">[cmplx.over]</a>, 29.7.1 <a href="https://wg21.link/cmath.syn">[cmath.syn]</a> <b>Status:</b> <a href="lwg-active.html#New">New</a>
 <b>Submitter:</b> Jens Maurer <b>Opened:</b> 2016-12-15 <b>Last modified:</b> 2019-03-18</p>
<p><b>Priority: </b>3
</p>
<p><b>View all other</b> <a href="lwg-index.html#cmplx.over">issues</a> in [cmplx.over].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#New">New</a> status.</p>
<p><b>Discussion:</b></p>
<p>
In [cmplx.over] and [cmath.syn], when talking about "sufficient additional overloads", we use the phrase
"effectively cast", but that is not a defined term.
<p/>
A hostile interpretation could read "<code>reinterpret_cast</code>" here.
<p/>
Likely we mean "apply floating-point promotions, floating-integral
conversions, and floating-point conversions", but that should be
spelled out somewhere, e.g. in the library definitions section.
<p/>
(Source: <a href="https://github.com/cplusplus/draft/issues/1248">Editorial issue #1248</a>)
</p>

<p><i>[2017-01-27 Telecon]</i></p>

<p>Priority 3</p>

<p><i>[2019-03-16; Daniel comments and provides wording]</i></p>

<p>
I decided to use the form "implicitly converted" and to refer to 7.3 <a href="https://wg21.link/conv">[conv]</a> for 29.7.1 <a href="https://wg21.link/cmath.syn">[cmath.syn]</a> and
29.4.10 <a href="https://wg21.link/cmplx.over">[cmplx.over]</a>, because those conversions can all be done implicitly. This also holds for the 
<code>pow</code> specification 29.4.10 <a href="https://wg21.link/cmplx.over">[cmplx.over]</a> p3, because the described conversions of
<code>complex&lt;T&gt;</code> to <code>complex&lt;U&gt;</code> involve only the need of non-explicit constructors.
</p>


<p id="res-2846"><b>Proposed resolution:</b></p>
<p>This wording is relative to <a href="https://wg21.link/n4810">N4810</a>.</p>

<ol>
<li><p>Change 29.4.10 <a href="https://wg21.link/cmplx.over">[cmplx.over]</a>, as indicated:</p>

<blockquote>
<p>
-2- The additional overloads shall be sufficient to ensure:
<blockquote>
<ol style="list-style-type: none">
<li><p>(2.1) &mdash; If the argument has type <code>long double</code>, then it is 
<del>effectively cast</del><ins>implicitly converted (7.3 <a href="https://wg21.link/conv">[conv]</a>)</ins> to <code>complex&lt;long double&gt;</code>.</p></li>
<li><p>(2.2) &mdash; Otherwise, if the argument has type <code>double</code> or an integer type, then it is 
<del>effectively cast</del><ins>implicitly converted</ins> to <code>complex&lt;double&gt;</code>.</p></li>
<li><p>(2.3) &mdash; Otherwise, if the argument has type <code>float</code>, then it is 
<del>effectively cast</del><ins>implicitly converted</ins> to <code>complex&lt;float&gt;</code>.</p></li>
</ol>
</blockquote>
<p/>
-3 Function template <code>pow</code> shall have additional overloads sufficient to ensure, for a call with at least one argument
of type <code>complex&lt;T&gt;</code>:
<blockquote>
<ol style="list-style-type: none">
<li><p>(3.1) &mdash; If either argument has type <code>complex&lt;long double&gt;</code> or type <code>long double</code>, 
then both arguments are <del>effectively cast</del><ins>implicitly converted (7.3 <a href="https://wg21.link/conv">[conv]</a>)</ins> to 
<code>complex&lt;long double&gt;</code>.</p></li>
<li><p>(3.2) &mdash; Otherwise, if either argument has type <code>complex&lt;double&gt;</code>, <code>double</code>, 
or an integer type, then both arguments are <del>effectively cast</del><ins>implicitly converted</ins> 
to <code>complex&lt;double&gt;</code>.</p></li>
<li><p>(3.3) &mdash; Otherwise, if either argument has type <code>complex&lt;float&gt;</code> or <code>float</code>, 
then both arguments are <del>effectively cast</del><ins>implicitly converted</ins> to 
<code>complex&lt;float&gt;</code>.</p></li>
</ol>
</blockquote>
</p>
</blockquote>

</li>

<li><p>Change 29.7.1 <a href="https://wg21.link/cmath.syn">[cmath.syn]</a>, as indicated:</p>

<blockquote>
<p>
-2- For each set of overloaded functions within <code>&lt;cmath&gt;</code>, with the exception of <code>abs</code>, there 
shall be additional overloads sufficient to ensure:
<blockquote>
<ol>
<li><p>If any argument of arithmetic type corresponding to a <code>double</code> parameter has type <code>long double</code>, then
all arguments of arithmetic type (6.9.2 <a href="https://wg21.link/basic.fundamental">[basic.fundamental]</a>) corresponding to <code>double</code> parameters are 
<del>effectively cast</del><ins>implicitly converted (7.3 <a href="https://wg21.link/conv">[conv]</a>)</ins> to <code>long double</code>.</p></li>
<li><p>Otherwise, if any argument of arithmetic type corresponding to a <code>double</code> parameter has type <code>double</code>
or an integer type, then all arguments of arithmetic type corresponding to <code>double</code> parameters are
<del>effectively cast</del><ins>implicitly converted</ins> to <code>double</code>.</p></li>
<li><p>Otherwise, all arguments of arithmetic type corresponding to <code>double</code> parameters have type <code>float</code>.</p></li>
</ol>
</blockquote>
</p>
</blockquote>
</li>
</ol>





</body>
</html>
