http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48113
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org
--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> 2011-03-14
16:22:44 UTC ---
Jason, could you take a look at this reduced testcase, which has no libstdc++
dependency?
template<typename T> T declval();
struct tuple { };
struct F1
{
void operator()(tuple);
};
typedef void (*F2)(tuple);
template<typename F, typename T>
struct Bind
{
decltype( F()(declval<T&>()) )
f();
decltype( F()(declval<volatile T&>()) )
f() volatile;
};
int main()
{
Bind<F1, tuple>().f(); // OK
Bind<F2, tuple>().f(); // ERROR
}
This shows that SFINAE removes the Bind::f() volatile overload if F is a
functor, but not if it's a function pointer. I can't see why it should be
different.
Is this a FE bug, or do I need to handle function pointers differently in
std::bind? Thanks