dotnet/roslyn

Conversion of a stackalloc expression

開放

#23,995 建立於 2018年1月2日

 (7 則留言) (1 個反應) (0 位負責人)C# (4,257 個分叉)batch import
Area-CompilersBugConcept-Diagnostic ClarityFeature - Readonly Referenceshelp wanted

倉庫指標

星標
 (20,414 顆星)
PR 合併指標
 (平均合併 6天 17小時) (30 天內合併 256 個 PR)

描述

Version Used: 2.6.0.62309 (d3f6b8e7)

Steps to Reproduce:

Compile following

using System;

unsafe class X
{
	public static void Main ()
	{
		int* stackSpan = (int*) stackalloc int[100];
	}
}

Expected Behavior:

C# 7.2 allows stackallow casts (don't really know why) but it now reports an odd error message when the casts are used with pre-7.2 only supported pointer types.

Actual Behavior:

error CS8346: Conversion of a stackalloc expression of type 'int' to type 'int*' is not possible

貢獻者指南