The compiler currently does not support optimizing things like this:
enum AB { A = 1, B = 2 }
enum CD { C = 3, D = 4 }
enum ABCD { AB(AB), CD(CD) }
It's an obvious wish, but needs implementation work to be done.
The compiler, as of today, only supports single-value niches, but optimizing ABCD would need it to support knowing that ABCD::AB can be encoded as 1 or 2.