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
  • Issues
  • #2408
Closed
Open
Created Apr 17, 2024 by Jordy Aaldering@JordyAalderingDeveloper

Records missing overload for scalar selection

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);
}
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking