Skip to content
GitLab
  • Menu
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • sac2c sac2c
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 394
    • Issues 394
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 17
    • Merge requests 17
  • Deployments
    • Deployments
    • Releases
  • Wiki
    • Wiki
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • sac-group
  • sac2csac2c
  • Merge requests
  • !299

generate scalar select for records

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Jordy Aaldering requested to merge 2408-record-scalar-select into develop Apr 17, 2024
  • Overview 3
  • Commits 8
  • Changes 6

Closes #2408 (closed)

Using a scalar selection y[0] instead of y[[0]] produces an error.

struct Foo { int x; };

int main()
{
    y = [Foo{0}, Foo{1}, Foo{2}];
    z = y[0];
    return z.x;
}
No matching definition found for the application of "_MAIN::sel" to arguments ( int{0}, _MAIN::_struct_Foo[3])

A function sel(int[.] idx, struct Foo[*] arr) is being generated, but we should also generate:

struct Foo[*]
sel(int idx, struct Foo[*] arr)
{
    return sel([idx], arr);
}
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: 2408-record-scalar-select