I have pretty simple code in my library:
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 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?