http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48113
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-14
18:01:51 UTC ---
Doh, yes I got carried away reducing it and made it no longer a template
function, so of course SFINAE doesn't apply - sorry!
Should it apply in the case below?
template<typename T> T declval();
struct tuple { };
struct F1
{
void operator()(tuple);
};
typedef void (*F2)(tuple);
template<typename F, typename T>
struct Bind
{
template<typename A, typename R = decltype( F()(declval<T&>()) )>
R f(A);
template<typename A, typename R = decltype( F()(declval<volatile T&>()) )>
R f(A) volatile;
};
int main()
{
Bind<F1, tuple>().f(0); // OK
Bind<F2, tuple>().f(0); // ERROR
}
Currently Bind::f() volatile gives an error during overload resolution but the
other overload doesn't. Will your fix make both fail?