Title
Misleading note about calls to customization points
Status
new
Section
[namespace.std]
Submitter
Michael Park

Created on 2020-05-08.00:00:00 last changed 2 weeks ago

Messages

Date: 2020-05-09.19:58:13

Proposed resolution:

This wording is relative to N4861.

  1. Modify [namespace.std] as indicated:

    -7- Other than in namespace std or in a namespace within namespace std, a program may provide an overload for any library function template designated as a customization point, provided that (a) the overload's declaration depends on at least one user-defined type and (b) the overload meets the standard library requirements for the customization point. (footnote 173) [Note: This permits a (qualified or unqualified) call to the customization point to invoke the most appropriate overload for the given arguments. — end note]

Date: 2020-05-08.00:00:00

P0551 (Thou Shalt Not Specialize std Function Templates!) added a clause in [namespace.std]/7:

Other than in namespace std or in a namespace within namespace std, a program may provide an overload for any library function template designated as a customization point, provided that (a) the overload's declaration depends on at least one user-defined type and (b) the overload meets the standard library requirements for the customization point. (footnote 174) [Note: This permits a (qualified or unqualified) call to the customization point to invoke the most appropriate overload for the given arguments. — end note]

Given that std::swap is a designated customization point, the note seems to suggest the following:

namespace N {
  struct X {};
  void swap(X&, X&) {}
}

N::X a, b;
std::swap(a, b); // qualified call to customization point finds N::swap?

This is not what happens, as the call to std::swap does not find N::swap.

History
Date User Action Args
2020-05-09 19:58:13adminsetmessages: + msg11281
2020-05-08 00:00:00admincreate