gcc/testsuite/gnat.dg/discr52.adb
raw| 1 | -- { dg-do compile } |
| 2 | |
| 3 | procedure Discr52 is |
| 4 | type T_Root (Root_Disc : Natural) is record |
| 5 | Data : Natural := 0; |
| 6 | end record; |
| 7 | |
| 8 | type T_Derived (deriv_disc : Natural) is |
| 9 | new T_Root (root_disc => deriv_disc); |
| 10 | |
| 11 | Derived : T_Derived (Deriv_Disc => 3); |
| 12 | Value : Natural; |
| 13 | |
| 14 | procedure Do_Test (Obj : T_Derived) is |
| 15 | begin |
| 16 | Value := Obj.root_disc; -- { dg-error "no selector \"root_disc\" for type \"T_Derived\" defined at line \\d+" } |
| 17 | end; |
| 18 | begin |
| 19 | Do_Test (Derived); |
| 20 | end; |