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

56 lines
1.2 KiB
C#

//
// test-181.cs: Test whenever mcs correctly handles the MethodImplAttributes
// custom attribute.
//
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
class Test
{
[MethodImplAttribute(MethodImplOptions.Synchronized)]
public void test ()
{
}
[MethodImplAttribute((short)MethodImplOptions.Synchronized)]
public void test2 ()
{
}
[MethodImplAttribute((byte)32)]
public void test3 ()
{
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public void test4 ()
{
}
public static int Main ()
{
MethodImplAttributes iflags;
iflags = typeof (Test).GetMethod ("test").GetMethodImplementationFlags ();
if ((iflags & MethodImplAttributes.Synchronized) == 0)
return 1;
iflags = typeof (Test).GetMethod ("test2").GetMethodImplementationFlags ();
if ((iflags & MethodImplAttributes.Synchronized) == 0)
return 2;
iflags = typeof (Test).GetMethod ("test3").GetMethodImplementationFlags ();
if ((iflags & MethodImplAttributes.Synchronized) == 0)
return 3;
iflags = typeof (Test).GetMethod ("test3").GetMethodImplementationFlags ();
if ((iflags & MethodImplAttributes.Synchronized) == 0)
return 4;
return 0;
}
}