Skip to content

Roslyn (like the native compiler) allows default(StaticType), array of static type #344

@gafter

Description

@gafter

The following program shows that the Roslyn compiler (like the native compiler) allows default(StaticType) and allows you to create an array of a static type too. All of these break with things that the C# specification mandates. I don't think this could be fixed because that would be a breaking change, though if anyone is doing this accidentally they'd probably like to know about it.

class Program
{
    static void Main(string[] args)
    {
        object o = default(C);
        object[] x = new [] { default(C) };
    }
}

static class C
{
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions