aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2020-05-02 11:35:42 +0200
committerGiuliano Belinassi <giuliano.belinassi@usp.br>2020-08-17 13:14:11 -0300
commit480e0e25299977d7355a08e321d861fb0489533f (patch)
tree75c105851178fbcb5ebf8a0b2afe38f535db6c62 /gcc
parentbdf04ccb320684c05e9745a7a2b421d68c6f246b (diff)
downloadgcc-480e0e25299977d7355a08e321d861fb0489533f.zip
gcc-480e0e25299977d7355a08e321d861fb0489533f.tar.gz
gcc-480e0e25299977d7355a08e321d861fb0489533f.tar.bz2
[Ada] Fix small fallout of previous change for allocator
2020-06-19 Eric Botcazou <ebotcazou@adacore.com> gcc/ada/ * sem_res.adb (Resolve_Qualified_Expression): Do not override the type of the node when it is unconstrained if it is for an allocator.
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/sem_res.adb4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/ada/sem_res.adb b/gcc/ada/sem_res.adb
index e4c0c07..46f1409 100644
--- a/gcc/ada/sem_res.adb
+++ b/gcc/ada/sem_res.adb
@@ -10161,10 +10161,12 @@ package body Sem_Res is
-- If the target type is unconstrained, then we reset the type of the
-- result from the type of the expression. For other cases, the actual
- -- subtype of the expression is the target type.
+ -- subtype of the expression is the target type. But we avoid doing it
+ -- for an allocator since this is not needed and might be problematic.
if Is_Composite_Type (Target_Typ)
and then not Is_Constrained (Target_Typ)
+ and then Nkind (Parent (N)) /= N_Allocator
then
Set_Etype (N, Etype (Expr));
end if;