[Ada] Assert failure on complex code with private type and discriminant
authorArnaud Charlet <charlet@adacore.com>
Tue, 8 Dec 2020 17:14:08 +0000 (12:14 -0500)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 28 Apr 2021 09:38:07 +0000 (05:38 -0400)
gcc/ada/

* einfo.adb (Discriminant_Constraint): Refine assertion.

gcc/ada/einfo.adb

index 8c401ca..471aea3 100644 (file)
@@ -1120,7 +1120,9 @@ package body Einfo is
 
    function Discriminant_Constraint (Id : E) return L is
    begin
-      pragma Assert (Is_Composite_Type (Id) and then Has_Discriminants (Id));
+      pragma Assert
+        (Is_Composite_Type (Id)
+          and then (Has_Discriminants (Id) or else Is_Constrained (Id)));
       return Elist21 (Id);
    end Discriminant_Constraint;