Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add regression test for #3903.

  • Loading branch information...
commit 8379d2c80518d035dd2ea6cc6c24ee48e1ab8ec3 1 parent 5f3f4fb
@kumpera kumpera authored
Showing with 34 additions and 1 deletion.
  1. +6 −1 mono/tests/Makefile.am
  2. +28 −0 mono/tests/bug-3903.cs
View
7 mono/tests/Makefile.am
@@ -380,7 +380,8 @@ BASE_TEST_CS_SRC= \
bug-705140.cs \
bug-1147.cs \
mono-path.cs \
- bug-bxc-795.cs
+ bug-bxc-795.cs \
+ bug-3903.cs
TEST_CS_SRC_DIST= \
$(BASE_TEST_CS_SRC) \
@@ -391,6 +392,7 @@ TEST_CS_SRC_DIST= \
TEST_CS_SRC_GEN = \
runtime-invoke.gen.cs \
imt_big_iface_test.cs
+
if AMD64
TEST_CS_SRC = $(BASE_TEST_CS_SRC) $(TEST_CS_SRC_GEN) async-exc-compilation.cs finally_guard.cs
@@ -887,6 +889,9 @@ generic-delegate2-lib.2.dll : generic-delegate2-lib.2.il
generic-delegate2.2.exe : generic-delegate2.2.cs generic-delegate2-lib.2.dll
$(MCS) -r:generic-delegate2-lib.2.dll -out:$@ $(srcdir)/generic-delegate2.2.cs
+bug-3903.exe: bug-3903.cs
+ $(MCS) -sdk:2 bug-3903.cs -out:bug-3903.exe
+
gshared: test-generic-sharing
gshared-aot:
View
28 mono/tests/bug-3903.cs
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+struct Foo
+{
+}
+
+
+public class TestClass
+{
+ public static int Main ()
+ {
+ Foo[][] array = new Foo[][] { new Foo[0] };
+ IEnumerable<object> aa1 = array;
+ foreach (var x in aa1) Console.WriteLine (x);
+ aa1.GetEnumerator ().ToString ();
+
+ int[] array2 = new int[10];
+ IEnumerable<uint> aa2 = (uint[])(object)array2;
+ foreach (var x in aa2) Console.WriteLine (x);
+ aa2.GetEnumerator ().ToString ();
+
+ // The next line will crash
+ List<object> list = array.Cast<object>().Select((arg) => arg).ToList();
+ return 0;
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.