comp.lang.ada
 help / color / mirror / Atom feed
* Unexpected discriminant check failure involving access types
@ 2015-08-10 12:38 Markus Schöpflin
  2015-08-10 13:14 ` Mark Lorenzen
  2015-08-10 14:33 ` Niklas Holsti
  0 siblings, 2 replies; 7+ messages in thread
From: Markus Schöpflin @ 2015-08-10 12:38 UTC (permalink / raw)


Given the following piece of code:

---%<---
      1  procedure TEST
      2  is
      3     type T is (T1, T2);
      4
      5     type RECORD_T (X : T := T1) is record
      6        null;
      7     end record;
      8
      9     type PTR_T is access RECORD_T;
     10
     11     FOO : RECORD_T;
     12     FOO_PTR : constant PTR_T := new RECORD_T;
     13
     14     FOO1 : constant RECORD_T := (X => T1);
     15     FOO2 : constant RECORD_T := (X => T2);
     16  begin
     17     FOO := FOO1;
     18     FOO := FOO2;
     19
     20     FOO_PTR.all := FOO1;
     21     FOO_PTR.all := FOO2;
     22  end;
--->%---

When compiled and executed, I get:

 > ./test

raised CONSTRAINT_ERROR : test.adb:21 discriminant check failed

Can anyone please explain me why I get a discriminant check error when using 
access types? I would have expected it to work the same as for the non-access 
case.

TIA, Markus


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-08-10 19:43 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-10 12:38 Unexpected discriminant check failure involving access types Markus Schöpflin
2015-08-10 13:14 ` Mark Lorenzen
2015-08-10 14:20   ` Markus Schöpflin
2015-08-10 19:00     ` Randy Brukardt
2015-08-10 14:33 ` Niklas Holsti
2015-08-10 14:56   ` Markus Schöpflin
2015-08-10 19:43     ` Niklas Holsti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox