private method callable from other module

kdevel kdevel at vogtner.de
Sat Oct 8 10:05:33 UTC 2022


On Saturday, 8 October 2022 at 09:59:17 UTC, kdevel wrote:
> On Saturday, 8 October 2022 at 09:46:59 UTC, kdevel wrote:
>
>> ```
>> $ dmd -g -unittest -main a.d b.d
>> $ ./a
>> void b.S.foo(ubyte c)
>> 1 modules passed unittests
>> ```
>
>    2.086.1
>    a.d(5): Error: struct `b.S` member foo is not accessible
>
>    2.090.1
>    compiles

Interestingly (again with dmd v2.100.2) `-run` runs into a link 
error:

```
$ dmd -g -unittest -main -run a.d b.d
a.o: In function `_D1a16__unittest_L2_C1FZv':
(...)./a.d:5: undefined reference to `_D1b1S3fooMFhZv'
collect2: error: ld returned 1 exit status
Error: linker exited with status 1
```


More information about the Digitalmars-d-learn mailing list