Jo Shields a575963da9 Imported Upstream version 3.6.0
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
2014-08-13 10:39:27 +01:00

52 lines
699 B
C#

//
// This exercises the various ways in which the new operator works
// with value types.
//
using System;
struct S {
int v;
}
class X {
static bool receive, create, create_and_box;
static void receiver (S x)
{
receive = true;
}
static object BoxS ()
{
create_and_box = true;
return new S ();
}
static S Plain ()
{
create = true;
return new S ();
}
public static int Main ()
{
object a = new S ();
receiver (new S ());
S s = Plain ();
object o = BoxS ();
if (a == null)
return 1;
if (receive == false)
return 2;
if (create == false)
return 3;
if (create_and_box == false)
return 4;
Console.WriteLine ("Test pass");
return 0;
}
}