[Mono-bugs] [Bug 55971][Nor] New - mcs fails to create custom attributes with fields which have array type

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 23 Mar 2004 16:17:18 -0500 (EST)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by vargaz@freemail.hu.

http://bugzilla.ximian.com/show_bug.cgi?id=55971

--- shadow/55971	2004-03-23 16:17:18.000000000 -0500
+++ shadow/55971.tmp.18745	2004-03-23 16:17:18.000000000 -0500
@@ -0,0 +1,58 @@
+Bug#: 55971
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vargaz@freemail.hu               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs fails to create custom attributes with fields which have array type
+
+Testcase:
+
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+using System;
+
+[AttributeUsage(AttributeTargets.Field | AttributeTargets.Class,
+Inherited=true)]
+public class FooAttribute : Attribute
+{
+	char[] separator2;
+		
+	public FooAttribute(string name)
+	{
+	}
+
+	public char[] Separator {
+		get {
+			return separator2;
+		}
+	}
+}
+
+[FooAttribute("shortcut",separator2=new char[]{'A'})]
+public class Tests {
+	public static void Main () {
+		FooAttribute foo = (FooAttribute)(typeof (Tests).GetCustomAttributes
+(false) [0]);
+		Console.WriteLine (foo.Separator);
+	}
+}
+
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+Here, mcs reports:
+
+custom.cs(19) error CS0182: An attribute argument must be a constant
+expression, typeof expression or array creation expression
+
+while csc compiles it fine.