www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Bug or Feature?

reply "Mathias Laurenz Baumann" <mathias.baumann sociomantic.com> writes:
G'day

I was wondering whether the following is a bug in dmd or a feature in D:=


module a:

class TClass ( T )
{
}

class Foo
{
	private struct Test
	{		=

	}
}


module b:

import a;

class Bar : TClass!(Foo.Test)
{
}


void main()
{
	auto var =3D new Bar;
}


dmd a.d b.d


This works for me, no compilation errors. Why can module b access Foo.Te=
st  =

for the template parameter?



-- =

Mathias Baumann
Research and Development

sociomantic labs GmbH
M=C3=BCnzstra=C3=9Fe 19
10178 BERLIN
DEUTSCHLAND

http://www.sociomantic.com

Fon:           +49 (0)30 5015 4701
Fax:           +49 (0)30 2403 6715
Skype:         Mathias Baumann (m4renz)
-----------------------------------------------------------

sociomantic labs GmbH, Location: Berlin
Commercial Register - AG Charlottenburg: HRB 121302 B
VAT No. - USt-ID: DE 266262100
Managing Directors: Thomas Nicolai, Thomas Brandhoff
Sep 30 2011
next sibling parent Gor Gyolchanyan <gor.f.gyolchanyan gmail.com> writes:
It's a bug. Private members are not supposed to be visible in other modules=
.
If it isn't already filed in bugzilla, it should.
We'd much appreciate if you filed a bug for the bugs you find:
http://d.puremagic.com/issues/.

On Fri, Sep 30, 2011 at 5:43 PM, Mathias Laurenz Baumann
<mathias.baumann sociomantic.com> wrote:
 G'day

 I was wondering whether the following is a bug in dmd or a feature in D:

 module a:

 class TClass ( T )
 {
 }

 class Foo
 {
 =A0 =A0 =A0 =A0private struct Test
 =A0 =A0 =A0 =A0{
 =A0 =A0 =A0 =A0}
 }


 module b:

 import a;

 class Bar : TClass!(Foo.Test)
 {
 }


 void main()
 {
 =A0 =A0 =A0 =A0auto var =3D new Bar;
 }


 dmd a.d b.d


 This works for me, no compilation errors. Why can module b access Foo.Tes=
t
 for the template parameter?



 --
 Mathias Baumann
 Research and Development

 sociomantic labs GmbH
 M=FCnzstra=DFe 19
 10178 BERLIN
 DEUTSCHLAND

 http://www.sociomantic.com

 Fon: =A0 =A0 =A0 =A0 =A0 +49 (0)30 5015 4701
 Fax: =A0 =A0 =A0 =A0 =A0 +49 (0)30 2403 6715
 Skype: =A0 =A0 =A0 =A0 Mathias Baumann (m4renz)
 -----------------------------------------------------------

 sociomantic labs GmbH, Location: Berlin
 Commercial Register - AG Charlottenburg: HRB 121302 B
 VAT No. - USt-ID: DE 266262100
 Managing Directors: Thomas Nicolai, Thomas Brandhoff
Sep 30 2011
prev sibling parent Kagamin <spam here.lot> writes:
Mathias Laurenz Baumann Wrote:

 This works for me, no compilation errors. Why can module b access Foo.Test  
 for the template parameter?
known bug: access attributes not yet applied to user defined types.
Sep 30 2011