------- Comment #4 from fang at csl dot cornell dot edu  2005-10-06 21:28 
-------
Subject: Re:  [4.0 regression] lookup fails to match to function
 call, const-sensitive

Something else puzzling to me, that I noticed from your reduction:
Why is the compiler always matching the non-const version of mem_fun, when
the member-function I'm passing in (pair_dump) is const? Isn't the const a
closer match?  In fact, if I remove the non-const mem_fun() definition,
then I get "no match found" from g++-3.3 to 4.0 -- doesn't even accept the
const version.  I've seen some old PRs on this matter, but don't recall
what their resolution was.

> mem_fun(&instance_collection_base::pair_dump,
> instance_collection_base::null);

// prefers this:
template <class R, template <class> class P, class T, class A>
inline
mem_fun1_p_t<R, P, T, A>
mem_fun(R (T::*f)(A), const P<T>& null) {
        return mem_fun1_p_t<R, P, T, A>(f);
}

// over this:
template <class R, template <class> class P, class T, class A>
inline
const_mem_fun1_p_t<R, P, T, A>
mem_fun(R (T::*f)(A) const, const P<T>& null) {
        return const_mem_fun1_p_t<R, P, T, A>(f);
}


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24243

Reply via email to