[Mono-bugs] [Bug 29590][Nor] Changed - Access of private constructor possible

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
30 Aug 2002 08:43:17 -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 ritterfelix@web.de.

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

--- shadow/29590	Thu Aug 29 21:21:22 2002
+++ shadow/29590.tmp.15334	Fri Aug 30 04:43:16 2002
@@ -1,13 +1,13 @@
 Bug#: 29590
 Product: Mono/MCS
 Version: unspecified
 OS: SuSE 8.0
 OS Details: 
-Status: RESOLVED   
-Resolution: NOTABUG
+Status: REOPENED   
+Resolution: 
 Severity: Unknown
 Priority: Normal
 Component: Misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: ritterfelix@web.de               
 QAContact: mono-bugs@ximian.com
@@ -70,6 +70,38 @@
 	  Singleton s = new Singleton ();
   }
 
 }
 
 ;-)
+
+------- Additional Comments From ritterfelix@web.de  2002-08-30 04:43 -------
+Hello,
+
+I think you didn't undestand what I mean.
+I exactly meant what you wrote (source code), but I still think that 
+it is a bug.
+If you try to compile this, it will work with MONO but not with the 
+Microsoft Compiler (the MS Compiler reports Error CS0122: 
+Singleton.Singleton() is inaccesible because of its protection level):
+
+class Singleton
+{
+  public static Singleton instance=null;
+  private Singleton() {
+  }
+  public static Singleton getInstance() {
+    if (instance==null) instance = new Singleton();
+    return instance;
+  }
+
+}
+
+class C
+{
+  static void Main ()
+  {
+	  Singleton s = new Singleton (); /* why is it ok to access 
+the private constructor???? */
+  }
+}
+