This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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;
}






Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]