Skip to content

Lvalue pointer dereference expressions fail to parse correctly #363

@danzat

Description

@danzat

The following:

*ptr = v;

Results in:

compilation_unit [0, 0] - [1, 0]
  global_statement [0, 0] - [0, 9]
    expression_statement [0, 0] - [0, 9]
      assignment_expression [0, 0] - [0, 8]
        left: prefix_unary_expression [0, 0] - [0, 4]
          identifier [0, 1] - [0, 4]
        right: identifier [0, 7] - [0, 8]

Whereas:

*(ptr + 1) = v;

Causes a parsing error:

compilation_unit [0, 0] - [1, 0]
  ERROR [0, 0] - [0, 15]
    parenthesized_expression [0, 1] - [0, 10]
      binary_expression [0, 2] - [0, 9]
        left: identifier [0, 2] - [0, 5]
        right: integer_literal [0, 8] - [0, 9]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions