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 [EMAIL PROTECTED] http://bugzilla.ximian.com/show_bug.cgi?id=75723 --- shadow/75723 2005-08-05 05:53:35.000000000 -0400 +++ shadow/75723.tmp.20421 2005-08-05 05:53:35.000000000 -0400 @@ -0,0 +1,75 @@ +Bug#: 75723 +Product: Mono: Compilers +Version: 1.1 +OS: +OS Details: +Status: NEW +Resolution: +Severity: +Priority: Normal +Component: C# +AssignedTo: [EMAIL PROTECTED] +ReportedBy: [EMAIL PROTECTED] +QAContact: [EMAIL PROTECTED] +TargetMilestone: --- +URL: +Cc: +Summary: CS0182 reported on valid attributes + +Getting error CS0182: An attribute argument must be a constant expression, +typeof expression or array creation expression +on near trivial sample of code that goes through csc just fine. + + +Code sample: +using System; + + +// The attribute +internal class MyAttr : Attribute { + internal MyAttr() { } + internal MyAttr(Type type) { } + internal MyAttr(string name) { } + internal MyAttr(int i) { } +} + +// The Classes +[MyAttr()] +internal class ClassA { } + +[MyAttr(typeof(string))] +internal class ClassB { } + +[MyAttr("abc")] +internal class ClassC { } + +[MyAttr(3)] +internal class ClassD { } + +// Just to compile +internal class Top { + public static void Main (string[] strgs){} +} + + +Result: +$ mcs classes.cs +classes.cs(21) error CS0182: An attribute argument must be a constant +expression +, typeof expression or array creation expression +classes.cs(24) error CS0182: An attribute argument must be a constant +expression +, typeof expression or array creation expression +classes.cs(27) error CS0182: An attribute argument must be a constant +expression +, typeof expression or array creation expression +classes.cs(30) error CS0182: An attribute argument must be a constant +expression +, typeof expression or array creation expression +Compilation failed: 4 error(s), 0 warnings + + + +Expected Results: Should compile + +How often does this happen: Always. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
