@@ -492,7 +492,7 @@ subprograms that need to refer to it. This defers the elaboration check for
492
492
the generic body until an instantiating subprogram is called. So instead of
493
493
version #1 ,
494
494
495
- ```
495
+ ``` ada
496
496
package Pkg is
497
497
procedure Foo;
498
498
procedure Bar;
@@ -514,7 +514,7 @@ version #1,
514
514
515
515
we might see version #2 ,
516
516
517
- ```
517
+ ``` ada
518
518
package Pkg is
519
519
procedure Foo;
520
520
procedure Bar;
@@ -538,7 +538,7 @@ we might see version #2,
538
538
Now consider this case with the added wrinkle that the instance is
539
539
implicitly declared in version #3 :
540
540
541
- ```
541
+ ``` ada
542
542
with G;
543
543
package body Pkg is
544
544
procedure Foo is
@@ -571,6 +571,7 @@ an implicit instance is declared should be well-defined.
571
571
572
572
First, a static example:
573
573
574
+ ``` ada
574
575
generic
575
576
package G1 is
576
577
Int : aliased Integer;
@@ -587,6 +588,7 @@ First, a static example:
587
588
Ref := I1.Int'Access; -- legal
588
589
Ref := I2.Int'Access; -- illegal
589
590
end Foo;
591
+ ```
590
592
591
593
One might argue that this is not a problem since we do not plan to allow
592
594
implicit instances of generic packages that declare variables. But the
@@ -596,6 +598,7 @@ entity declared in the generic have been a constant or even a subprogram
596
598
Next, a dynamic example, referencing the same G1, Int_Ref, Ref, and I1
597
599
declarations:
598
600
601
+ ``` ada
599
602
procedure Bar is
600
603
package I2 is new G1;
601
604
procedure Update_Ref (Value : access Integer) is
@@ -606,6 +609,7 @@ declarations:
606
609
Update_Ref (I1.Int'Access); -- succeeds
607
610
Update_Ref (I2.Int'Access); -- raises Program_Error
608
611
end;
612
+ ```
609
613
610
614
Accessibility levels can also impact the results of membership tests
611
615
and the point at which finalization takes place. We presumably want all
@@ -618,12 +622,14 @@ parameter of an instance, then we can't hoist the implicit declaration
618
622
to some point outside of the subprogram. But what does "outermost possible"
619
623
mean in the case of renamings and subtype declarations? In a case like
620
624
625
+ ``` ada
621
626
procedure Foo (N : Natural) is
622
627
subtype S is String;
623
628
function Eq (X, Y : S) return Boolean renames "=";
624
629
begin
625
630
Some_Generic (S, Eq).Some_Procedure;
626
631
end;
632
+ ```
627
633
628
634
can we hoist the implicit instance declaration outside of Foo?
629
635
What if we add a static constraint to the subtype declaration, as in
0 commit comments