summaryrefslogtreecommitdiff
path: root/mcs/tests/gtest-527.cs
blob: 4e3b2558556551b177476ab81c41a7982c60053a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
public static class CoalescingWithGenericsBug
{
	class Service { public void Foo () { } }

	static T Provide<T> () where T : class
	{
		return FindExisting<T> () ?? System.Activator.CreateInstance<T> ();
	}

	static T FindExisting<T> () where T : class
	{
		return null;
	}

	public static int Main ()
	{
		Provide<Service> ().Foo ();
		return 0;
	}
}