Skip to content

Disallow private copy constructor on unsealed record type? #45012

@jcouv

Description

@jcouv

This issue link is referenced in source.

Such copy constructors effectively prevent inheritance.

public record C(int i)
{
    private C(C c) => throw null;
}

There is a similar scenario with internal, but it's possible that the derived type is getting IVT for access:

public record C(int i)
{
    internal C(C c) => throw null;
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions