This patch corrects a compiler bug that caused an illegal renaming to not be detected. In particular, it wasn't detected if the name in the renaming is a qualified expression whose operand is a conditional expression, and the type is a by-reference type.
Tested on x86_64-pc-linux-gnu, committed on trunk 2017-04-25 Bob Duff <d...@adacore.com> * sem_util.adb (Is_Object_Reference): In the case of N_Explicit_Dereference, return False if it came from a conditional expression.
Index: sem_util.adb =================================================================== --- sem_util.adb (revision 247137) +++ sem_util.adb (working copy) @@ -13548,8 +13548,14 @@ (Is_Object_Reference (Prefix (N)) or else Is_Access_Type (Etype (Prefix (N)))); + -- An explicit dereference denotes an object, except that a + -- conditional expression gets turned into an explicit dereference + -- in some cases, and conditional expressions are not object + -- names. + when N_Explicit_Dereference => - return True; + return not Nkind_In + (Original_Node (N), N_If_Expression, N_Case_Expression); -- A view conversion of a tagged object is an object reference