+2018-04-04 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_res.adb (Valid_Conversion): Improve error message on an illegal
+ type conversion whose expression has a limited view of a type.
+
2018-05-21 Ed Schonberg <schonberg@adacore.com>
* exp_ch5.adb (Build_Formal_Container_Iteration): If source has
-- Here we have a real conversion error
else
- Conversion_Error_NE
- ("invalid conversion, not compatible with }", N, Opnd_Type);
+
+ -- Check for missing regular with_clause when only a limited view
+ -- of target is available.
+
+ if From_Limited_With (Opnd_Type)
+ and then In_Package_Body
+ then
+ Conversion_Error_NE
+ ("invalid conversion, not compatible with limited view of }",
+ N, Opnd_Type);
+ Conversion_Error_NE ("\add with_clause for& to current unit!", N,
+ Scope (Opnd_Type));
+
+ elsif Is_Access_Type (Opnd_Type)
+ and then From_Limited_With (Designated_Type (Opnd_Type))
+ and then In_Package_Body
+ then
+ Conversion_Error_NE
+ ("invalid conversion, not compatible with }", N, Opnd_Type);
+ Conversion_Error_NE ("\add with_clause for& to current unit!", N,
+ Scope (Designated_Type (Opnd_Type)));
+
+ else
+ Conversion_Error_NE
+ ("invalid conversion, not compatible with }", N, Opnd_Type);
+ end if;
+
return False;
end if;
end Valid_Conversion;