Skip to content

C# Breaking change diagnosing constraint on static type as type arg in dynamic invocation #511

@gafter

Description

@gafter

While fixing #345, I discovered that we had a breaking change. The following code passes the native compiler but fails to compile in Roslyn.

static class S {}
class C
{
    static unsafe void M()
    {
        dynamic d1 = 123;
        d1.N<S>(); // The dev11 compiler does not diagnose this
    }
    static void Main() {}
}

Although the language spec requires a diagnostic here, perhaps Roslyn should also let this pass.

Whichever we do, this should be documented in the compiler spec.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions