the following code fails to compile with gcc-3.4.6, gcc-4.1.3 and gcc-4.2.1

test.cpp: In member function `point<3, T>& point<3, T>::operator=(const
point<3, T>&)':
test.cpp:25: error: `x' was not declared in this scope


template<int c, class T>
class point
{
};

template<class T>
class point<1, T>
{
public:
        T x;
        point &operator = (point const &src)
        {
                x = src.x;
                return *this;
        }
};

template<class T>
class point<3, T> : public point<2, T>
{
public:
        T y;
        point &operator = (point const &src)      
        {
                x = src.x;
                y = src.y;
                return *this;
        }
};


-- 
           Summary: problem with templates and inheritence
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: isenbaev at gmail dot com


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

Reply via email to