[Bug c++/20578] New: Problem with templates
mah at systematic dot dk
gcc-bugzilla@gcc.gnu.org
Mon Mar 21 15:30:00 GMT 2005
The following C++ code does not compile, which I believe it should (It
compiles on gcc 1.1.1 and Microsoft's VS.NET):
--------Code start--------
template <class T>
class A {
protected:
int a;
};
template <class T>
class B: public A<T> {
public:
void f() { a = 5; }
};
--------Code end--------
I get the following error:
test.cpp: In member function `void B<T>::f()':
test.cpp:10: error: `a' undeclared (first use this function)
test.cpp:10: error: (Each undeclared identifier is reported only once for each
function it appears in.)
asterix:components/mde> /pack/gcc/3.4.3/bin/g++ test.cpptest.cpp: In member
function `void B<T>::f()':
test.cpp:10: error: `a' undeclared (first use this function)
test.cpp:10: error: (Each undeclared identifier is reported only once for each
function it appears in.)
--
Summary: Problem with templates
Product: gcc
Version: 3.4.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: mah at systematic dot dk
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20578
More information about the Gcc-bugs
mailing list