|
Last change
on this file since 8f250e0 was d3cf623, checked in by Andrew Beach <ajbeach@…>, 10 months ago |
|
Solved the requested warning with exceptions. Also went through the exceptions tests and managed to remove about 2/3rds of them from the lax list that now either didn't have any warnings or warnings because of the test itself.
|
-
Property mode
set to
100644
|
|
File size:
644 bytes
|
| Line | |
|---|
| 1 | // Try cancelling a coroutine.
|
|---|
| 2 |
|
|---|
| 3 | #include <fstream.hfa>
|
|---|
| 4 | #include <coroutine.hfa>
|
|---|
| 5 |
|
|---|
| 6 | exception internal_error {};
|
|---|
| 7 | vtable(internal_error) internal_vt;
|
|---|
| 8 |
|
|---|
| 9 | coroutine WillCancel {};
|
|---|
| 10 |
|
|---|
| 11 | const char * msg(CoroutineCancelled(WillCancel) *) {
|
|---|
| 12 | return "CoroutineCancelled(WillCancel)";
|
|---|
| 13 | }
|
|---|
| 14 |
|
|---|
| 15 | void main(WillCancel &) {
|
|---|
| 16 | sout | '1';
|
|---|
| 17 | cancel_stack((internal_error){&internal_vt});
|
|---|
| 18 | sout | '!';
|
|---|
| 19 | }
|
|---|
| 20 |
|
|---|
| 21 | int main() {
|
|---|
| 22 | sout | nlOff;
|
|---|
| 23 | WillCancel cancel;
|
|---|
| 24 | try {
|
|---|
| 25 | sout | '0';
|
|---|
| 26 | resume(cancel);
|
|---|
| 27 | sout | '4';
|
|---|
| 28 | } catchResume (CoroutineCancelled(WillCancel) * error) {
|
|---|
| 29 | sout | '2';
|
|---|
| 30 | if ((virtual internal_error *)error->the_exception) {
|
|---|
| 31 | sout | '3';
|
|---|
| 32 | }
|
|---|
| 33 | }
|
|---|
| 34 | sout | '5' | nl;
|
|---|
| 35 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.