dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.06k stars 4.04k forks source link

Consider allowing native integer types as enum underlying types #44110

Open cston opened 4 years ago

cston commented 4 years ago

From LDM-2019-10-23:

For use as an enum underlying type, we think nint/nuint should be allowed as long as it's not too much implementation work. The legal values would be the same as the valid constants for the underlying.

gafter commented 4 years ago

The current spec at https://github.com/dotnet/csharplang/blob/master/proposals/native-integers.md says it is permitted.

cston commented 4 years ago

Moved to Compiler.Next for now.

@tannergooding, @JeremyKuhne, please let us know if this is a blocking issue.

tannergooding commented 4 years ago

Nothing known to be blocking on my end.

naine commented 4 years ago

What's the status of this issue?

Given this isn't going to make 16.8, will it be removed from the C# 9.0 spec and implemented in a future langversion?

jaredpar commented 1 year ago

If we move forward with this we should consider, even if we don't implement, all the types enum support as base types in the runtime: nint, nuint, float, double and char.

Note: bool used to be supported but was removed in .NET 8.