TITLE: Amusing infinite loop bug PROBLEM: dls@gwd.dsto.gov.au (David Silver), 16 Sep 93 [ Can you spot the infinite recursion in the following program (without looking ahead at the answer? -adc ] One of the guys in our project team experienced a little finger trouble and managed to come up with this. When run, the program never terminates. class Base { public: Base() {} virtual void func() { /* do something */ } }; class Derived : public Base { public: Derived() {} virtual void func() { Base:func(); /* do something else */ } }; main() { Derived d; d.func(); // Never returns! } RESPONSE: grumpy@cbnewse.cb.att.com (Paul J Lucas) Of course, the quality of the implementation will dictate whether the user is warned about the unused label Base. Base: in that context is a label. Just as in C, labels are in a unique scope, hence there is no problem with having Base as a class and Base as a label.