https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113522

Jiang An <de34 at live dot cn> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |de34 at live dot cn

--- Comment #4 from Jiang An <de34 at live dot cn> ---
std::swap is not supposed to be called with explicitly specified template
arguments.

If the template arguments are not explicitly specified for std::swap, the
correct overloads will be selected if you include currect headers, even when
not all standard headers that declare std::swap overloads are included (the
shape of overload set is unspecified in such cases).

However, if you explicitly specify template arguments, there may be unintended
(likely incorrect) overloads whose template arguments are no longer
underdeduced to be selected. And then undesired implicit conversion can be
trigged during overload resolution, which can make your program ill-formed.

(In reply to Jonathan Wakely from comment #1)
> This is silly code and there is no reason to support it.

Hmm... currently it's specified in [algorithms.requirements] that
> The well-formedness and behavior of a call to an algorithm with an 
> explicitly-specified template argument list is unspecified, except where 
> explicitly stated otherwise.

(Added by P0896R4 and amended by LWG3419.)

Should open an LWG issue to specify similar things for std::swap?

Reply via email to