aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_attr.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2016-05-02 11:08:44 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2016-05-02 11:08:44 +0200
commit3ba1a9eb6ec22706bdb084db2f1ab31a32d4dde8 (patch)
tree8f9db14e43b5357d9daae884d4381ba2c6a6b63a /gcc/ada/sem_attr.adb
parentfc1c2d0482260c80cfe8363f96ace9a57f10cbf4 (diff)
downloadgcc-3ba1a9eb6ec22706bdb084db2f1ab31a32d4dde8.zip
gcc-3ba1a9eb6ec22706bdb084db2f1ab31a32d4dde8.tar.gz
gcc-3ba1a9eb6ec22706bdb084db2f1ab31a32d4dde8.tar.bz2
[multiple changes]
2016-05-02 Ed Schonberg <schonberg@adacore.com> * sem_ch4.adb (Analyze_Allocator): If the expression does not have a subtype indication and the type is an unconstrained tagged type with defaulted discriminants, create an explicit constraint for it during analysis to prevent out-of-order freezing actions on generated classwide types. 2016-05-02 Javier Miranda <miranda@adacore.com> * exp_ch5.adb (Expand_N_Assignment_Statement): In the runtime check that ensures that the tags of source an target match, add missing displacement of the pointer to the objects if they cover interface types. 2016-05-02 Ed Schonberg <schonberg@adacore.com> * sem_attr.adb (Analyze_Attribute, case 'Old): Do not use base type for attribute when type is discrete: transformation is not needed for such types, and leads to spurious errors if the context is a case construct. From-SVN: r235709
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r--gcc/ada/sem_attr.adb10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index 3a0fcbe..d071f02 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -4975,8 +4975,16 @@ package body Sem_Attr is
-- and does not suffer from the out-of-order issue described
-- above. Thus, this expansion is skipped in SPARK mode.
+ -- THe expansion is not relevant for discrete types, that will
+ -- not generate extra declarations, and where use of the base
+ -- type may lead to spurious errors if context is a case.
+
if not GNATprove_Mode then
- Pref_Typ := Base_Type (Pref_Typ);
+
+ if not Is_Discrete_Type (Pref_Typ) then
+ Pref_Typ := Base_Type (Pref_Typ);
+ end if;
+
Set_Etype (N, Pref_Typ);
Set_Etype (P, Pref_Typ);