www.digitalmars.com         C & C++   DMDScript  

D.gnu - scope of auto generated ctor

reply "shinichiro.h" <s31552 mail.ecc.u-tokyo.ac.jp> writes:
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
Nov 01 2004
next sibling parent Thomas Kuehne <thomas-dloop kuehne.cn> writes:
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
Nov 01 2004
prev sibling parent David Friedman <d3rdclsmail_a_ _t_earthlink_d_._t_net> writes:
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
Nov 15 2004