gcc: Template class child can't directly access parent fields
OK this has to be a bug in gcc 4.3. At the very least the error reporting should be considered a bug since it starts spewing unreadable characters.
Normally a child class can access the fields of a parent class as though they were her own. Not so in gcc 4.3 if the class is templated. You need to use the this pointer indirection to get at them.
This compiles and runs fine in MS Vis. studio. On linux, for gcc 4.3.0, it gives this 'informative' error
int f ; // a field
class B : public A<i>
f = 2 ;
int main(int argc, char *argv)
B<0> bc ;
std::cout << bc.f << std::endl ;
child.cpp: In constructor â:
child.cpp:15: error: â was not declared in this scope
In the constructor if you replace f by this->f it will compile.