C++11 style SFINAE and function visibility on template instantiation
===

I'm not sure if this has anything to do with sfinae, or just something thats relevant for any templated function. I am attempting to use sfinae to enable/disable a member function based on existence of corresponding free function, which in turn is enabled/disabled bades on existance of member function in another type, all using method described [here](http://stackoverflow.com/a/9154394/1554020):

    struct S;

    template <typename T>
    inline auto f(S& s, T const& t)
       -> decltype(t.f(s), void())
    {
       t.f(s);
    }

    struct S
    {
        template <typename T>
        auto f(T const& t)
            -> decltype(f(*this, t), void())
        {
            f(*this, t); // <------------------------------------------- HERE
        }
    };

    struct pass
    {
        void f(S&) const
        {
            //...
        }
    };

    struct fail
    {
    };

    int main()
    {
        S s;
        s.f(pass()); // should compile fine
        //s.f(fail()); // should fail to compile due to absence of f from S
        return 0;
    }

however gcc 4.7.1 gives me this on the line marked by arrow:

> error: no matching function for call to 'S::f(S&, const pass&)'

> note: candidate is:

> note: template<class T> decltype ((f((* this), t), void())) S::f(const T&)

> note:   template argument deduction/substitution failed:

> note:   candidate expects 1 argument, 2 provided

which apparently means that global `f` above is not considered for overload resolution.

Why is that and what do I do to make it do so?
