[Ada] Fix validity checking for class-wide objects
authorPiotr Trojanek <trojanek@adacore.com>
Mon, 27 Apr 2020 07:56:17 +0000 (09:56 +0200)
committerPierre-Marie de Rodat <derodat@adacore.com>
Fri, 19 Jun 2020 08:17:09 +0000 (04:17 -0400)
2020-06-19  Piotr Trojanek  <trojanek@adacore.com>

gcc/ada/

* exp_attr.adb (Build_Record_VS_Func): Strip privacy and type
derivation from the root type when 'Valid_Scalars is applied to
a class-wide type.

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);