This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
deriving template classes: gcc 3.4 complains
- From: Joachim Schoeberl <js at jku dot at>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 01 Oct 2003 19:33:20 +0200
- Subject: deriving template classes: gcc 3.4 complains
The piece of C++ code below compiles with gcc 3.3,
but gcc version 3.4 20030924 (experimental) complains:
test34.cpp: In constructor `derived<A>::derived(int)':
test34.cpp:14: error: `i' undeclared (first use this function)
test34.cpp:14: error: (Each undeclared identifier is reported only once
for each function it appears in.)
Is there something wrong with my code ?
thanks, Joachim
template <typename A>
class base
{
public:
int i;
};
template <typename A>
class derived : public base<A>
{
public:
derived (int ai)
{ i = ai; }
};
int main ()
{
derived<int> i(5);
return 0;
}