-
Notifications
You must be signed in to change notification settings - Fork 293
Closed
Description
The following code no longer compiles:
| private static int CountDefault(T[] arr) | |
| { | |
| int count = 0; | |
| foreach (T item in arr) | |
| { | |
| if (item == default) count++; | |
| } | |
| return count; | |
| } |
Compiler reports the following error:
corefx/System.Buffers/ArrayPoolTests.cs(44,21): error CS0019: Operator '==' cannot be applied to operands of type 'T' and 'default' [/Users/filipnavara/agent/_work/1/s/work/performance/src/benchmarks/micro/MicroBenchmarks.csproj]
This is caused by breaking change in the compiler (dotnet/roslyn#36492) that was previously leading to miscompiled code. Originally reported as dotnet/roslyn#38568, moving here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels