summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/unchecked_union1.adb
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gnat.dg/unchecked_union1.adb')
-rw-r--r--gcc/testsuite/gnat.dg/unchecked_union1.adb23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gnat.dg/unchecked_union1.adb b/gcc/testsuite/gnat.dg/unchecked_union1.adb
new file mode 100644
index 000000000..671d0b0c7
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/unchecked_union1.adb
@@ -0,0 +1,23 @@
+-- { dg-do run }
+
+procedure Unchecked_Union1 is
+
+ type Bit is (Zero, One);
+
+ type U (X : Bit := Zero) is record
+ case X is
+ when Zero => I: Integer;
+ when One => F : Float;
+ end case;
+ end record;
+ for U use record
+ I at 0 range 0 .. 31;
+ F at 0 range 0 .. 31;
+ end record;
+ pragma Unchecked_Union(U);
+
+begin
+ if U'Object_Size /= 32 then
+ raise Program_Error;
+ end if;
+end;