1

This is an example of the code that is causing the problem:

template <typename T>
class Test
{
public:
    enum class X
    {
        ABC
    };

    X GetX() const;

private:
    X m_x;
};

template <typename T>
Test<T>::X Test<T>::GetX() const // syntax error: identifier 'X'
{
    return m_x;
}

I am sure I am missing something simple here but I just can't seem to figure it out. The commented line above shows the error I am getting. I am using VS2015.

So why is this a syntax error?

-- EDIT --

Regarding the duplicate question. I don't think it is a duplicate, it is actually the answer to this question. To have found that, rather than posting a question, I would have had to know the answer to the question.

0 Answers0