diff options
author | Ed Schonberg <schonberg@adacore.com> | 2014-08-01 08:22:22 +0000 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-08-01 10:22:22 +0200 |
commit | a62828520413d90d5dd11c43068b31a46d4fbd75 (patch) | |
tree | efca47fc8a07665edf55f42f6a080abec3a50aff /gcc/ada/sem_ch13.adb | |
parent | fd29c0247aa4af7492782e6c933c713c6732b4b0 (diff) | |
download | gcc-a62828520413d90d5dd11c43068b31a46d4fbd75.zip gcc-a62828520413d90d5dd11c43068b31a46d4fbd75.tar.gz gcc-a62828520413d90d5dd11c43068b31a46d4fbd75.tar.bz2 |
2014-08-01 Ed Schonberg <schonberg@adacore.com>
* einfo.ads, einfo.adb New flags No_Predicate_On_Actual and
No_Dynamic_Predicate_On_Actual, to enforce the generic contract
on generic units that contain constructs that forbid subtypes
with predicates.
* sem_ch3.adb (Analyze_Subtype_Declaration, Process_Subtype):
Inherit flags indicating the presence of predicates in subtype
declarations with and without constraints.
(Inherit_Predicate_Flags): Utility for the above.
* sem_util.adb (Bad_Predicated_Subtype_Use): In a generic context,
indicate that the actual cannot have predicates, and preserve
warning. In an instance, report error if actual has predicates
and the construct appears in a package declaration.
* sem_ch12.adb (Diagnose_Predicated_Actual): Report error
for an actual with predicates, if the corresponding formal
carries No_Predicate_On_Actual or (in the case of a loop)
No_Dynamic_Predicate_On_Actual.
* sem_ch13.adb (Build_Predicate_Functions); Do not build a
Static_Predicate function if the type is non-static (in the
presence of previous errors),
* sem_ch5.adb (Analyze_Loop_Parameter_Specification): Set flag
No_Dynamic_Predicate_On_Actual in a generic context, to enforce
generic contract on actuals that cannot have predicates.
From-SVN: r213418
Diffstat (limited to 'gcc/ada/sem_ch13.adb')
-rw-r--r-- | gcc/ada/sem_ch13.adb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index bf720be..cc03f92 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -8255,6 +8255,15 @@ package body Sem_Ch13 is -- For discrete subtype, build the static predicate list if Is_Discrete_Type (Typ) then + if not Is_Static_Subtype (Typ) then + + -- This can only happen in the presence of previous + -- semantic errors. + + pragma Assert (Serious_Errors_Detected > 0); + return; + end if; + Build_Discrete_Static_Predicate (Typ, Expr, Object_Name); -- If we don't get a static predicate list, it means that we @@ -10123,7 +10132,7 @@ package body Sem_Ch13 is end if; -- For a record type, deal with variant parts. This has to be delayed - -- to this point, because of the issue of statically precicated + -- to this point, because of the issue of statically predicated -- subtypes, which we have to ensure are frozen before checking -- choices, since we need to have the static choice list set. |