From 2184c18487d1e62b0988361bd4a807c8fedc394c Mon Sep 17 00:00:00 2001 From: Marek Safar Date: Thu, 17 Nov 2016 18:40:45 +0100 Subject: [PATCH] [mcs] Fixes user operator extraction from shared list. Fixes #46806 --- mcs/mcs/membercache.cs | 1 + mcs/tests/gtest-640.cs | 39 ++++++++++++++++++++++++++++++++++++ mcs/tests/ver-il-net_4_x.xml | 24 ++++++++++++++++++++++ 3 files changed, 64 insertions(+) create mode 100644 mcs/tests/gtest-640.cs diff --git a/mcs/mcs/membercache.cs b/mcs/mcs/membercache.cs index 27b7f586932..d3b0f86d816 100644 --- a/mcs/mcs/membercache.cs +++ b/mcs/mcs/membercache.cs @@ -1024,6 +1024,7 @@ namespace Mono.CSharp { shared_list = false; prev = new List (found.Count + 1); prev.AddRange (found); + found = prev; } else { prev = (List) found; } diff --git a/mcs/tests/gtest-640.cs b/mcs/tests/gtest-640.cs new file mode 100644 index 00000000000..2aeebb4e54e --- /dev/null +++ b/mcs/tests/gtest-640.cs @@ -0,0 +1,39 @@ +using System; + +public struct Test +{ + public static Test op_Addition(Test p1, T p2) + { + throw new ApplicationException (); + } + + public static int op_Addition(T p1, int p2) + { + throw new ApplicationException (); + } + + public static Test operator +(Test p1, Test p2) + { + throw new ApplicationException (); + } + + public static long operator +(Test p1, int p2) + { + return 4; + } +} + +public class Program +{ + public static int Main () + { + var t = new Test (); + + int p2 = 20; + var res = t + p2; + if (res != 4) + return 1; + + return 0; + } +} \ No newline at end of file diff --git a/mcs/tests/ver-il-net_4_x.xml b/mcs/tests/ver-il-net_4_x.xml index 7df1a90869f..ddb13732d04 100644 --- a/mcs/tests/ver-il-net_4_x.xml +++ b/mcs/tests/ver-il-net_4_x.xml @@ -19960,6 +19960,30 @@ + + + + 7 + + + 7 + + + 7 + + + 11 + + + + + 44 + + + 7 + + + -- 2.25.1