blob: 1dcbbbda3076eafd3040b6283f8d4e68afcc8d21 (
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
42
43
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
//
//
// This test represents a case where csc.exe puts a base/peer ctor callsite outside of the
// first block of the derived ctor.
//
// Specifically covers: "Use of ?? in a generic peer ctor argument expression"
//
using System;
using System.Runtime.CompilerServices;
namespace Test
{
static class App
{
static int Main()
{
new DerivedClass<int>("NotNull");
new DerivedClass<int>(null);
return 100;
}
}
public class BaseClass
{
[MethodImpl(MethodImplOptions.NoInlining)]
public BaseClass(string arg) { Console.Write("BaseClass::.ctor -- `{0}'\r\n", arg); return; }
}
public class DerivedClass<T> : BaseClass
{
[MethodImpl(MethodImplOptions.NoInlining)]
public DerivedClass(string selector) : this(selector ?? "NeededToFallBack", 0) { }
[MethodImpl(MethodImplOptions.NoInlining)]
private DerivedClass(string arg, int marker) : base(arg) { }
}
}
|