[Mono-bugs] [Bug 37363][Nor] New - Typecasts aren't being allowed in Attribute parameters
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Wed, 29 Jan 2003 07:54:45 -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 rafaelteixeirabr@hotmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=37363
--- shadow/37363 Wed Jan 29 07:54:45 2003
+++ shadow/37363.tmp.23298 Wed Jan 29 07:54:45 2003
@@ -0,0 +1,53 @@
+Bug#: 37363
+Product: Mono/MCS
+Version: unspecified
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: rafaelteixeirabr@hotmail.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Typecasts aren't being allowed in Attribute parameters
+
+This error was originally reported by karamal@eecg.toronto.edu
+
+Compiling code like this:
+
+[myAttribute("stringArgument", (String)null, (String)null, 2)]
+
+gives the following error message:
+
+teste.cs(10) error CS0182: An attribute argument must be a constant
+expression, typeof expression or array creation expression
+Compilation failed: 1 error(s), 0 warnings
+
+It compiles OK with csc. Also if the typecast are removed, mcs resolve it
+right.
+
+Additional Information:
+
+using mcs.exe from mono-0.19 install and also from cvs
+
+This is a source for testing this bug:
+
+using System;
+
+namespace TestBUG
+{
+ public class myAttribute : Attribute
+ {
+ public myAttribute(string p1, string p2, string p3, int p4) {}
+ }
+
+ [myAttribute("stringArgument", (String)null, (String)null, 2)]
+ public class Test
+ {
+ }
+}