www.digitalmars.com Home | Search | C & C++ | D | DMDScript | News Groups | index | prev | next
Archives

D Programming
D
D.gnu
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript

D.gnu - scope of auto generated ctor

↑ ↓ ← "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
→ 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
→ 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