homonym.adb 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. -- Copyright 2008-2022 Free Software Foundation, Inc.
  2. --
  3. -- This program is free software; you can redistribute it and/or modify
  4. -- it under the terms of the GNU General Public License as published by
  5. -- the Free Software Foundation; either version 3 of the License, or
  6. -- (at your option) any later version.
  7. --
  8. -- This program is distributed in the hope that it will be useful,
  9. -- but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. -- GNU General Public License for more details.
  12. --
  13. -- You should have received a copy of the GNU General Public License
  14. -- along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. with Pck; use Pck;
  16. package body Homonym is
  17. type Integer_Range is new Integer range -100 .. 100;
  18. type Positive_Range is new Positive range 1 .. 19740804;
  19. ---------------
  20. -- Get_Value --
  21. ---------------
  22. function Get_Value return Integer_Range
  23. is
  24. subtype Local_Type is Integer_Range;
  25. subtype Local_Type_Subtype is Local_Type;
  26. subtype Int_Type is Integer_Range;
  27. Lcl : Local_Type := 29;
  28. Some_Local_Type_Subtype : Local_Type_Subtype := Lcl;
  29. I : Int_Type := 1;
  30. begin
  31. Do_Nothing (Some_Local_Type_Subtype'Address);
  32. Do_Nothing (I'Address);
  33. return Lcl; -- BREAK_1
  34. end Get_Value;
  35. ---------------
  36. -- Get_Value --
  37. ---------------
  38. function Get_Value return Positive_Range
  39. is
  40. subtype Local_Type is Positive_Range;
  41. subtype Local_Type_Subtype is Local_Type;
  42. subtype Pos_Type is Positive_Range;
  43. Lcl : Local_Type := 17;
  44. Some_Local_Type_Subtype : Local_Type_Subtype := Lcl;
  45. P : Pos_Type := 2;
  46. begin
  47. Do_Nothing (Some_Local_Type_Subtype'Address);
  48. Do_Nothing (P'Address);
  49. return Lcl; -- BREAK_2
  50. end Get_Value;
  51. ----------------
  52. -- Start_Test --
  53. ----------------
  54. procedure Start_Test is
  55. Int : Integer_Range;
  56. Pos : Positive_Range;
  57. begin
  58. Int := Get_Value;
  59. Pos := Get_Value;
  60. end Start_Test;
  61. end Homonym;