Accessing derived members of template classes doesn't seem to work properly:

template <class T> class Poly
{
protected:
        int value;
};
template <class T> class Quad : public Poly<T>
{
public:
        int getVal() const { return value; }
};

return value; will cause the following error:
test.cpp: In member function 'int Quad<T>::getVal() const':
test.cpp:10: error: 'value' was not declared in this scope

using return this->value; or return Poly<t>::value; however works...


-- 
           Summary: scope bug in derived template classes
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gcc at reactsoft dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27157

Reply via email to