Skip to content

[BUG] Function expression not parsed as index argument #415

Closed
@JohelEGP

Description

@JohelEGP

Title: Function expression not parsed as index argument.

Minimal reproducer (https://cpp2.godbolt.org/z/zfhqKhGWv):

t: type = {
  operator[]: (this, f) = { }
}
main: () -> int = {
  (x := t()) {
    x[:() -> _ = 0];
  }
}
    x[:() -> _ = 0;];

Commands:

cppfront -clean-cpp1 main.cpp2

Expected result:

Same as using these:

    x[(:() -> _ = 0)];
    x[(:() -> _ = 0;)];

Actual result and error:

main.cpp2(6,18): error: unexpected text - [ is not properly matched by ] (at '0')
main.cpp2(6,19): error: unexpected text - [ is not properly matched by ] (at ';')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions