Skip to content

shift example in specifications with enum type not working #3288

@apinski-cavium

Description

@apinski-cavium

Take:

enum bit<8> E {
   a = 5
}

bit<16> func(in bit<4> l)
{
  return 16w11 << E.a;
}

Which is exactly the example from the specification (https://github.com/p4lang/p4-spec/blob/main/p4-16/spec/P4-16-spec.mdk#L3802) produces:

shift.p4(8): [--Werror=expected] error: E.a: expected an integer value
  return 16w11 << E.a;
                  ^^^

Metadata

Metadata

Assignees

Labels

fixedThis topic is considered to be fixed.

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions