This assert fails, because despite being empty, code is emitted to memcmp the structs. While this example is clearly asking for it, this can happen naturally when passing such structs around, as the padding does not have to be preserved.
The simple solution is to make empty structs always compare as equal.
import core.stdc.string;
struct S
{
}
void main()
{
static assert(S.sizeof == 1);
S a;
S b;
memset(&a, 1, S.sizeof);
memset(&b, 2, S.sizeof);
assert(a == b);
}