This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++17 status.

2259. Issues in 17.6.5.5 rules for member functions

Section: 16.4.6.5 [member.functions] Status: C++17 Submitter: Richard Smith Opened: 2013-05-12 Last modified: 2017-07-30

Priority: 3

View all other issues in [member.functions].

View all issues with C++17 status.

Discussion:

16.4.6.5 [member.functions] p2 says:

"An implementation may declare additional non-virtual member function signatures within a class:

  1. 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.

  2. 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.

  3. None of these bullets allows a member function with no ref-qualifier to be replaced by signatures with ref-qualifiers (a situation which was just discussed on std-proposals), and likewise for cv-qualifiers. Presumably that is not intentional, and such changes should be permissible.

I think the first two items are probably editorial, since the intent is clear.

[2013-12-11 Richard provides concrete wording]

[2015-05, Lenexa]

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.
MC: so we want to keep the footnote
STL: doesn't need to be a footnote, can be an inline Note
JW: does this have any impact on our ability to add totally different functions with unrelated names, not described in the standard?
MC: no, the old wording didn't refer to such functions anyway
Move to Ready and include in motion on Friday?
9 in favor, 0 opposed, 2 abstention

Proposed resolution:

This wording is relative to N3797.

  1. Merge 16.4.6.5 [member.functions]p2+3 as indicated:

    -2- An implementation may declare additional non-virtual member function signatures within a class:

    • by adding arguments with default values to a member function signature;188 [Note: An implementation may not add arguments with default values to virtual, global, or non-member functions. — end note]

    • by replacing a member function signature with default values by two or more member function signatures with equivalent behavior; and

    • by adding a member function signature for a member function name.

    -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.] 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. [Note: 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. — end note]