From: Javier Miranda Date: Tue, 4 Feb 2025 19:41:53 +0000 (+0000) Subject: ada: Missing error on expression function returning incomplete type X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9fc6eedace2607c5e322f4b874f290975f0d2b0e;p=thirdparty%2Fgcc.git 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 --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 0cfcc1cb263..d4e6d169326 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