[Bug libstdc++/80564] bind on SFINAE unfriendly generic lambda
columbo@gmx-topmail.de
gcc-bugzilla@gcc.gnu.org
Thu May 4 20:16:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80564
--- Comment #6 from Robert Haberlach <columbo@gmx-topmail.de> ---
(In reply to TC from comment #4)
> (In reply to Eric Fiselier from comment #3)
> > Here is an example of why `_Bind::operator()(...) const` must be considered
> > during overload resolution even if the call wrapper itself is not const.
> >
> > ------------------------------
> > #include <functional>
> >
> > struct Func {
> > template <class ...Args>
> > void operator()(Args&&...) = delete;
> >
> > template <class ...Args>
> > void operator()(Args&&...) const {}
> > };
> >
> > int main() {
> > Func f;
> > std::bind(f)();
> > }
> > -------------------------
>
> Interesting, libstdc++ rejects this as an attempt to call a deleted
> function. That seems more correct than libc++'s approach which calls the
> const overload.
See also the discussion on Phabricator: https://reviews.llvm.org/D32824
I agree. AFAICS [func.bind.bind] is clear on this: the type of the Func
object used to call the member operator() is non-const.
More information about the Gcc-bugs
mailing list