Skip to content

C enum name should not allow namespaces #15483

Open
@FnControlOption

Description

The name of a C struct/union is only allowed to be a single token like S or U. However, a C enum is unexpectedly allowed to be a path like ::E or E1::E2. This is because the parse_enum_def method is reused when parsing a lib. A likely simple fix would be to add a parameter to parse_enum_def on whether the name should be a const token or a path node

lib L
  struct S
    i : Int32
  end

  union U
    i : Int32
  end

  enum ::E
    A
  end

  enum E1::E2
    B
  end
end

p L::S
p L::U
p E::A
p L::E1::E2::B

Metadata

Assignees

No one assigned

    Labels

    kind:bugA bug in the code. Does not apply to documentation, specs, etc.topic:compiler:parser

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions