> In the second line `flags` is not storing an OR combination of enum constants.

```D
enum allFlags = (){auto ret = T.init; foreach(v; EnumMembers!T) ret |= v; return ret;}();

Flags opUnary(string op)() @safe pure nothrow
if (op == "~")
{
    return Flags(allFlags & ~mValue);
}
```