aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/sem_ch6.adb
diff options
context:
space:
mode:
authorGhjuvan Lacambre <lacambre@adacore.com>2021-04-30 10:11:25 +0200
committerPierre-Marie de Rodat <derodat@adacore.com>2021-07-05 13:09:15 +0000
commit0700922ea57258870047f210c3569b5deed1bf82 (patch)
tree32c4fa9f0fc6a6b5daff1f160f5c91fa8e743bb6 /gcc/ada/sem_ch6.adb
parent7e7397265c805a8d6623aadc039e898fea4a4be0 (diff)
[Ada] Fix missing error messages when returning limited type
gcc/ada/ * sem_ch6.adb (Check_Limited_Return): Replace Comes_From_Source with Comes_From_Extended_Return_Statement.
Diffstat (limited to 'gcc/ada/sem_ch6.adb')
-rw-r--r--gcc/ada/sem_ch6.adb3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index ffab332f82d..3697abaa23b 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -7008,7 +7008,8 @@ package body Sem_Ch6 is
elsif Is_Limited_Type (R_Type)
and then not Is_Interface (R_Type)
- and then Comes_From_Source (N)
+ and then not (Nkind (N) = N_Simple_Return_Statement
+ and then Comes_From_Extended_Return_Statement (N))
and then not In_Instance_Body
and then not OK_For_Limited_Init_In_05 (R_Type, Expr)
then