diff options
author | Ed Schonberg <schonberg@adacore.com> | 2018-09-26 09:17:41 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2018-09-26 09:17:41 +0000 |
commit | 8e53268102e205b1b10664b53ad41c31a9257b32 (patch) | |
tree | 0584f24168e63006c9ea697118bede6d1482bf9f /gcc | |
parent | 56c3e620aa79524033973d09f44cf587c2038198 (diff) | |
download | gcc-8e53268102e205b1b10664b53ad41c31a9257b32.zip gcc-8e53268102e205b1b10664b53ad41c31a9257b32.tar.gz gcc-8e53268102e205b1b10664b53ad41c31a9257b32.tar.bz2 |
[Ada] Missing error on non-limited derived type with limited component
This patch fixes a missing error on a type extension with limited
components, when the parent type is a derived limited interface. This
may allow the unit to improperly compile, but may lead to bind-time
errors when compiling a client of that unit.
Compiling p.adb must yield:
keys.ads:8:06: extension of nonlimited type cannot have limited components
keys.ads:8:06: limitedness is not inherited from limited interface
keys.ads:8:06: add "limited" to type indication
----
with Keys;
procedure P is
begin
null;
end;
----
with GNAT.Semaphores;
package Keys is
type Ref0 is limited interface;
type Ref2 is limited interface and Ref0;
type Object is new Ref2 with record
Lock : aliased GNAT.Semaphores.Binary_Semaphore
(True, GNAT.Semaphores.Default_Ceiling);
end record;
end;
2018-09-26 Ed Schonberg <schonberg@adacore.com>
gcc/ada/
* sem_ch3.adb (Is_Onown_Limited): A derived type whose parent P
is a derived limited record is not itself limited if P is a
derived limited interface.
From-SVN: r264616
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/ada/sem_ch3.adb | 7 |
2 files changed, 11 insertions, 2 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 05530af..88eb18e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,9 @@ +2018-09-26 Ed Schonberg <schonberg@adacore.com> + + * sem_ch3.adb (Is_Onown_Limited): A derived type whose parent P + is a derived limited record is not itself limited if P is a + derived limited interface. + 2018-09-26 Eric Botcazou <ebotcazou@adacore.com> * sem_ch7.adb (Has_Referencer): Remove Top_Level parameter and diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index cc84f9c..8b13cd0 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -1928,9 +1928,12 @@ package body Sem_Ch3 is return True; -- Else the type may have a limited interface progenitor, but a - -- limited record parent. + -- limited record parent that is not an interface. - elsif R /= P and then Is_Limited_Record (P) then + elsif R /= P + and then Is_Limited_Record (P) + and then not Is_Interface (P) + then return True; else |