This patch corrects the conformance verification of discriminants to
provide symmetry between the analysis of incomplete and full view
discriminants. As a result, types of discriminants always resolve to the
proper view.
2019-07-10 Hristian Kirtchev <kirtchev@adacore.com>
gcc/ada/
* sem_ch6.adb (Check_Discriminant_Conformance): Use Find_Type to
discover the type of a full view discriminant.
gcc/testsuite/
* gnat.dg/incomplete7.adb, gnat.dg/incomplete7.ads: New testcase.
From-SVN: r273347
+2019-07-10 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_ch6.adb (Check_Discriminant_Conformance): Use Find_Type to
+ discover the type of a full view discriminant.
+
2019-07-10 Arnaud Charlet <charlet@adacore.com>
* doc/gnat_ugn/gnat_and_program_execution.rst: Improve gnatmem's
Access_Definition (N, Discriminant_Type (New_Discr));
else
- Analyze (Discriminant_Type (New_Discr));
+ Find_Type (Discriminant_Type (New_Discr));
New_Discr_Type := Etype (Discriminant_Type (New_Discr));
-- Ada 2005: if the discriminant definition carries a null
+2019-07-10 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * gnat.dg/incomplete7.adb, gnat.dg/incomplete7.ads: New testcase.
+
2019-07-10 Hristian Kirtchev <kirtchev@adacore.com>
* gnat.dg/limited2.adb, gnat.dg/limited2_pack_1.adb,
--- /dev/null
+-- { dg-do compile }
+
+package body Incomplete7 is
+ procedure Foo is null;
+end Incomplete7;
--- /dev/null
+package Incomplete7 is
+ type Color;
+ type Color is (red, green, blue);
+
+ type Action (C : Color := Color'(red));
+ type Action (C : Color := Color'(red)) is record
+ case C is
+ when red =>
+ Stop_Time : Positive;
+
+ when others =>
+ Go_For_It : Integer;
+ end case;
+ end record;
+
+ type Num;
+ type Num is new Integer;
+
+ type Rec (N : Num := Num'(1));
+ type Rec (N : Num := Num'(1)) is record
+ case N is
+ when 1 =>
+ One : Integer;
+
+ when others =>
+ null;
+ end case;
+ end record;
+
+ procedure Foo;
+end Incomplete7;