ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change
on this file since 095b99a was
d62806c,
checked in by Andrew Beach <ajbeach@…>, 5 years ago
|
Start working on checks to make sure we do not jump out of a finally block.
|
-
Property mode set to
100644
|
File size:
835 bytes
|
Line | |
---|
1 | // All of these should be caught as long as the check remains in the same |
---|
2 | // pass. (Although not even all of the checks are in place yet.) |
---|
3 | |
---|
4 | void break_in_finally() { |
---|
5 | while (true) { |
---|
6 | try {} finally { |
---|
7 | break; |
---|
8 | } |
---|
9 | } |
---|
10 | } |
---|
11 | |
---|
12 | void continue_in_finally() { |
---|
13 | while (true) { |
---|
14 | try {} finally { |
---|
15 | continue; |
---|
16 | } |
---|
17 | } |
---|
18 | } |
---|
19 | |
---|
20 | void goto_in_finally() { |
---|
21 | while (true) { |
---|
22 | try {} finally { |
---|
23 | goto end_of_function; |
---|
24 | } |
---|
25 | } |
---|
26 | end_of_function: {} |
---|
27 | } |
---|
28 | |
---|
29 | void labelled_break_in_finally() { |
---|
30 | mainLoop: while (true) { |
---|
31 | try {} finally { |
---|
32 | break mainLoop; |
---|
33 | } |
---|
34 | } |
---|
35 | } |
---|
36 | |
---|
37 | void labelled_continue_in_finally() { |
---|
38 | mainLoop: while (true) { |
---|
39 | try {} finally { |
---|
40 | continue mainLoop; |
---|
41 | } |
---|
42 | } |
---|
43 | } |
---|
44 | |
---|
45 | void void_return_in_finally() { |
---|
46 | try {} finally { |
---|
47 | return; |
---|
48 | } |
---|
49 | } |
---|
50 | |
---|
51 | int value_return_in_finally() { |
---|
52 | try {} finally { |
---|
53 | return -7; |
---|
54 | } |
---|
55 | |
---|
56 | } |
---|
57 | |
---|
58 | void main() { |
---|
59 | // Should not compile. |
---|
60 | return 1; |
---|
61 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.