Files
gcc-reflection/gcc/testsuite/gnat.dg/predicate2-source_reference.ads
Ed Schonberg 6cd1ee98ea [Ada] Spurious error on private extension with predicate
This patch fixes a spurious error involving a private extension whose
full view includes a dynamic predicate, when the parent type is itself
private at the point of the predicate check.  The conversion is known to
be legal so no extra conversion checks are required.

2018-09-26  Ed Schonberg  <schonberg@adacore.com>

gcc/ada/

	* exp_util.adb (Make_Predicate_Call): Use OK_Convert_To when
	applying a predicate check to prevent spurious errors when
	private ancestors are involved.

gcc/testsuite/

	* gnat.dg/predicate2-containers.ads,
	gnat.dg/predicate2-project-name_values.ads,
	gnat.dg/predicate2-project-registry-attribute.ads,
	gnat.dg/predicate2-project-registry.ads,
	gnat.dg/predicate2-project-typ-set.ads,
	gnat.dg/predicate2-project-typ.ads,
	gnat.dg/predicate2-project.ads,
	gnat.dg/predicate2-source_reference.ads, gnat.dg/predicate2.ads,
	gnat.dg/predicate2_main.adb: New testcase.

From-SVN: r264626
2018-09-26 09:18:52 +00:00

34 lines
785 B
Ada

private with Ada.Strings.Unbounded;
package Predicate2.Source_Reference is
type Object is tagged private;
subtype Source_Reference is Object;
function "<" (Left, Right : Object) return Boolean;
Undefined : constant Object;
private
use Ada.Strings.Unbounded;
type Object is tagged record
Line : Natural;
Column : Natural;
Filename : Unbounded_String;
end record
with Dynamic_Predicate => Filename /= Null_Unbounded_String;
function "<" (Left, Right : Object) return Boolean is
(Left.Filename < Right.Filename
or else
(Left.Filename = Right.Filename and then Left.Line < Right.Line));
Undefined : constant Object :=
(0, 0, To_Unbounded_String ("@"));
end Predicate2.Source_Reference;