http://bugzilla.novell.com/show_bug.cgi?id=614471
http://bugzilla.novell.com/show_bug.cgi?id=614471#c0 Summary: [GMCS] Regression: Can assign invalid types to variables. Classification: Mono Product: Mono: Compilers Version: SVN Platform: x86-64 OS/Version: openSUSE 11.2 Status: NEW Severity: Normal Priority: P5 - None Component: C# AssignedTo: [email protected] ReportedBy: [email protected] QAContact: [email protected] Found By: --- Blocker: --- The type checker in trunk has gone haywire; to wit, this compiles: class Test { public static void Main () { Foo<int, double>(); } static void Foo<T1, T2> () { T1 a = default (T2); T2 b = default (T1); } } There's no way that we should be able to assign default(T2) to a T1 variable. gmcs 2.4 dislikes it, as does gmcs 2.6: bad.cs(9,28): error CS0029: Cannot implicitly convert type `T2' to `T1' bad.cs(10,28): error CS0029: Cannot implicitly convert type `T1' to `T2' (gmcs 2.6 shows lots more output, but it's a superset of the above.) gmcs trunk will compile it with only warnings: bad.cs(10,28): warning CS0219: The variable `b' is assigned but its value is never used bad.cs(9,28): warning CS0219: The variable `a' is assigned but its value is never used Running it is a disaster: $ mono bad.exe Unhandled Exception: System.InvalidCastException: Cannot cast from source type to destination type. at Test.Foo[Int32,Double] () [0x00000] in <filename unknown>:0 at Test.Main () [0x00000] in <filename unknown>:0 -- Configure bugmail: http://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. _______________________________________________ mono-bugs maillist - [email protected] http://lists.ximian.com/mailman/listinfo/mono-bugs
