Error compiling template function within class template

U

uvts_cvs

template <class T>
class foo
{

public:
template <class Tin>
T bar (Tin) {return T();}

};

class derived : public foo<derived>
{

};

Is this little chunk of code ISO C++ compliant?

Some compilers compile it successfully, while another tells me that
'derived' is undefined within the class template.
 
V

Victor Bazarov

template <class T>
class foo
{

public:
template <class Tin>
T bar (Tin) {return T();}

};

class derived : public foo<derived>
{

};

Is this little chunk of code ISO C++ compliant?

Some compilers compile it successfully, while another tells me that
'derived' is undefined within the class template.
This is not a chat room. You have to have patience in Usenet.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top