Thread overview
Bug or Feature?
Sep 30, 2011
Gor Gyolchanyan
Sep 30, 2011
Kagamin
September 30, 2011
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 = new Bar;
}


dmd a.d b.d


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



-- 
Mathias Baumann
Research and Development

sociomantic labs GmbH
Münzstraße 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
September 30, 2011
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
> {
>        private struct Test
>        {
>        }
> }
>
>
> module b:
>
> import a;
>
> class Bar : TClass!(Foo.Test)
> {
> }
>
>
> void main()
> {
>        auto var = new Bar;
> }
>
>
> dmd a.d b.d
>
>
> This works for me, no compilation errors. Why can module b access Foo.Test for the template parameter?
>
>
>
> --
> Mathias Baumann
> Research and Development
>
> sociomantic labs GmbH
> Münzstraße 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
>
September 30, 2011
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.