2014-08-13 10:39:27 +01:00
|
|
|
// Compiler options: -warnaserror
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Reflection;
|
|
|
|
|
|
|
|
class A : Attribute
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2014-09-04 09:07:35 +01:00
|
|
|
[method:A]
|
|
|
|
class X (int value)
|
2014-08-13 10:39:27 +01:00
|
|
|
{
|
|
|
|
public int f = value;
|
|
|
|
|
2014-09-04 09:07:35 +01:00
|
|
|
public int P { get; } = value;
|
2014-08-13 10:39:27 +01:00
|
|
|
|
|
|
|
public static int Main ()
|
|
|
|
{
|
2014-09-04 09:07:35 +01:00
|
|
|
var x = typeof (X);
|
|
|
|
var attr = x.GetConstructors ()[0].GetCustomAttribute (typeof (A)) as A;
|
2014-08-13 10:39:27 +01:00
|
|
|
if (attr == null)
|
2014-09-04 09:07:35 +01:00
|
|
|
return 2;
|
2014-08-13 10:39:27 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|