Thread overview
scope of auto generated ctor
Nov 01, 2004
shinichiro.h
Nov 01, 2004
Thomas Kuehne
Nov 15, 2004
David Friedman
November 01, 2004
Hi,

I found a small bug in gdc.

// auto_gen_ctor.d

class Base {
    this() {}
}
class Derived : Base {
private:
    // constructor will be generate here, so it is private.
}

If I compile the above code and check symbol in the following way:

gdc -c auto_gen_ctor.d
nm auto_gen_ctor.o | grep _ctor

I get the following result:

00000000 T _D8override4Base5_ctorFZC8override4Base
00000023 t _D8override7Derived5_ctorFZC8override7Derived

I think 00000023 should be 'T' not 't'. This means that the constructor of Derived is private. So I cannot link the program if I use the constructor of Derived in another file.

------------------
 shinichiro.h
November 01, 2004
shinichiro.h schrieb am Montag, 1. November 2004 09:38:
> Hi,
> 
> I found a small bug in gdc.
> 
> // auto_gen_ctor.d
> 
> class Base {
>     this() {}
> }
> class Derived : Base {
> private:
>     // constructor will be generate here, so it is private.
> }

added to dstress as: svn://svn.kuehne.cn/dstress/run/constructor_04.d

Thomas
November 15, 2004
shinichiro.h wrote:
> Hi,
> 
> I found a small bug in gdc.
> 
> // auto_gen_ctor.d
> 
> class Base {
>     this() {}
> }
> class Derived : Base {
> private:
>     // constructor will be generate here, so it is private.
> }
> 
> If I compile the above code and check symbol in the following way:
> 
> gdc -c auto_gen_ctor.d
> nm auto_gen_ctor.o | grep _ctor
> 
> I get the following result:
> 
> 00000000 T _D8override4Base5_ctorFZC8override4Base
> 00000023 t _D8override7Derived5_ctorFZC8override7Derived
> 
> I think 00000023 should be 'T' not 't'. This means that the
> constructor of Derived is private. So I cannot link the program if I
> use the constructor of Derived in another file.
> 
> ------------------
>  shinichiro.h

Thanks.  I'm posting this in D.bugs since it will also affect DMD 0.106.

David