diff mbox

[Ada] Unchecked union types can be limited

Message ID 20111013103454.GA17693@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Oct. 13, 2011, 10:34 a.m. UTC
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  <schonberg@adacore.com>

	* sem_prag.adb (Analyze_Pragma, case Unchecked_Union): an
	unchecked union type can be limited.
diff mbox

Patch

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