Skip to content

CS8751 (internal compiler error) attempting to call function pointer, that returns ref struct #49760

@lostmsu

Description

@lostmsu

Version Used: .NET 5.0 release; also 3bc4ff8

Steps to Reproduce:

unsafe ref struct BorrowedReference {
    static readonly delegate* unmanaged[Cdecl]<BorrowedReference> test;
    static BorrowedReference Test() => test();
    readonly int pointer;
}

SharpLab link

Expected Behavior:
Should compile

Actual Behavior:

error CS8751: Internal error in the C# compiler.

in Test() => test();

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions