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

Daniel Krügler <daniel.kruegler at googlemail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |daniel.kruegler@googlemail.
                   |                            |com

--- Comment #1 from Daniel Krügler <daniel.kruegler at googlemail dot com> ---
This is a programming error on your side: The compiler sees two functions
tolower in the global namespace and both could be used equally good for
deduction purposes in the call:

std::transform(str.begin(), str.end(), str.begin(), ::tolower);

Since both could be used to deduce the template parameter UnaryOperation, this
deduction fails and the std::transform template with four function parameters
is excluded from overload resolution. The remaining one has five parameters and
fails as well. You can help the compiler by introducing a lambda expression:

std::transform(str.begin(), str.end(), str.begin(), [](auto c){ return
::tolower(c); });

Now the compiler can perform overload resolution on the call expression
::tolower(c) and can determine a single best candidate.

Reply via email to