| 1 |
-- { dg-do compile } |
| 2 |
|
| 3 |
package Unchecked_Union2 is |
| 4 |
|
| 5 |
type Small_Int is range 0 .. 2**19 - 1; |
| 6 |
|
| 7 |
type R1 (B : Boolean := True) is record |
| 8 |
case B is |
| 9 |
when True => Data1 : Small_Int; |
| 10 |
when False => Data2 : Small_Int; |
| 11 |
end case; |
| 12 |
end record; |
| 13 |
|
| 14 |
for R1 use record |
| 15 |
Data1 at 0 range 0 .. 18; |
| 16 |
Data2 at 0 range 0 .. 18; |
| 17 |
end record; |
| 18 |
for R1'Size use 24; |
| 19 |
|
| 20 |
pragma Unchecked_Union (R1); |
| 21 |
|
| 22 |
type R2 is record |
| 23 |
Data : R1; |
| 24 |
end record; |
| 25 |
|
| 26 |
for R2 use record |
| 27 |
Data at 0 range 3 .. 26; |
| 28 |
end record; |
| 29 |
|
| 30 |
end Unchecked_Union2; |