The following code compiles fine under Visual C++ 2010, but not under GCC 4.6 from the Android NDK r8b.
template<typename A>
struct foo
{
template<typename B>
B method()
{
return B();
}
};
template<typename A>
struct bar
{
bar()
{
f_.method<int>(); // error here
}
private:
foo<A> f_;
};
The error GCC gives is
error : expected primary-expression before 'int'
error : expected ';' before 'int'
for the marked line. For the life of me I can't figure out whats wrong.