[Mono-bugs] [Bug 449005] New: Gmcs generates invalid code when using generics will nullable types

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Tue Nov 25 21:02:16 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=449005


           Summary: Gmcs generates invalid code when using generics will
                    nullable types
           Product: Mono: Compilers
           Version: SVN
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: kojoadams at hotmail.com
         QAContact: mono-bugs at lists.ximian.com
        Depends on: 449000
          Found By: ---


adamsk at exodus ~/tmp
$ cat k.cs
using System;

public struct CInt {
        int data;

        public CInt (int data) {
                this.data = data;
        }

        public static implicit operator CInt (int xx) {
                return new CInt (xx);
        }

        public static implicit operator int (CInt xx) {
                return xx.data;
        }
}


public class Klass <T> where T : struct {
        T? t;
        public Klass (T? t) {
                this.t = t;
        }

        public T? Value {
                get {
                        return t;
                }
        }
}

public class MainClass {
        public static void Main (String [] args) {
                //new Klass <CInt> (3);
                Console.WriteLine ((new Klass <CInt> (new CInt (3))).Value ==
3);
        }
}

adamsk at exodus ~/tmp
$ gmcs k.cs && mono k.exe

Unhandled Exception: System.InvalidProgramException: Invalid IL code in
MainClass:Main (string[]): IL_0020: ldloca.s  0


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list