Skip to content

Struct ': this()' initializers should not have definite assignment errors #58790

@RikkiGibson

Description

@RikkiGibson

Started poking at this scenario a bit and I observed what I think is a bug. SharpLab

public struct S
{
    int x = 1;
    int y;

    // should be allowed
    // perhaps `: this()` should be 'this = default;'
    // then run field initializers
    public S(int y) : this()
    {
    }
}

Tagging @cston

Originally posted by @RikkiGibson in dotnet/csharplang#5552 (comment)

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions