Skip to content

Document that calling a method on a struct rvalue is allowed #4234

Open
@ntrel

Description

@ntrel

Even though the hidden this parameter is ref.

struct S
{
    int i;
    int f() => ++i;
}

void main()
{
    //S().i++; // cannot modify, `S().i` is not an lvalue
    assert(S().f() == 1); // OK
}

PR incoming.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions