This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/34727] New: problem with templates and inheritence
- From: "isenbaev at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jan 2008 17:16:46 -0000
- Subject: [Bug c++/34727] New: problem with templates and inheritence
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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