mirror of
https://forge.sourceware.org/marek/gcc.git
synced 2026-02-22 03:47:02 -05:00
An implicit dereference freezes the corresponding designated type. Most implicit dereferences are made explicit during expansion, but this is not the case for a dispatching call where the the controlling parameter and the corresponding controlling argument are access to a tagged type. In that case, to enforce the rule that an expression function that is a completion freezes type references within, we must locate controlling arguments of an access type and freeze explicitly the corresponding designated type. 2018-01-11 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_ch6.adb (Freeze_Expr_Types): If an access value is the controlling argument of a dispatching call. freeze the corresponding designated type. gcc/testsuite/ * gnat.dg/expr_func3.adb, gnat.dg/expr_func3.ads: New testcase. From-SVN: r256507
19 lines
362 B
Ada
19 lines
362 B
Ada
package Expr_Func3 is
|
|
|
|
type Obj_T is abstract tagged null record;
|
|
|
|
type T is access all Obj_T'Class;
|
|
|
|
function Slave (Obj : access Obj_T) return T is (T(Obj));
|
|
|
|
function Optional_Slave (Obj : T) return T;
|
|
|
|
procedure Dummy;
|
|
|
|
private
|
|
|
|
function Optional_Slave (Obj : T) return T is
|
|
(if Obj = null then null else Slave (Obj));
|
|
|
|
end Expr_Func3;
|