> The first issue is that the special case for tagged types mentioned in the
> RM 4.5.2(3.1) rule is not implemented, leading to legal code being rejected.
>
> The second issue is that the RM 4.5.2(30-30.3) dynamic semantic rules are
> not correctly implemented when both tested expression and tested type are
> of a specific tagged type, leading to a wrong run-time outcome of the test.
>
> The changes are mostly straightforward, except for the unexpected fallout
> for the implementation of the RM 6.5(8.2) rule prescribing a tag check for
> an anonymous access return designating a specific tagged type, which was
> implemented using a direct membership test on tagged types, and now needs
> to be changed to use an indirect membership test on tagged types, which is
> not affected by the adjusted implementation of dynamic semantic rules.
This fixes a small typo in the above change, but it is harmless because
Tagged_Membership expects only an In operator.
Tested on x86-64/Linux, applied on the mainline.
2026-09-22 Eric Botcazou <[email protected]>
* exp_ch6.adb (Expand_Simple_Function_Return): Fix typo.
--
Eric Botcazoudiff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index caf282df99b..1441aa82838 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -7408,7 +7408,7 @@ package body Exp_Ch6 is
-- [Constraint_Error when not (Exp in R_Type)]
In_Test : constant Node_Id :=
- Make_Not_In
+ Make_In
(Loc,
Duplicate_Subexpr (Exp),
New_Occurrence_Of (R_Type, Loc));