[Ada] Detect illegal implicit type conversions

Pierre-Marie de Rodat derodat@adacore.com
Fri Dec 13 09:55:00 GMT 2019


When testing whether the target of a type conversion is a general access
type, the test should not be

   E_Kind (Target_Type) = E_General_Access_Type

but rather

   E_Kind (Base_Type (Target_Type)) = E_General_Access_Type

Fix this bug in two places. As a consequence of these bugs, some of the
legality rules regarding conversions (implicit and explicit) to a
general access type were not being enforced in some cases when the
target of the conversion was something other than a first named subtype.

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-12-13  Steve Baird  <baird@adacore.com>

gcc/ada/

	* sem_res.adb (Resolve, Valid_Conversion): Add Base_Type call
	when testing whether a type is a general access type.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: text/x-diff
Size: 951 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20191213/ad54d8f0/attachment.bin>


More information about the Gcc-patches mailing list