Hi, I'm having with a rather obscure template instantiation which uses
the keyword 'template' as a qualifier.
After some simplification, it boils down to:
struct A
{
template <class T> struct B
{
typedef T type;
};
};
template <class T> void f()
{
f<typename T::template B<int>::type>();
}
int main()
{
f<A>();
}
g++-4.3.0 compilation fails with the following error messages:
g++-4.3.0 test.cpp -o test
test.cpp: In function 'void f() [with T = int]':
test.cpp:11: instantiated from 'void f() [with T = A]'
test.cpp:16: instantiated from here
test.cpp:11: error: 'int' is not a class, struct, or union type
But if we change
f<typename T::template B<int>::type>()
to
f<typename T::template B<A>::type>()
it compiles fine.
Why is it so? Is the original case an indication of a g++ bug or this is
a dark corner case of the language?
Regards,
Rodolfo Lima.