summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gnat.dg/unchecked_convert6b.adb
blob: d696f7d5f09249dc8f80f2c84e618ac20ce26668 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
-- { dg-do run { target i?86-*-* x86_64-*-* alpha*-*-* ia64-*-* } }

with Unchecked_Conversion;

procedure Unchecked_Convert6b is

  subtype c_5 is string(1..5);

  function int2c5 is  -- { dg-warning "different sizes" }
    new unchecked_conversion (source => integer, target => c_5);

  c5 : c_5;

begin

  c5 := int2c5(16#12#);

  if c5 (1) /= ASCII.DC2 then
    raise Program_Error;
  end if;

end;