dotnet/roslyn

Conversion of a stackalloc expression

Offen

#23.995 geöffnet am 02.01.2018

 (7 Kommentare) (1 Reaktion) (0 zugewiesene Personen)C# (4.257 Forks)batch import
Area-CompilersBugConcept-Diagnostic ClarityFeature - Readonly Referenceshelp wanted

Repository-Metriken

Stars
 (20.414 Sterne)
PR-Merge-Metriken
 (Durchschn. Merge 6T 17h) (256 gemergte PRs in 30 T)

Beschreibung

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

Contributor Guide