Skip to content

Syntax error parsing field initializer with ref expression #64720

@cston

Description

@cston

Compile:

ref struct R
{
    ref int _f = ref F(); // error CS1525: Invalid expression term 'ref'

    public R()
    {
    }

    static ref int F() => throw null;
}

Expected: no errors

Actual:

(3,18): error CS1525: Invalid expression term 'ref'

See related #64725.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions