diff options
-rw-r--r-- | gcc/ada/freeze.adb | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 26b5589..468d6ee 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -8141,10 +8141,19 @@ package body Freeze is Decl_Node : Node_Id; begin - -- If E is an itype, pretend that it is declared in N + -- If E is an itype, pretend that it is declared in N except for a + -- class-wide subtype with an equivalent type, because this latter + -- type comes with a bona-fide declaration node. if Is_Itype (E) then - Decl_Node := N; + if Ekind (E) = E_Class_Wide_Subtype + and then Present (Equivalent_Type (E)) + then + Decl_Node := Declaration_Node (Equivalent_Type (E)); + else + Decl_Node := N; + end if; + else Decl_Node := Declaration_Node (E); end if; |