This patch removes an improper check on type to which the pragma Unchecked_Union applies. Such a type can be limitied. The following must compile quietly:
package UU is type Val is (One, Two); type T (X : Val := One) is limited record case X is when One => A : Long_Long_Integer; when Two => B : Boolean; end case; end record; pragma Unchecked_Union (T); end UU; Tested on x86_64-pc-linux-gnu, committed on trunk 2011-10-13 Ed Schonberg <schonb...@adacore.com> * sem_prag.adb (Analyze_Pragma, case Unchecked_Union): an unchecked union type can be limited.
Index: sem_prag.adb =================================================================== --- sem_prag.adb (revision 179894) +++ sem_prag.adb (working copy) @@ -13762,12 +13762,6 @@ Error_Msg_N ("Unchecked_Union must not be tagged", Typ); return; - elsif Is_Limited_Type (Typ) then - Error_Msg_N - ("Unchecked_Union must not be limited record type", Typ); - Explain_Limited_Type (Typ, Typ); - return; - else if not Has_Discriminants (Typ) then Error_Msg_N