New package behaviour in 2.067

Namespace via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Mar 10 16:17:01 PDT 2015


I'm unsure, but I think this code should work:

----
module A.B.Foo;

import core.stdc.stdio : printf;

struct Foo {
    package(A) void foo() {
        printf("Hallo\n");
    }
}

package(A) void bar() {
    printf("Hallo\n");
}
----

and

----
module A.C.Bar;

import A.B.Foo;

void main() {
    Foo f;
    f.foo();
    bar();
}
----

The call of bar() works, but f.foo() triggers the error:
Error: struct A.B.Foo.Foo member foo is not accessible

Is this intended?


More information about the Digitalmars-d-learn mailing list