[gcc r16-1159] ada: Missing error on expression function returning incomplete type
Marc Poulhies
dkm@gcc.gnu.org
Thu Jun 5 08:22:31 GMT 2025
https://gcc.gnu.org/g:9fc6eedace2607c5e322f4b874f290975f0d2b0e
commit r16-1159-g9fc6eedace2607c5e322f4b874f290975f0d2b0e
Author: Javier Miranda <miranda@adacore.com>
Date: Tue Feb 4 19:41:53 2025 +0000
ada: Missing error on expression function returning incomplete type
When the type of the expression of an expression function is
an incomplete type, the frontend does not report the expected
error.
gcc/ada/ChangeLog:
* sem_ch6.adb (Analyze_Expression_Function): Add missing check
on premature use of incomplete type.
Diff:
---
gcc/ada/sem_ch6.adb | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 0cfcc1cb263b..d4e6d1693263 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -591,6 +591,11 @@ package body Sem_Ch6 is
End_Scope;
end if;
+ if Is_Incomplete_Type (Typ) then
+ Error_Msg_NE
+ ("premature usage of incomplete}", Expr, First_Subtype (Typ));
+ end if;
+
-- In the case of an expression function marked with the aspect
-- Static, we need to check the requirement that the function's
-- expression is a potentially static expression. This is done
More information about the Gcc-cvs
mailing list