diff test/scope5.d @ 81:3587401b6eeb trunk

[svn r85] Fixed: if a return statement appeared in the try block of a nested try-finally, only the inner-most finally block would be executed. Changed: Renamed all the LLVM_Dto... helper function to just Dto...
author lindquist
date Thu, 01 Nov 2007 17:27:18 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/scope5.d	Thu Nov 01 17:27:18 2007 +0100
@@ -0,0 +1,27 @@
+module scope5;
+
+int i;
+
+void func(int a, int b)
+{
+    i = 0;
+    {
+        scope(exit) i++;
+        if (a) {
+            scope(exit) i++;
+            if (b) return;
+            i++;
+        }
+    }
+    i++;
+}
+
+void main()
+{
+    func(0,0);
+    assert(i == 2);
+    func(1,1);
+    assert(i == 2);
+    func(1,0);
+    assert(i == 4);
+}