mail-archives/mono-bugs/2002-April/000508.html

107 строки
3.6 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 24007] New - Scope of variables declared inside a switch case
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:bugzilla-daemon%40rocky.ximian.com">
<META NAME="robots" CONTENT="index,nofollow">
<LINK REL="Previous" HREF="000507.html">
<LINK REL="Next" HREF="000509.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 24007] New - Scope of variables declared inside a switch case
</H1>
<B>bugzilla-daemon@rocky.ximian.com
</B>
<A HREF="mailto:bugzilla-daemon%40rocky.ximian.com"
TITLE="[Mono-bugs] [Bug 24007] New - Scope of variables declared inside a switch case">bugzilla-daemon@rocky.ximian.com
</A><BR>
<I>29 Apr 2002 17:41:20 -0000</I>
<P><UL>
<LI> Previous message: <A HREF="000507.html">[Mono-bugs] [Bug 24004] New - reference compare compilation error in mcs
</A></li>
<LI> Next message: <A HREF="000509.html">[Mono-bugs] [Bug 22864] Changed - mono does not report NullReferenceException
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#508">[ date ]</a>
<a href="thread.html#508">[ thread ]</a>
<a href="subject.html#508">[ subject ]</a>
<a href="author.html#508">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE>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 <A HREF="mailto:lupus@ximian.com.">lupus@ximian.com.</A>
<A HREF="http://bugzilla.ximian.com/show_bug.cgi?id=24007">http://bugzilla.ximian.com/show_bug.cgi?id=24007</A>
--- shadow/24007 Mon Apr 29 13:41:20 2002
+++ shadow/24007.tmp.29525 Mon Apr 29 13:41:20 2002
@@ -0,0 +1,42 @@
+Bug#: 24007
+Product: Mono/MCS
+Version: unspecified
+OS: other
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: Misc
+AssignedTo: <A HREF="mailto:mono-bugs@ximian.com">mono-bugs@ximian.com</A>
+ReportedBy: <A HREF="mailto:lupus@ximian.com">lupus@ximian.com</A>
+QAContact: <A HREF="mailto:mono-bugs@ximian.com">mono-bugs@ximian.com</A>
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Scope of variables declared inside a switch case
+
+The scope of a variable declared inside a switch case propagates also to
+the next cases. The sample program compiles fine with csc, but fails with
+mcs on both the mono and ms runtime.
+
+class T {
+ static int Main() {
+ int v = 10;
+ int a;
+
+ switch (v) {
+ case 0:
+ int i = v + 1;
+ a = i;
+ break;
+ default:
+ i = 5;
+ a = i;
+ break;
+ }
+ if (a != 5)
+ return 1;
+ return 0;
+ }
+}
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI> Previous message: <A HREF="000507.html">[Mono-bugs] [Bug 24004] New - reference compare compilation error in mcs
</A></li>
<LI> Next message: <A HREF="000509.html">[Mono-bugs] [Bug 22864] Changed - mono does not report NullReferenceException
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#508">[ date ]</a>
<a href="thread.html#508">[ thread ]</a>
<a href="subject.html#508">[ subject ]</a>
<a href="author.html#508">[ author ]</a>
</LI>
</UL>
</body></html>