[Mono-bugs] [Bug 27287][Maj] Changed - Error whith structs that implement interfaces

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
1 Jul 2002 14:14:27 -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 lupus@ximian.com.

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

--- shadow/27287	Mon Jul  1 08:47:09 2002
+++ shadow/27287.tmp.11559	Mon Jul  1 10:14:27 2002
@@ -1,23 +1,23 @@
 Bug#: 27287
 Product: Mono/MCS
 Version: unspecified
 OS: Red Hat 7.3
 OS Details: 
-Status: NEW   
+Status: ASSIGNED   
 Resolution: 
 Severity: Unknown
 Priority: Major
 Component: Misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: jaime@geneura.ugr.es               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
 Cc: 
-Summary: Error while casting a struct to an interface
+Summary: Error whith structs that implement interfaces
 
 Please fill in this template when reporting a bug, unless you know what you
 are doing.
 Description of Problem:
 
 > I got a compiler error telling that I cannot convert a struct to an
@@ -50,6 +50,32 @@
 
 More info on mono-list. Ask me for source code for testing this if you want.
 
 ------- Additional Comments From lupus@ximian.com  2002-07-01 08:47 -------
 Please, always add the sample code (possibly reducing it to a minimal
 test) to the bug report.
+
+------- Additional Comments From lupus@ximian.com  2002-07-01 10:14 -------
+The test case is a struct without fields that implements interfaces:
+using System;
+public interface I {
+        void stuff();
+}
+struct T : I {
+        public void stuff () {}
+        static int Main() {
+                bool good = false;
+                foreach (Type iface in typeof(T).GetInterfaces()) {
+                        if (iface == typeof(I))
+                                good = true;
+                }
+
+                return good? 0: 1;
+        }
+}
+The interfaces were not added at DefineType(): I'll commit soon a
+patch for this issue.
+There is another related mcs issue, though: it needs to set the
+attributes of the stuff() method to include final and virtual.
+Also, mcs should not allow the use of the virtual modifier on the
+stuff() method (it currently does).
+