mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 03:47:02 -05:00
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
17 lines
415 B
Ada
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;
|