forked from dotnet/runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGitHub_50492.cs
More file actions
42 lines (35 loc) · 997 Bytes
/
GitHub_50492.cs
File metadata and controls
42 lines (35 loc) · 997 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using System.Runtime.CompilerServices;
using System.Threading;
class Base
{
public virtual int Test(Base b1, Base b2, bool p) => 0;
public virtual int Foo() => 1;
}
class ClassA : Base
{
public override int Test(Base b1, Base b2, bool p) => p ? b2.Foo() : 42;
}
class ClassB : ClassA
{
public override int Test(Base b1, Base b2, bool p) => b1.Test(b1, b2, p);
}
class Program
{
public static int Main()
{
for (int i = 0; i < 100; i++)
{
// Make sure it doesn't assert, see https://github.com/dotnet/runtime/issues/50492
Test(new ClassB(), new ClassA(), new Base(), true);
Thread.Sleep(15);
}
return 100;
}
[MethodImpl(MethodImplOptions.NoInlining)]
static int Test(Base b0, Base b1, Base b2, bool p)
{
return b0.Test(b1, b2, p);
}
}