[Mono-bugs] [Bug 75941][Nor] New - CS0165 when type name = local variable name and static invocation on initialization

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Aug 30 16:01:08 EDT 2005


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 atsushi at ximian.com.

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

--- shadow/75941	2005-08-30 16:01:08.000000000 -0400
+++ shadow/75941.tmp.1124	2005-08-30 16:01:08.000000000 -0400
@@ -0,0 +1,53 @@
+Bug#: 75941
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: atsushi at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: CS0165 when type name = local variable name and static invocation on initialization
+
+When a static member of type T is used to initialize local variable whose
+name is T and the type is T.
+
+Example case of the most likely to happen:
+
+----
+class Foo
+{
+        static Foo foo = new Foo ();
+
+        private Foo () {}
+
+        public static Foo GetInstance ()
+        {
+                return foo;
+        }
+}
+
+class Test
+{
+        public void Baz ()
+        {
+                Foo Foo = Foo.GetInstance ();
+        }
+}
+
+
+Actual Results:
+
+type-local-static.cs(17,13): error CS0165: Use of unassigned local variable
+`Foo'
+
+Expected Results:
+
+no CS0165 error.


More information about the mono-bugs mailing list