diff mbox

[Ada] Protected extension as full type for limited private rejected

Message ID 20110906080331.GA30297@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Sept. 6, 2011, 8:03 a.m. UTC
The compiler complains when a limited private type has a full type
that is a protected type extending an interface, thinking that the
partial view is not limited.  The compiler was incorrectly checking
that the partial view satisfies Is_Limited_Composite rather than simply
testing for limitedness.

The following test must compile quietly with -gnat05:

package Priv_Prot_Extension_Bug is

   type Protected_Interface is protected interface;

   type Priv is limited private;

private

   protected type Priv is new Protected_Interface with
   end Priv;

end Priv_Prot_Extension_Bug;
package body Priv_Prot_Extension_Bug is

   protected body Priv is
   end Priv;

end Priv_Prot_Extension_Bug;

Tested on x86_64-pc-linux-gnu, committed on trunk

2011-09-06  Gary Dismukes  <dismukes@adacore.com>

	* sem_ch9.adb (Check_Interfaces): Test
	Is_Limited_Type rather than Is_Limited_Record when checking that
	the partial view of a synchronized full view must be limited.
diff mbox

Patch

Index: sem_ch9.adb
===================================================================
--- sem_ch9.adb	(revision 178565)
+++ sem_ch9.adb	(working copy)
@@ -2381,7 +2381,7 @@ 
          --  declaration must be limited.
 
          if Present (Interface_List (N))
-           and then not Is_Limited_Record (Priv_T)
+           and then not Is_Limited_Type (Priv_T)
          then
             Error_Msg_Sloc := Sloc (Priv_T);
             Error_Msg_N ("(Ada 2005) limited type declaration expected for " &