Bug in dmd?

Andrey Zherikov andrey.zherikov at gmail.com
Tue Jun 14 13:39:12 UTC 2022


I have [pretty simple code in my 
library](https://github.com/andrey-zherikov/argparse/blob/bug/source/argparse/help.d#L27-L47):
```d
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);
}
```

[Line (2) 
produces](https://github.com/andrey-zherikov/argparse/runs/6880350900?check_suite_focus=true#step:5:12) `undefined reference to '_D3std7sumtype__T7SumTypeTS8argparse4help2AATSQtQm2BBZQBl6__dtorMFNaNbNiNfZv'` (it demangles to `pure nothrow @nogc @safe void std.sumtype.SumType!(argparse.help.AA, argparse.help.BB).SumType.__dtor()`)

If I comment line (2) then everything is good (no link errors). 
Note that there is the same code at (1) which doesn't produce any 
error. Any idea what's going on?


More information about the Digitalmars-d-learn mailing list