private method callable from other module

2022-10-08 Thread kdevel via Digitalmars-d-learn
Is this a known bug? ``` // file b.d import std.stdio; struct S { private void foo (ubyte c) { writeln (__PRETTY_FUNCTION__); } void foo () { } } ``` ```a.d // file a.d unittest { import b; auto s = S (); s.foo ('x'); } ``` ``` $ dmd -g -unittest -main a.d b.d

Re: private method callable from other module

2022-10-08 Thread kdevel via Digitalmars-d-learn
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

Re: private method callable from other module

2022-10-08 Thread kdevel via Digitalmars-d-learn
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

Re: private method callable from other module

2022-10-08 Thread kdevel via Digitalmars-d-learn
On Saturday, 8 October 2022 at 10:05:33 UTC, kdevel wrote: ``` $ 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 ``` `b.d` is

Re: private method callable from other module

2022-10-08 Thread kdevel via Digitalmars-d-learn
On Saturday, 8 October 2022 at 15:56:01 UTC, Jack Pope wrote: Altering the definition sequence in b.d to have the private version second has the desired result. Otherwise, when following private foo, it looks like public foo gets adopted as a public constructor. The same for classes. Created

Explicit cast to @system?

2022-10-08 Thread Anonymouse via Digitalmars-d-learn
I have some nested templated code that takes function pointers. In many cases I pass it functions of identical signatures, except some are `@safe` and others are `@system`. In those cases the templates end up getting instantiated twice. I don't care about the `@safe`-ness and I'd really like

Re: cannot gdb LDC build binary: Segmentation fault

2022-10-08 Thread Sergey via Digitalmars-d-learn
On Friday, 7 October 2022 at 04:40:34 UTC, mw wrote: Hi, I have a LDC (1.30.0) built binary on Ubuntu 18.04.5 LTS x86_64, the program core dumps somewhere, so I want to debug Did you try to use GDC? As gdb more gcc tool And for llvm should be lldb..

Re: private method callable from other module

2022-10-08 Thread Jack Pope via Digitalmars-d-learn
Altering the definition sequence in b.d to have the private version second has the desired result. Otherwise, when following private foo, it looks like public foo gets adopted as a public constructor. The same for classes.

Re: Replacing tango.text.Ascii.isearch

2022-10-08 Thread Siarhei Siamashka via Digitalmars-d-learn
On Saturday, 8 October 2022 at 01:07:46 UTC, rassoc wrote: On 10/8/22 00:50, Siarhei Siamashka via Digitalmars-d-learn wrote: On Friday, 7 October 2022 at 12:19:59 UTC, bachmeier wrote: python -c "print(('a' * 49 + 'b') * 2)" > test.lst That's generating a file with a single line: $> wc

Re: cannot gdb LDC build binary: Segmentation fault

2022-10-08 Thread user1234 via Digitalmars-d-learn
On Friday, 7 October 2022 at 04:40:34 UTC, mw wrote: Hi, I have a LDC (1.30.0) built binary on Ubuntu 18.04.5 LTS x86_64, the program core dumps somewhere, so I want to debug it. However under gdb, the program fails as soon as I start it: [...] Try the non-stop mode maybe :

Re: cannot gdb LDC build binary: Segmentation fault

2022-10-08 Thread Siarhei Siamashka via Digitalmars-d-learn
On Friday, 7 October 2022 at 04:40:34 UTC, mw wrote: Has anyone experienced such problem before? any suggestions where I should look at? If you are compiling your program with "-release" command line option, then arrays bounds checking is not done in the @system code at all (which is all of