diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-04-27 11:52:18 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2017-04-27 11:52:18 +0200 |
commit | bb9e2aa27576a5dc46bc679949309de4c1600132 (patch) | |
tree | bec9fcf07c0e3b8c57ef421a1cffb95c0a5e8663 /gcc/ada/sem_eval.adb | |
parent | ed8cbbaf7d254e592bd9e57931cf2d57b6f62e9c (diff) | |
download | gcc-bb9e2aa27576a5dc46bc679949309de4c1600132.zip gcc-bb9e2aa27576a5dc46bc679949309de4c1600132.tar.gz gcc-bb9e2aa27576a5dc46bc679949309de4c1600132.tar.bz2 |
[multiple changes]
2017-04-27 Yannick Moy <moy@adacore.com>
* exp_unst.ads: Fix typos in comments.
2017-04-27 Ed Schonberg <schonberg@adacore.com>
* sem_eval.adb (Choice_Matches): Handle properly a real literal
whose type has a defined static predicate.
2017-04-27 Hristian Kirtchev <kirtchev@adacore.com>
* exp_ch4.adb (Insert_Dereference_Action):
Do not adjust the address of a controlled object when the
associated access type is subject to pragma No_Heap_Finalization.
Code reformatting.
From-SVN: r247304
Diffstat (limited to 'gcc/ada/sem_eval.adb')
-rw-r--r-- | gcc/ada/sem_eval.adb | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb index 073dfc6..e024c6d 100644 --- a/gcc/ada/sem_eval.adb +++ b/gcc/ada/sem_eval.adb @@ -626,7 +626,8 @@ package body Sem_Eval is return Non_Static; -- When the choice denotes a subtype with a static predictate, check the - -- expression against the predicate values. + -- expression against the predicate values. Different procedures apply + -- to discrete and non-discrete types. elsif (Nkind (Choice) = N_Subtype_Indication or else (Is_Entity_Name (Choice) @@ -634,10 +635,20 @@ package body Sem_Eval is and then Has_Predicates (Etype (Choice)) and then Has_Static_Predicate (Etype (Choice)) then - return - Choices_Match (Expr, Static_Discrete_Predicate (Etype (Choice))); + if Is_Discrete_Type (Etype (Choice)) then + return Choices_Match + (Expr, Static_Discrete_Predicate (Etype (Choice))); + + elsif + Real_Or_String_Static_Predicate_Matches (Expr, Etype (Choice)) + then + return Match; + + else + return No_Match; + end if; - -- Discrete type case + -- Discrete type case only elsif Is_Discrete_Type (Etyp) then Val := Expr_Value (Expr); |