1-- { dg-do run } 2procedure Prot_Def is 3 4 protected Prot is 5 procedure Inc; 6 function Get return Integer; 7 private 8 Data : Integer := 0; 9 end Prot; 10 11 protected body Prot is 12 procedure Inc is 13 begin 14 Data := Data + 1; 15 end Inc; 16 function Get return Integer is 17 begin 18 return Data; 19 end Get; 20 end Prot; 21 22 generic 23 with procedure Inc is Prot.Inc; 24 with function Get return Integer is Prot.Get; 25 package Gen is 26 function Add2_Get return Integer; 27 end Gen; 28 29 package body Gen is 30 function Add2_Get return Integer is 31 begin 32 Inc; 33 Inc; 34 return Get; 35 end Add2_Get; 36 end Gen; 37 38 package Inst is new Gen; 39 40begin 41 if Inst.Add2_Get /= 2 then 42 raise Constraint_Error; 43 end if; 44end Prot_Def; 45