3

I have problem in function foo of class T. I think, GCC didn't resolve of type item and it think that "item.foo<0>()" is logical expression.

Why compiler is check expression before resolve types.

MSVC work good on windows.

template<class TType>
class A
{
public:
    template<int TNum>
    void foo()
    {}
};


template<class TType>
class T
{
public:
    void boo()
    {
        A<TType> item;
        item.foo<0>(); // error: expected primary-expression before ‘)’ token
    }
    void foo()
    {
        A<int> item;
        item.foo<0>(); // OK!
    }
};

0 Answers0