Describing enum literals in terms of other enum literals

In c++ it is possible to write such an enum

enum class Enum { 
    A = 1 << 0,
    B = 1 << 1,
    AB = A | B

I was not able to do this in zig. The error is error: invalid operands to binary expression: ‘(enum literal)’ and ‘(enum literal)’
One workaround is:

const A = 1 << 0;
const B = 1 << 1;

pub const Enum = enum {
    A = A,
    B = B,
    AB = A | B,

Is there a shorter way?

EDIT: I saw some suggestions to use a packed struct with bool fields to represent flags instead. I think that might often work for me.

I don’t believe there is a “shorter” way of doing this (even trying @enumToInt(@This().A) | @enumToInt(@This().B) fails because the enum “depends on itself”) but IMHO it should be allowed.

Depending on your use case, you might want to use a packed struct to represent a bitmask.
Here’s an example from the code generated by vulkan-zig:

pub const QueueFlags = packed struct {
    graphics_bit: bool align(@alignOf(Flags)) = false,
    compute_bit: bool = false,
    transfer_bit: bool = false,
    sparse_binding_bit: bool = false,
    protected_bit: bool = false,
    _reserved_bit_5: bool = false,
    _reserved_bit_6: bool = false,

The packed struct approach doesn’t look bad. But as far as I can tell, there is no easy way of comparing against constants?
You can’t write

const flags: QueueFlags{.transfer_bit = true};
if (flags == .{.transfer_bit = false, .protected_but = true}) {} 

The example is not so good perhaps, but I sometimes like to give a name to a specific flag configuration and compare against that.