Skip to content

ref parameters to ref struct types should be scoped ref by default #62691

@cston

Description

@cston

ref parameters to ref struct types should be scoped ref by default.

No errors should be reported for the following:

ref struct R
{
    public ref int F;
    public R(ref int i) { F = ref i; }
}

class Program
{
    static ref R F()
    {
        int i = 42;
        var r = new R(ref i);
        return ref ReturnRef(ref r); // ok
    }
    
    static ref R ReturnRef(ref R r) => throw null;
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions