gcc/testsuite/gnat.dg/raise_expr.adb
raw| 1 | -- { dg-do compile } |
| 2 | |
| 3 | procedure Raise_Expr is |
| 4 | |
| 5 | E : exception; |
| 6 | |
| 7 | type T is tagged limited null record; |
| 8 | type TC is new T with null record; |
| 9 | |
| 10 | function F0 return Boolean is |
| 11 | begin |
| 12 | return raise E; |
| 13 | end; |
| 14 | |
| 15 | function F return T'Class is |
| 16 | TT : T; |
| 17 | begin |
| 18 | return raise E; -- Causes compile-time crash |
| 19 | end F; |
| 20 | |
| 21 | begin |
| 22 | declare |
| 23 | O : T'class := F; |
| 24 | begin |
| 25 | null; |
| 26 | end; |
| 27 | end Raise_Expr; |