| 
            Last change
 on this file since 7d405eb was             d3cf623, checked in by Andrew Beach <ajbeach@…>, 11 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:
            822 bytes
           | 
        
      
      
| Line |   | 
|---|
| 1 | // Conditional Catch Test
 | 
|---|
| 2 | 
 | 
|---|
| 3 | // I may fold this back into terminate.cfa and resume.cfa once setting
 | 
|---|
| 4 | // up the non-trivial exception is reasonable to do.
 | 
|---|
| 5 | 
 | 
|---|
| 6 | #include <fstream.hfa>
 | 
|---|
| 7 | 
 | 
|---|
| 8 | exception num_error {
 | 
|---|
| 9 |         int num;
 | 
|---|
| 10 | };
 | 
|---|
| 11 | 
 | 
|---|
| 12 | vtable(num_error) num_error_vt;
 | 
|---|
| 13 | 
 | 
|---|
| 14 | void caught_num_error(int expect, num_error * actual) {
 | 
|---|
| 15 |         sout | "Caught num_error: expected=" | expect | "actual=" | actual->num | '.';
 | 
|---|
| 16 | }
 | 
|---|
| 17 | 
 | 
|---|
| 18 | int main() {
 | 
|---|
| 19 |         num_error exc = {&num_error_vt, 2};
 | 
|---|
| 20 | 
 | 
|---|
| 21 |         try {
 | 
|---|
| 22 |                 throw exc;
 | 
|---|
| 23 |         } catch (num_error * error ; 3 == error->num ) {
 | 
|---|
| 24 |                 caught_num_error(3, error);
 | 
|---|
| 25 |         } catch (num_error * error ; 2 == error->num ) {
 | 
|---|
| 26 |                 caught_num_error(2, error);
 | 
|---|
| 27 |         }
 | 
|---|
| 28 | 
 | 
|---|
| 29 |         try {
 | 
|---|
| 30 |                 throwResume exc;
 | 
|---|
| 31 |         } catchResume (num_error * error ; 3 == error->num ) {
 | 
|---|
| 32 |                 caught_num_error(3, error);
 | 
|---|
| 33 |         } catchResume (num_error * error ; 2 == error->num ) {
 | 
|---|
| 34 |                 caught_num_error(2, error);
 | 
|---|
| 35 |         }
 | 
|---|
| 36 | }
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.