This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Bug in use of base class constructor in inherited class ?
> This is not a bug and here is why:
> obj2(int a) { obj(a); } // overloaded constructor
>
> what this really is obj a; and not calling of the constructor.
> try this instead:
> obj2(int a): obj (a) {}
Thanks.
But I am trying to find why the compiler is treating them different.
While both
obj2(int a, int b) { obj(a, b); }
and
obj2(int a, int b): obj(a, b) {}
are being accepted by the compiler, only the 2nd one of
obj2(int a) { obj(a); }
and
obj2(int a): obj(a) {}
is accepted.
>
>
> Thanks,
> Andrew Pinski