Files
gcc-reflection/gcc/testsuite/gnat.dg/predicate4_pkg.ads
Ed Schonberg f51e316c7c [Ada] Spurious error on predicate of subtype in generic
This patch fixes a spurious error on a dynamic predicate of a record
subtype when the expression for the predicate includes a selected
component that denotes a component of the subtype.

2019-07-03  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* sem_ch8.adb (Find_Selected_Component): If the prefix is the
	current instance of a type or subtype, complete the resolution
	of the name by finding the component of the type denoted by the
	selector name.

gcc/testsuite/

	* gnat.dg/predicate4.adb, gnat.dg/predicate4_pkg.ads: New
	testcase.

From-SVN: r272961
2019-07-03 08:13:41 +00:00

17 lines
415 B
Ada

generic
type Value_Type is private;
package Predicate4_Pkg is
type MT (Has : Boolean := False) is record
case Has is
when False =>
null;
when True =>
MX : Value_Type;
end case;
end record;
function Foo (M : MT) return Boolean is (not M.Has);
subtype LT is MT with Dynamic_Predicate => not LT.Has;
function Bar (M : MT) return Boolean is (Foo (M));
end;