Skip to content

Roslyn fails to diagnose static type as type argument, reports "Failed to emit module". #345

@gafter

Description

@gafter

The following program should fail to compile (a static type is used as a type argument), but Roslyn does not diagnose the problem during binding and fails in emit with a useless diagnostic.

error CS7038: Failed to emit module 'CSharpSample1'.
using System;
using System.Linq;
using System.Runtime.CompilerServices;

class Program
{
    static void Main(string[] args)
    {
        M(default(C));
    }
    public static void M<T>(T t)
    {
    }
}

static class C
{
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions