[Bug libstdc++/66998] not_fn invocation is not SFINAE friendly

tomaszkam at gmail dot com gcc-bugzilla@gcc.gnu.org
Fri Jul 24 16:32:00 GMT 2015


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

--- Comment #2 from Tomasz Kamiński <tomaszkam at gmail dot com> ---
Sorry for missing using declaration. 

> It's certainly a nice QoI improvement. I was basically lazy when I implemented it and used decltype(auto) because it's convenient.

Yes, the decltype(auto) is convenient but the hard error produced in SFINAE
context make it acutally unusable in library. Just think of the mess that would
be caused by:
template<typename C>
delctype(auto) begin(C&& c) { return std::forward<C>(c).begin(); }

The not_fn is also not working with member pointers:
#include <experimental/functional>

using namespace std::experimental;

struct A
{
    bool mem;
};

int main()
{
    not_fn(&A::mem)(A{});
};
Should I create separate issue?


More information about the Gcc-bugs mailing list