This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Templates Problem comes from gcc
- To: gcc at gcc dot gnu dot org
- Subject: Templates Problem comes from gcc
- From: Pascal Francq <pfrancq at ulb dot ac dot be>
- Date: Wed, 23 Feb 2000 15:12:00 +0100
- Organization: Université Libre de Bruxelles
The bug that I reported in the last mail has the following origin:
// parent class declaration
template<class T> class foo1
{
public:
unsigned int nb;
};
// child class declaration
template<class T> class foo2 : public foo1
{
public:
void init(void);
}
// global variable
unsigned int nb;
// child class definition
template<class T> void foo2<T>:init(void)
{
for(unsigned i=nb+1;--i;)
{
doSomething();
}
}
The gcc compiler use in the init function the global variable nb and the
variable nb inherits from foo1.
I think this is an error of gcc.
--
Ir. Pascal Francq
Researcher
Université Libre de Bruxelles
Faculty of Applied Mechanics
Avenue F.D. Roosevelt, 50
CP 165/41
B-1050 Brussels
BELGIUM
Tel. +32-2-650 47 65
Fax +32-2-650 27 10