static union Answers { int answer(); void answer(); string answer(); } alias Container = Answers; enum NotVoid(alias F) = !is(ReturnType!(F) == void); enum functions = functionsOf!(Container, "Container", NotVoid); static assert(functions.length == 2); static assert( functions[0].mixture == q{@system %s.ReturnType!(__traits(getOverloads, Container, "answer")[0]) answer();} .format(__MODULE__)); static assert(functions[0].overloadIndex == 0); static assert( functions[1].mixture == q{@system %s.ReturnType!(__traits(getOverloads, Container, "answer")[2]) answer();} .format(__MODULE__)); static assert(functions[1].overloadIndex == 2);