* [Ada] Reject properly an aspect Predicate on a formal type
@ 2017-12-05 12:46 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2017-12-05 12:46 UTC (permalink / raw)
To: gcc-patches; +Cc: Ed Schonberg
[-- Attachment #1: Type: text/plain, Size: 601 bytes --]
This patch adds a check to reject an aspect Predicate on a formal type
declaration.
Compiling gen.adb must yield:
gen.ads:2:55: predicate cannot apply to formal type
---
generic
type T is array (Integer range <>) of Integer
with Predicate => T'First /= 1;
function Gen return Integer;
---
function Gen return Integer is
X : T(1 .. 2);
begin
return X'First;
end Gen;
Tested on x86_64-pc-linux-gnu, committed on trunk
2017-12-05 Ed Schonberg <schonberg@adacore.com>
* sem_ch13.adb (Analyze_Aspect_Specifications, case Predicate): A
predicate cannot apply to a formal type.
[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 571 bytes --]
Index: sem_ch13.adb
===================================================================
--- sem_ch13.adb (revision 255408)
+++ sem_ch13.adb (working copy)
@@ -2389,6 +2389,10 @@
elsif Is_Incomplete_Type (E) then
Error_Msg_N
("predicate cannot apply to incomplete view", Aspect);
+
+ elsif Is_Generic_Type (E) then
+ Error_Msg_N
+ ("predicate cannot apply to formal type", Aspect);
goto Continue;
end if;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-12-05 12:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-05 12:46 [Ada] Reject properly an aspect Predicate on a formal type Pierre-Marie de Rodat
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).