aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch4.adb
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2019-09-17 07:59:53 +0000
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>2019-09-17 07:59:53 +0000
commit327940801d612d563781e5b58063889d247058b4 (patch)
tree6b276c14793087a13b68c1e4a127d7569d26b2e6 /gcc/ada/sem_ch4.adb
parent92167df3c9735de9c62bab9bf325618febc75198 (diff)
downloadgcc-327940801d612d563781e5b58063889d247058b4.zip
gcc-327940801d612d563781e5b58063889d247058b4.tar.gz
gcc-327940801d612d563781e5b58063889d247058b4.tar.bz2
[Ada] Ada 2020: Raise expressions in limited contexts (AI12-0172)
This patch adds support for the use of raise expressions in more limited contexts (as described in the Ada Isssue AI12-0172). 2019-09-17 Javier Miranda <miranda@adacore.com> gcc/ada/ * exp_ch3.adb (Build_Record_Init_Proc): Do not generate code to adjust the tag component when the record is initialized with a raise expression. * sem_aggr.adb (Valid_Limited_Ancestor): Return True for N_Raise_Expression nodes. (Valid_Ancestor_Type): Return True for raise expressions. * sem_ch3.adb (Analyze_Component_Declaration): Do not report an error when a component is initialized with a raise expression. * sem_ch4.adb (Analyze_Qualified_Expression): Do not report an error when the aggregate has a raise expression. gcc/testsuite/ * gnat.dg/limited4.adb: New testcase. From-SVN: r275776
Diffstat (limited to 'gcc/ada/sem_ch4.adb')
-rw-r--r--gcc/ada/sem_ch4.adb4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch4.adb b/gcc/ada/sem_ch4.adb
index 0dccd33..313398a 100644
--- a/gcc/ada/sem_ch4.adb
+++ b/gcc/ada/sem_ch4.adb
@@ -4001,7 +4001,9 @@ package body Sem_Ch4 is
if Is_Class_Wide_Type (T) then
if not Is_Overloaded (Expr) then
- if Base_Type (Etype (Expr)) /= Base_Type (T) then
+ if Base_Type (Etype (Expr)) /= Base_Type (T)
+ and then Etype (Expr) /= Raise_Type
+ then
if Nkind (Expr) = N_Aggregate then
Error_Msg_N ("type of aggregate cannot be class-wide", Expr);
else