dotnet / dotnet/roslyn

Incorrect CS8911 for 'global using unsafe' with pointer type

Open
#77,389 3 comments 0 reactions 1 assignee Claimed by @333fred View on GitHub
Area-Compilers Feature - Function Pointers
Dominant language
C#
Stars
20.7k
Forks
4.3k
PR merge metrics
PR metrics pending

Description

**Version Used**: 4.13.0-3.25105.4 (400efa2d) (and tested both VS 17.13.0 and VS 17.14 P1)

**Steps to Reproduce**:

1. Checkout https://github.com/microsoft/CsWinRT/commit/443d0c47f1b6e6a16772035bc285b84e69ed4a1a
2. Open `src\cswinrt.sln`
3. Build `WinRT.Runtime2.csproj`

Ignore errors from other projects, just build this one project (it doesn't reference anything else).

**Diagnostic Id**: CS8911

**Expected Behavior**:

The code should compile just fine.

**Actual Behavior**:

The compiler produces an incorrect error:

![Image](https://github.com/user-attachments/assets/9070d73c-0927-46a9-88f7-2d64ae0f0d67)

cc. @CyrusNajmabadi

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.