[Mono-bugs] [Bug 24307] New - mcs should not allow struct inheriting from classes

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
6 May 2002 19:53:55 -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 pt99par@student.bth.se.

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

--- shadow/24307	Mon May  6 15:53:55 2002
+++ shadow/24307.tmp.13154	Mon May  6 15:53:55 2002
@@ -0,0 +1,64 @@
+Bug#: 24307
+Product: Mono/MCS
+Version: unspecified
+OS: 
+OS Details: Mandrake 8.2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: pt99par@student.bth.se               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs should not allow struct inheriting from classes
+
+Please fill in this template when reporting a bug, unless you know what you are 
+doing.Description of Problem: 
+Mcs allows the declaration of a struct inheriting from a class. It should only be 
+able to implement interfaces. It seems that the the inheritance isnt done becouse 
+it complains when  using base class field. 
+ 
+The code that produces the wrong compilation error --------------- 
+ 
+public class A { int value; } 
+public struct B : A { } // this is not allowed 
+ 
+public class Test {  
+      
+    public static void Main(string[] args) {  
+        B b = new B(); 
+	 b.value = 5; 
+    }  
+      
+} 
+ 
+Error messages from csc and mcs ------------------- 
+ csc.exe (7.00.9466) 
+ test.cs(4,19): error CS0527: 'A' : type in interface list is not an interface 
+ test.cs(3,14): (Location of symbol related to previous error) 
+ 
+ mcs test.cs 
+ ./test.cs(10) error CS0117: `B' does not contain a definition for `value' 
+ 
+ 
+Steps to reproduce the problem: 
+1. compile the code  
+2. whatch the error result 
+3.  
+ 
+Actual Results: 
+  test.cs(10) error CS0117: `B' does not contain a definition for `value' 
+ 
+Expected Results: 
+  Some sort of error like the one in csc.exe 
+ 
+How often does this happen?  
+Allways.. 
+ 
+ 
+Additional Information: 
+ Thnx for beeing so fast with fixing bugs.. impressing..