<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Issue 2259: Issues in 17.6.5.5 rules for member functions</title>
<meta property="og:title" content="Issue 2259: Issues in 17.6.5.5 rules for member functions">
<meta property="og:description" content="C++ library issue. Status: C++17">
<meta property="og:url" content="https://cplusplus.github.io/LWG/issue2259.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#C++17">C++17</a> status.</em></p>
<h3 id="2259"><a href="lwg-defects.html#2259">2259</a>. Issues in 17.6.5.5 rules for member functions</h3>
<p><b>Section:</b> 16.4.6.5 <a href="https://wg21.link/member.functions">[member.functions]</a> <b>Status:</b> <a href="lwg-active.html#C++17">C++17</a>
 <b>Submitter:</b> Richard Smith <b>Opened:</b> 2013-05-12 <b>Last modified:</b> 2017-07-30</p>
<p><b>Priority: </b>3
</p>
<p><b>View other</b> <a href="lwg-index-open.html#member.functions">active issues</a> in [member.functions].</p>
<p><b>View all other</b> <a href="lwg-index.html#member.functions">issues</a> in [member.functions].</p>
<p><b>View all issues with</b> <a href="lwg-status.html#C++17">C++17</a> status.</p>
<p><b>Discussion:</b></p>
<p>
16.4.6.5 <a href="https://wg21.link/member.functions">[member.functions]</a> p2 says:
</p>

<blockquote><p>
&quot;An implementation may declare additional non-virtual member function signatures within a class:
</p>
<ul>
<li>by adding arguments with default values to a member function signature; [Footnote: Hence, the address of a member 
function of a class in the C++ standard library has an unspecified type.] [<i>Note</i>: An implementation
may not add arguments with default values to virtual, global, or non-member functions. &mdash; <i>end note</i>]</li>
<li>by replacing a member function signature with default values by two or more member function signatures
with equivalent behavior; and</li>
<li>by adding a member function signature for a member function name.&quot;</li>
</ul>
</blockquote>

<ol>
<li>
<p>
This wording is not using the correct terminology. "by adding arguments with default values" presumably means 
"by adding parameters with default arguments", and likewise throughout.
</p>
</li>
<li>
<p>
This paragraph only allows an implementation to declare "additional" signatures, but the first bullet is talking 
about replacing a standard signature with one with additional parameters.
</p>
</li>
<li>
<p>
None of these bullets allows a member function with no <i>ref</i>-qualifier to be replaced by signatures with <i>ref</i>-qualifiers 
(a situation which was just discussed on std-proposals), and likewise for <i>cv</i>-qualifiers. Presumably that is 
not intentional, and such changes should be permissible.
</p>
</li>
</ol>

<p>
I think the first two items are probably editorial, since the intent is clear.
</p>

<p><i>[2013-12-11 Richard provides concrete wording]</i></p>

<p>
</p>

<p><i>[2015-05, Lenexa]</i></p>

<p>
JW: I don't like that this loses the footnote about the address of member functions having an unspecified type, 
the footnote is good to be able to point to as an explicit clarification of one consequence of the normative wording.<br/>
MC: so we want to keep the footnote<br/>
STL: doesn't need to be a footnote, can be an inline Note<br/>
JW: does this have any impact on our ability to add totally different functions with unrelated names, not described in 
the standard?<br/>
MC: no, the old wording didn't refer to such functions anyway<br/>
Move to Ready and include in motion on Friday?<br/>
9 in favor, 0 opposed, 2 abstention 
</p>


<p id="res-2259"><b>Proposed resolution:</b></p>
<p>This wording is relative to N3797.</p>

<ol>
<li><p>Merge 16.4.6.5 <a href="https://wg21.link/member.functions">[member.functions]</a>p2+3 as indicated:</p>

<blockquote>
<p>
-2- <del>An implementation may declare additional non-virtual member function signatures within a class:</del>
</p>
<ul>
<li><p>
<del>by adding arguments with default values to a member function signature;188 [<i>Note:</i> An implementation
may not add arguments with default values to virtual, global, or non-member functions. &mdash; <i>end note</i>]</del>
</p></li>
<li><p>
<del>by replacing a member function signature with default values by two or more member function signatures
with equivalent behavior; and</del>
</p></li>
<li><p>
<del>by adding a member function signature for a member function name.</del>
</p></li>
</ul>
<p>
<del>-3- A call to a member function signature described in the C++ standard library behaves as if the implementation
declares no additional member function signatures.[Footnote: A valid C++ program always calls the expected library 
member function, or one with equivalent behavior. An implementation may also define additional member functions 
that would otherwise not be called by a valid C++ program.]</del> <ins>For a non-virtual member function described 
in the C++ standard library, an implementation may declare a different set of member function signatures, provided 
that any call to the member function that would select an overload from the set of declarations described in this 
standard behaves as if that overload were selected. [<i>Note:</i> For instance, an implementation may add parameters 
with default values, or replace a member function with default arguments with two or more member functions with 
equivalent behavior, or add additional signatures for a member function name. &mdash; <i>end note</i>]</ins>
</p>

</blockquote>
</li>

</ol>





</body>
</html>
