[Mono-bugs] [Bug 29502][Nor] New - null arg to custom attributes

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
27 Aug 2002 14:19:45 -0000


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 lupus@ximian.com.

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

--- shadow/29502	Tue Aug 27 10:19:45 2002
+++ shadow/29502.tmp.13804	Tue Aug 27 10:19:45 2002
@@ -0,0 +1,40 @@
+Bug#: 29502
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: Unknown
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: lupus@ximian.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: null arg to custom attributes
+
+mcs compiles the following program, but csc doesn't and emits the following
+error:
+null-attr.cs(8,5): error CS0182: An attribute argument must be a constant
+expression, typeof expression or array creation expression
+
+== snip snip ==
+using System;
+
+class My :Attribute {
+	public My (object obj) {
+	}
+}
+
+[My(null)]
+class T {
+	static void Main() {}
+}
+
+If you add a constructor that takes a string, csc selects that
+and compilation succedes:
+	public My (string obj) {
+	}