H
huili80
Code is as follows. It's legal c++ code, however doesn't compile with g++4.3.
Would really appreciate if anyone has a workaround!! Thanks!
-----------------------------------------------
template < typename T > T& obj();
template < typename T, typename=typeof(obj<T>().memfun()) >
struct test {};
template < typename T > test<T> f(int){}
template <typename> char f(...){}
struct X
{
void memfun(int){};
};
int main()
{
f<X>(0);
}
Would really appreciate if anyone has a workaround!! Thanks!
-----------------------------------------------
template < typename T > T& obj();
template < typename T, typename=typeof(obj<T>().memfun()) >
struct test {};
template < typename T > test<T> f(int){}
template <typename> char f(...){}
struct X
{
void memfun(int){};
};
int main()
{
f<X>(0);
}