Problem with 'template' as a qualifier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux