dotnet/roslyn

Assert failures handling DynamicObjectCreationExpression in GetValEscape() and CheckValEscape()

Open

#67.518 geöffnet am 28. März 2023

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C# (4.257 Forks)batch import
Area-CompilersBughelp wanted

Repository-Metriken

Stars
 (20.414 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (256 gemergte PRs in 30 T)

Beschreibung

Version Used: release/dev17.4: https://github.com/dotnet/roslyn/commit/528676cdbf0bfcfdb9372dc57a047dd0edc6d4db main: https://github.com/dotnet/roslyn/commit/3dee0a96cd8b5478390c47ddb0545875bf6b4c18

Steps to Reproduce:

Compile with DEBUG build:

static class Program
{
    static void Main()
    {
        dynamic d = 0;
        R x = new R(d);
        R y;
        y = new R(default(R), d);
    }
}

readonly ref struct R
{
    public R(int i) { }
    public R(R r, int i) { }
}

Expected Behavior: (8,19): error CS1978: Cannot use an expression of type 'R' as an argument to a dynamically dispatched operation.

Actual Behavior: Assert failures with message "DynamicObjectCreationExpression expression of R type" in GetValEscape() and CheckValEscape().

(8,19): error CS1978: Cannot use an expression of type 'R' as an argument to a dynamically dispatched operation. (8,13): error CS8751: Internal error in the C# compiler.

Contributor Guide