Skip to content

Allow parameterless constructors in record structs #52240

@jcouv

Description

@jcouv

[This issue is referenced in source]

When the "record structs" feature gets merged with the "parameterless struct constructor" feature, we may need to make some adjustments to record structs.

Some scenarios are interesting:

record struct S1(); // is this allowed?
_ = new S2(); // what is executed?
record struct S2(int I)
{
   int Field = M(I);
   static int M(int i) => i;
}
record struct S3
{
  int Field = 3; // is this allowed?
}
record struct S4()
{
  int Field = 3; // is this allowed?
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions