On Tuesday, 14 June 2022 at 23:56:58 UTC, Andrey Zherikov wrote:
On Tuesday, 14 June 2022 at 21:44:48 UTC, Dukc wrote:
No idea. The functions seems indeed to be exactly the same, so
I assume this is a DMD bug. It cannot be a bug in
`std.sumtype`, since that would trigger in both of the
templates.
This definitely triggers some bug in DMD because this `private
void printHelp ...` function is not really `private` as it's
called from [another
module](https://github.com/andrey-zherikov/argparse/blob/bug/source/argparse/internal.d#L786) and DMD doesn't catch this.
I tried to reproduce it but wasn't able (I guess it is some
interplay with the rest of your code):
```d
import std.sumtype;
alias CC = SumType!(AA,BB);
struct AA {}
struct BB
{
CC[] c;
}
private void ppp(T, Output)(auto ref Output output, in
CommandArguments!T cmd, in Config config)
{
auto cc = CC(AA()); // (1)
}
private void printHelp(T, Output)(auto ref Output output, in
CommandArguments!T cmd, in Config config)
{
auto cc = CC(AA()); // (2)
}
void printHelp(T, Output)(auto ref Output output, in Config
config)
{
ppp(output, CommandArguments!T(config), config);
printHelp(output, CommandArguments!T(config), config);
}
struct CommandArguments(T) {
T x;
}
struct Config {}
void main() {
string test;
Config config;
CommandArguments!int commandArguments;
printHelp!(int,string)(test,commandArguments,config);
}
```