+2018-08-21 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb (Resolve_Call): Force the freezing of an
+ expression function that is called to provide a default value
+ for a defaulted discriminant in an object initialization.
+
2018-08-21 Hristian Kirtchev <kirtchev@adacore.com>
* libgnat/g-dynhta.adb, libgnat/g-dynhta.ads: New package
-- (including the body of another expression function) which would
-- place the freeze node in the wrong scope. An expression function
-- is frozen in the usual fashion, by the appearance of a real body,
- -- or at the end of a declarative part.
+ -- or at the end of a declarative part. However an implcit call to
+ -- an expression function may appear when it is part of a default
+ -- expression in a call to an initialiation procedure, and must be
+ -- frozen now, even if the body is inserted at a later point.
if Is_Entity_Name (Subp)
and then not In_Spec_Expression
(not Is_Expression_Function_Or_Completion (Entity (Subp))
or else Scope (Entity (Subp)) = Current_Scope)
then
+ if Is_Expression_Function (Entity (Subp)) then
+
+ -- Force freeze of expression function in call.
+
+ Set_Comes_From_Source (Subp, True);
+ Set_Must_Not_Freeze (Subp, False);
+ end if;
+
Freeze_Expression (Subp);
end if;
+2018-08-21 Ed Schonberg <schonberg@adacore.com>
+
+ * gnat.dg/expr_func5.adb: New testcase.
+
2018-08-21 Hristian Kirtchev <kirtchev@adacore.com>
* gnat.dg/dynhash.adb: New testcase.