[Mono-bugs] [Bug 79371][Min] Changed - [GMCS] Compiler error when using "as" operator with int?

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Mar 24 06:39:50 EDT 2007


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 marek.safar at seznam.cz.

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

--- shadow/79371	2006-10-07 11:53:54.000000000 -0400
+++ shadow/79371.tmp.11642	2007-03-24 05:39:49.000000000 -0500
@@ -65,6 +65,27 @@
 
 Based on the sections 11.4 and 14.9.11 it should not be allowed.
 
 
 ------- Additional Comments From marek.safar at seznam.cz  2006-10-03 10:46 -------
 *** Bug 79566 has been marked as a duplicate of this bug. ***
+
+------- Additional Comments From marek.safar at seznam.cz  2007-03-24 05:39 -------
+This bit is specified in Microsoft version of the standard.
+
+24.3.6 The as operator
+The as operator (§7.9.10) is extended to support nullable types. In an
+operation of the form e as T, e must be an expression and T must be a
+reference type, a type parameter known to be a reference type, or a
+nullable type. Furthermore, at least one of the following must be
+true, or otherwise a compile-time error occurs:
+•	An identity (§6.1.1), implicit reference (§6.1.4), boxing (§6.1.5,
+§24.2.3), explicit reference (§6.2.3), or unboxing (§6.2.4, §24.2.3)
+conversion exists from the type of e to T.
+•	The type of e or T is an open type.
+•	e is the null literal.
+The operation e as T produces the same result as
+e is T ? (T)(e) : (T)null
+except that e is only evaluated once. The compiler can be expected to
+optimize e as T to perform at most one dynamic type check as opposed
+to the two dynamic type checks implied by the expansion above.
+


More information about the mono-bugs mailing list