diff --git a/mcs/errors/cs0182-10.cs b/mcs/errors/cs0182-10.cs new file mode 100644 index 0000000000000..1ce2d2f48dfd3 --- /dev/null +++ b/mcs/errors/cs0182-10.cs @@ -0,0 +1,18 @@ +// CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression +// Line: 13 + +using System; + +class TestAttribute: Attribute +{ + public TestAttribute (int[][] o) {} +} + +public class E +{ + [Test (null)] + public static void Main () + { + System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttributes (true); + } +} \ No newline at end of file diff --git a/mcs/errors/cs0182-8.cs b/mcs/errors/cs0182-8.cs new file mode 100644 index 0000000000000..56d98c4dc1678 --- /dev/null +++ b/mcs/errors/cs0182-8.cs @@ -0,0 +1,19 @@ +// CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression +// Line: 13 + +using System; + +class MyAttribute : Attribute { + + public MyAttribute (string s) + { + } +} + +[My (null as string)] +class X { + + static void Main () + { + } +} diff --git a/mcs/errors/cs0182-9.cs b/mcs/errors/cs0182-9.cs new file mode 100644 index 0000000000000..2fb5cf41a32d2 --- /dev/null +++ b/mcs/errors/cs0182-9.cs @@ -0,0 +1,18 @@ +// CS0182: An attribute argument must be a constant expression, typeof expression or array creation expression +// Line: 13 + +using System; + +class TestAttribute: Attribute +{ + public TestAttribute (object o) {} +} + +public class E +{ + [Test (new int[][] { null })] + public static void Main () + { + System.Reflection.MethodBase.GetCurrentMethod().GetCustomAttributes (true); + } +} \ No newline at end of file