[Ada] Fix validity checking for class-wide objects
[gcc.git] / gcc / ada / exp_attr.adb
index f0f98bbc0ffc7592a0b779adcc21d0db52b03aeb..34fd9dc7a8ee2e41a080090970756d60c2ed92e2 100644 (file)
@@ -737,7 +737,7 @@ package body Exp_Attr is
       --  Use the root type when dealing with a class-wide type
 
       if Is_Class_Wide_Type (Typ) then
-         Typ := Root_Type (Typ);
+         Typ := Validated_View (Root_Type (Typ));
       end if;
 
       Typ_Decl := Declaration_Node (Typ);