Ignore:
Timestamp:
Sep 11, 2023, 12:55:49 PM (2 years ago)
Author:
caparsons <caparson@…>
Branches:
master
Children:
c0035fc
Parents:
9509d67a (diff), 73d0a84c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 moved

Legend:

Unmodified
Added
Removed
  • tests/exceptions/try-ctrl-flow.cfa

    r9509d67a rc8ec58e  
    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.)
     1// Check all the local control flow structures that are "sealed" by some the
     2// try statement clauses; where structured programming is stricter.
    33
    44void break_in_finally() {
     
    151151}
    152152
     153// Now just use return to test the other try control flow interactions.
     154
     155exception nil_exception {};
     156
     157void return_in_try_with_catch() {
     158        try {
     159                return;
     160        } catch (nil_exception *) {
     161                ;
     162        }
     163}
     164
     165// Allowed.
     166void return_in_try_with_catchReturn() {
     167        try {
     168                return;
     169        } catchResume (nil_exception *) {
     170                ;
     171        }
     172}
     173
     174// Allowed.
     175void return_in_try_with_finally() {
     176        try {
     177                return;
     178        } finally {
     179                ;
     180        }
     181}
     182
     183void return_in_catch() {
     184        try {
     185                ;
     186        } catch (nil_exception *) {
     187                return;
     188        }
     189}
     190
     191void return_in_catchResume() {
     192        try {
     193                ;
     194        } catchResume (nil_exception *) {
     195                return;
     196        }
     197}
     198
    153199void main() {
    154200        // Should not compile.
Note: See TracChangeset for help on using the changeset viewer.