[Mono-bugs] [Bug 40786][Nor] Changed - Accessibility checks on pointer types need special-casing

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Wed, 9 Apr 2003 16:46:59 -0400 (EDT)


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 miguel@ximian.com.

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

--- shadow/40786	Mon Apr  7 07:47:26 2003
+++ shadow/40786.tmp.32675	Wed Apr  9 16:46:59 2003
@@ -1,13 +1,13 @@
 Bug#: 40786
 Product: Mono/MCS
 Version: unspecified
 OS: All
 OS Details: 
-Status: NEW   
-Resolution: 
+Status: RESOLVED   
+Resolution: FIXED
 Severity: Unknown
 Priority: Normal
 Component: Misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: webmaster@theratnerschool.org               
 QAContact: mono-bugs@ximian.com
@@ -129,6 +129,49 @@
 I guess mcs will have to special-case pointer and byref types 
 and consider them all as public.
 
 ------- Additional Comments From bmaurer@users.sf.net  2003-04-07 07:47 -------
 Yes, I was running the test on windows, so what Paolo said is 
 probably my problem.
+
+------- Additional Comments From miguel@ximian.com  2003-04-09 16:46 -------
+Fixed on CVS.  
+
+Patch follows.
+
+diff -u -u -r1.52 decl.cs
+--- decl.cs	28 Mar 2003 22:51:57 -0000	1.52
++++ decl.cs	9 Apr 2003 20:54:00 -0000
+@@ -498,12 +498,31 @@
+ 		
+ 		bool CheckAccessLevel (Type check_type) 
+ 		{
+-			if (check_type.IsPublic || check_type.IsNestedPublic)
++			//
++			// Broken Microsoft runtime, return public for arrays, no matter what 
++			// the accessibility is for their underlying class
++			//
++			if (check_type.IsPublic){
++				if (check_type.IsArray)
++				 	return CheckAccessLevel (check_type.GetElementType ());
++				
++				return true;
++			}
++			
++			if (check_type.IsNestedPublic)
+ 				return true;
+ 			
+ 			if (check_type.Assembly == TypeBuilder.Assembly)
+ 				return true;
+ 
++			//
++			// Broken Microsoft runtime: They set the accessibility of
++			// pointers to NonPublic, even if their ElementType is accessible
++			// in some form.
++			//
++			if (check_type.IsPointer)
++				return CheckAccessLevel (check_type.GetElementType ());
++			
+ 			return false;
+ 
+ 		}
+