https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122161
Bug ID: 122161
Summary: Visibility problem
Product: gcc
Version: 15.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: ada
Assignee: unassigned at gcc dot gnu.org
Reporter: [email protected]
CC: dkm at gcc dot gnu.org
Target Milestone: ---
This is a problem which has haunted GNAT for years. The probem reports
[T520-013 public] and [T526-002 public], solved meanwhile, demonstrated
the same problem as the actual one in a nearly identical way.
[T526-002 public] solved the visibility problem in the body of package
Generic_SI.Generic_Vector_Space (not included, since not needed for
reproduction).
[Looks similar to 25988.]
This is alire result, the project file and all sources necessary for
reproduction:
------------------------------------------------------------------------
PS C:\Users\Admin\Desktop\Spielplatz\hello_1.0.2_5715870b> alr run
Note: Building hello=1.0.2/hello.gpr...
Compile
[Ada] hello.adb
si-vs.ads:4:01: error: instantiation error at
generic_si-generic_vector_space.ads:32
si-vs.ads:4:01: error: "uno" is not visible
si-vs.ads:4:01: error: instantiation error at
generic_si-generic_vector_space.ads:32
si-vs.ads:4:01: error: non-visible declaration from "ACTUAL_DIMENSIONS" at
dimension_signature.ads:5, instance at actual_dimensions.ads:5
si-vs.ads:4:01: error: instantiation error at
generic_si-generic_vector_space.ads:32
si-vs.ads:4:01: error: non-visible declaration at true_dimensions.ads:5
si-vs.ads:4:01: error: instantiation error at
generic_si-generic_vector_space.ads:32
si-vs.ads:4:01: error: non-visible declaration from "DIMENSIONS" at
dimension_signature.ads:5, instance at generic_si.ads:7
compilation of hello.adb failed
gprbuild: *** compilation phase failed
ERROR: Command ["gprbuild", "-s", "-j0", "-p", "-P",
"C:\Users\Admin\Desktop\Spielplatz\hello_1.0.2_5715870b\hello.gpr"] exited with
code 4
ERROR: Build failed
------------------------------------------------------------------------
project Hello is
for Source_Dirs use ("src/", "SI_2025/**");
for Object_Dir use "obj/";
for Create_Missing_Dirs use "True";
for Exec_Dir use "bin";
for Main use ("hello.adb");
package Compiler is
for Default_Switches ("Ada") use ("-gnata", "-gnat2022");
end Compiler;
end Hello;
------------------------------------------------------------------------
with SI.VS;
use SI.VS, SI;
procedure Hello is
I: Item;
P: Proto_Vector;
X: Vector := P * I;
begin
null;
end Hello;
------------------------------------------------------------------------
with True_Dimensions;
use True_Dimensions;
with Dimension_Signature;
package Actual_Dimensions is new Dimension_Signature (Dimension, uno);
------------------------------------------------------------------------
generic
type Dimension is private;
uno: Dimension;
package Dimension_Signature is
end Dimension_Signature;
------------------------------------------------------------------------
with Dimension_Signature;
generic
type Real is digits <>;
with package Dimensions is new Dimension_Signature (<>);
use Dimensions;
package Generic_SI is
type Item is private;
private
type Item is record
Unit : Dimension;
Value: Real'Base;
end record;
end Generic_SI;
------------------------------------------------------------------------
with Ada.Numerics.Generic_Real_Arrays;
generic
with package Real_Arrays is new Ada.Numerics.Generic_Real_Arrays
(Generic_SI.Real);
use Real_Arrays;
package Generic_SI.Generic_Vector_Space is
subtype Axis is Integer range 1 .. 3;
subtype Proto_Vector is Real_Vector (Axis);
Unit_Proto_Vector: constant array (Axis) of Proto_Vector := (Unit_Vector
(Index => 1, Order => Axis'Last),
Unit_Vector
(Index => 2, Order => Axis'Last),
Unit_Vector
(Index => 3, Order => Axis'Last));
P1: Proto_Vector renames Unit_Proto_Vector (1);
type Vector is private;
U1: constant Vector;
function "*" (Left: Proto_Vector; Right: Item) return Vector;
private
type Vector is record
Unit : Dimension;
Value: Proto_Vector;
end record;
U1: constant Vector := (uno, P1);
end Generic_SI.Generic_Vector_Space;
------------------------------------------------------------------------
with Ada.Numerics.Generic_Real_Arrays;
package Real_Arrays is new Ada.Numerics.Generic_Real_Arrays (Float);
------------------------------------------------------------------------
with Generic_SI;
with Actual_Dimensions;
package SI is new Generic_SI (Float, Actual_Dimensions);
------------------------------------------------------------------------
with Real_Arrays;
with Generic_SI.Generic_Vector_Space;
package SI.VS is new SI.Generic_Vector_Space (Real_Arrays);
------------------------------------------------------------------------
package True_Dimensions is
type Dimension is private;
uno: constant Dimension;
private
type Dimension is null record;
uno: constant Dimension := (null record);
end True_Dimensions;
------------------------------------------------------------------------