Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test-903.cs « tests « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7dedb674dafaa35d46aef4ffef41b6aa8c531353 (plain)
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
using System;

struct S
{
}

class C
{
	public static int ConversionCalled;

	public static implicit operator S (C c)
	{
		++ConversionCalled;
		return new S ();
	}
}

class Program
{
	static C field;

	static int Main ()
	{
		C c = new C ();
		var x = c ?? new S ();

		if (C.ConversionCalled != 1)
			return 1;

		c = null;
		x = c ?? new S ();
		if (C.ConversionCalled != 1)
			return 2;

		x = field ?? new S ();
		if (C.ConversionCalled != 1)
			return 3;

		return 0;
	}
}