Debian Codegraph @

gcc/testsuite/gnat.dg/strub_ind.adb

raw
1 -- { dg-do compile }
2 -- { dg-options "-fstrub=strict" }
3 -- { dg-require-effective-target strub }
4
5 -- This is essentially the same test as strub_attr.adb,
6 -- but applying attributes to access types as well.
7 -- That doesn't quite work yet, so we get an error we shouldn't get.
8
9 package body Strub_Ind is
10 E : exception;
11
12 function G return Integer;
13
14 procedure P (X : Integer) is
15 begin
16 raise E;
17 end;
18
19 function F (X : Integer) return Integer is
20 begin
21 return X * X;
22 end;
23
24 function G return Integer is (FP (X));
25
26 type GT is access function return Integer;
27
28 type GT_SAC is access function return Integer;
29 pragma Machine_Attribute (GT_SAC, "strub", "at-calls");
30
31 GP : GT_SAC := GT_SAC (GT'(G'Access)); -- { dg-error "incompatible" }
32 -- pragma Machine_Attribute (GP, "strub", "at-calls");
33
34 end Strub_Ind;