Bug report: :: scope resolution for base class constructor not recognized

Johan Cockx cockx@imec.be
Thu Jan 21 01:19:00 GMT 1999


/*
g++ does not recognize :: scope resolution in base class constructor
of nested class.

B::A is derived from ::A,  and I want to explicitly call a ::A constructor
from the B::A constructor,  but g++ finds a parse error.

% g++ t.C
t.C: In method `B::A::A()':
t.C:24: parse error before `::'
t.C:24: parse error at end of saved function text

*/

class A {
public:
  A( int ) {}
};

class B {
  class A: public ::A {
  public:
    A() : ::A(5) {}
    // Workaround:  replace previous line by
    // typedef ::A global_A;  A() : global_A(5) {}
  };
};

--
Johan Cockx                    VLSI System Design Methodologies
Senior Research Engineer       IMEC
Tel.: +32(16)281242            Kapeldreef 75
Fax.: +32(16)281515            B-3001 Leuven
mailto:cockx@imec.be           Belgium






More information about the Gcc-bugs mailing list