www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - private members through mixins broken

reply Mike Parker <aldacron71 yahoo.com> writes:
******************************
module mymodule;

template foo()
{
    private int x;
}

class MyClass
{
    mixin foo;
}

void main()
{
    MyClass c;
    c.x = 1;
}
******************************


Compilation results in the following error:
   class mymodule.MyClass.foo!() foo_.x is private

Shouldn't x still be accessible within the same module just as normal 
private members? The same error is produced with structs as well.

dmd 0.121
Apr 24 2005
parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Mike Parker schrieb am Mon, 25 Apr 2005 15:04:59 +0900:
 ******************************
 module mymodule;

 template foo()
 {
     private int x;
 }

 class MyClass
 {
     mixin foo;
 }

 void main()
 {
     MyClass c;
     c.x = 1;
 }
 ******************************


 Compilation results in the following error:
    class mymodule.MyClass.foo!() foo_.x is private

 Shouldn't x still be accessible within the same module just as normal 
 private members? The same error is produced with structs as well.

 dmd 0.121

Added to DStress as http://dstress.kuehne.cn/run/private_07.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCbykO3w+/yD4P9tIRAtHOAJ4hi5ZL/ryj+53p+jqd0M1M/HpHqACgli0l XiIW3jlqjB9H25tZqIGVX3w= =BGE0 -----END PGP SIGNATURE-----
Apr 26 2005