[Mono-bugs] [Bug 72930][Cos] New - CS0133 not reported for const fields of type object

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Wed, 23 Feb 2005 14:55:25 -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 nazgul@omega.pl.


--- shadow/72930	2005-02-23 14:55:25.000000000 -0500
+++ shadow/72930.tmp.15854	2005-02-23 14:55:25.000000000 -0500
@@ -0,0 +1,92 @@
+Bug#: 72930
+Product: Mono: Compilers
+Version: 1.0
+OS Details: Mandrake 10.1, mono
+Status: NEW   
+Priority: Cosmetic
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: nazgul@omega.pl               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: CS0133 not reported for const fields of type object
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+CS0133 should be reported when constant field of type object is being
+assigned string.
+Moreover, in program below mcs thows exception.
+Steps to reproduce the problem:
+1. Try to compile following program
+using System;
+namespace TestBUG
+        public class myAttribute : Attribute
+        {
+                public myAttribute(string p1, string p2, string p3, int p4) {}
+        }
+    [myAttribute("stringArgument", (String)Test.x, (String)null, 2)]
+        public class Test
+        {
+          public const object x = "3";
+                static int Main  ()
+                {
+                        return 0;
+                }
+        }
+Actual Results:
+Unhandled Exception: System.Exception: Unknown type for constant
+(System.Object), details: 3
+in <0x005b3> Mono.CSharp.Expression:Constantify (System.Object v,
+System.Type t)
+in <0x0025c> Mono.CSharp.MemberAccess:ResolveMemberAccess
+(Mono.CSharp.EmitContext ec, Mono.CSharp.Expression member_lookup,
+Mono.CSharp.Expression left, Location loc, Mono.CSharp.Expression
+in <0x0056b> Mono.CSharp.MemberAccess:DoResolve (Mono.CSharp.EmitContext
+ec, Mono.CSharp.Expression right_side, ResolveFlags flags)
+in <0x00014> Mono.CSharp.MemberAccess:DoResolve (Mono.CSharp.EmitContext ec)
+in <0x000d4> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec,
+ResolveFlags flags)
+in <0x00012> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec)
+in <0x0001a> Mono.CSharp.Cast:DoResolve (Mono.CSharp.EmitContext ec)
+in <0x000d4> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec,
+ResolveFlags flags)
+in <0x00012> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec)
+in <0x001a8> Mono.CSharp.Argument:Resolve (Mono.CSharp.EmitContext ec,
+Location loc)
+in <0x00381> Mono.CSharp.Attribute:Resolve (Mono.CSharp.EmitContext ec)
+in <0x00046> Mono.CSharp.Attribute:Emit (Mono.CSharp.EmitContext ec,
+Mono.CSharp.Attributable ias, System.Collections.Specialized.ListDictionary
+in <0x000b7> Mono.CSharp.Attributes:Emit (Mono.CSharp.EmitContext ec,
+Mono.CSharp.Attributable ias)
+in <0x000fc> Mono.CSharp.TypeContainer:EmitType ()
+in <0x00206> Mono.CSharp.RootContext:EmitCode ()
+in <0x00c3c> Mono.CSharp.Driver:MainDriver (System.String[] args)
+in <0x0000f> Mono.CSharp.Driver:Main (System.String[] args)
+Expected Results:
+t.cs(10,1): error CS1022: Type or namespace definition, or end-of-file expected
+How often does this happen? 
+Additional Information: