c++: prvalue of array type [PR111286]
[official-gcc.git] / gcc / testsuite / gnat.dg / sync_tag_limited.adb
blob608f10662a311e629211cb17f14fa98b9a805211
1 -- Synchronized tagged types created by a private extension with the keyword
2 -- 'synchronized' shall be seen as an (immutably) limited tagged type, and
3 -- should therefore accept default disciminant spectifications.
4 -- This was a bug in earlier versions of GNAT, whereby GNAT erroneously
5 -- relied on a parent synchronized interface to determine limitedness
6 -- of a synchronized private extension. The problem being that a synchronized
7 -- private extension can derive a non-synchronized interface (specifically a
8 -- limited interface), Yet the RM makes it clear (7.3(6/2)) that such
9 -- synchronized private extensions are always limited.
11 -- Ergo: Default discriminants are of course legal on any synchronized private
12 -- extension.
14 -- { dg-do compile }
16 procedure Sync_Tag_Limited is
18 package Ifaces is
20 type Test_Interface is limited interface;
22 procedure Interface_Action (Test: in out Test_Interface) is abstract;
24 end Ifaces;
27 package Implementation is
28 type Test_Implementation
29 (Constraint: Positive := 1) is
30 synchronized new Ifaces.Test_Interface with private;
32 private
33 protected type Test_Implementation
34 (Constraint: Positive := 1)
35 is new Ifaces.Test_Interface with
37 overriding procedure Interface_Action;
39 end Test_Implementation;
40 end Implementation;
42 package body Implementation is
43 protected body Test_Implementation is
44 procedure Interface_Action is null;
45 end;
46 end Implementation;
48 begin
49 null;
50 end Sync_Tag_Limited;