Re: Mixin template parameter overloading bug?

2025-06-14 Thread monkyyy via Digitalmars-d-learn
On Saturday, 14 June 2025 at 23:49:19 UTC, Steven Schveighoffer wrote: If I had to guess, I think the compiler is not able to exactly deduce what form your lambda should be instantiated with. I think it's picking the first form it sees. I think if anything, the error message is really weird.

Re: Pointer vs Ref

2025-06-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On Monday, 9 June 2025 at 07:24:41 UTC, confuzzled wrote: Hello community, Is it possible to accomplish the following using ref instead of pointers? If so, please share an example. ```d // Represents our Backtester engine struct Engine { // It STORES a pointer to its data source. This is

Re: Mixin template parameter overloading bug?

2025-06-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 14 June 2025 at 00:02:32 UTC, Andrey Zherikov wrote: The simplest code that shows the issue: ```d struct S{} template f(void function(S) F) {} template f(int function(S) F) {} mixin f!((_) {}); mixin f!((_) => 0); // Error: cannot return non-void from `void` function

Re: undefined reference to

2025-06-14 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 15/06/2025 5:42 AM, mitgedanken wrote: On Saturday, 14 June 2025 at 15:28:27 UTC, Richard (Rikki) Andrew Cattermole wrote: On 15/06/2025 3:25 AM, mitgedanken wrote: [...] You may be linking against it separately. The -i behavior only works for small executables, when the build commands (

Re: undefined reference to

2025-06-14 Thread mitgedanken via Digitalmars-d-learn
On Saturday, 14 June 2025 at 15:28:27 UTC, Richard (Rikki) Andrew Cattermole wrote: On 15/06/2025 3:25 AM, mitgedanken wrote: [...] You may be linking against it separately. The -i behavior only works for small executables, when the build commands (yes plural) get more complex its not going

Re: undefined reference to

2025-06-14 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 15/06/2025 3:25 AM, mitgedanken wrote: On Saturday, 14 June 2025 at 13:46:20 UTC, Steven Schveighoffer wrote: On Saturday, 14 June 2025 at 00:25:13 UTC, mitgedanken wrote: [...] You need to include all modules on the command line that you import, or use the -i switch. -Steve Oh, yes! I

Re: undefined reference to

2025-06-14 Thread mitgedanken via Digitalmars-d-learn
On Saturday, 14 June 2025 at 13:46:20 UTC, Steven Schveighoffer wrote: On Saturday, 14 June 2025 at 00:25:13 UTC, mitgedanken wrote: [...] You need to include all modules on the command line that you import, or use the -i switch. -Steve Oh, yes! I completely forgot about that. Why isn't tha

Re: undefined reference to

2025-06-14 Thread Steven Schveighoffer via Digitalmars-d-learn
On Saturday, 14 June 2025 at 00:25:13 UTC, mitgedanken wrote: I use ``dmd package.d -verrors=3 -debug -I"../.."``. I get ```sh Error: undefined reference to `std.container.array.Array!(minimal.token.token.Token).Array.empty() const` referenced from `const bool std.container.array.Array!

Re: Mixin template parameter overloading bug?

2025-06-14 Thread Andrey Zherikov via Digitalmars-d-learn
On Saturday, 14 June 2025 at 03:17:09 UTC, monkyyy wrote: ```d import std; mixin template f(int function(int) F){} mixin template f(void function(int) F){unittest{"void".writeln;}} //mixin f!((_){}); //FAILS mixin template g(void function(int) F){unittest{"void".writeln;}} mixin template