gcc/testsuite/gnat.dg/reduce2.adb
raw| 1 | -- { dg-do compile } |
| 2 | -- { dg-options "-gnat2022" } |
| 3 | |
| 4 | procedure Reduce2 is |
| 5 | |
| 6 | subtype Value is Natural range 0 .. 255; |
| 7 | |
| 8 | function Do_Something (Accumulator : Value; Symbol : Character) return Value |
| 9 | is (((Accumulator + Character'Pos (Symbol)) * 17) mod 256); |
| 10 | |
| 11 | function Do_It_By_Reduction (S : String) return Value is |
| 12 | (S'Reduce (Do_Something, 0)); |
| 13 | |
| 14 | Test_It : constant Value := Do_It_By_Reduction ("Hello, world!"); |
| 15 | |
| 16 | begin |
| 17 | null; |
| 18 | end; |