]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Compiler accepts illegal assignment to reference type target.
authorSteve Baird <baird@adacore.com>
Tue, 9 Jul 2024 23:54:59 +0000 (16:54 -0700)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 2 Aug 2024 07:08:06 +0000 (09:08 +0200)
An assignment statement whose LHS is of a reference type is never legal. If
no other legality rule is violated, then it is ambiguous. In some cases this
ambiguity was not correctly detected.

gcc/ada/

* sem_ch5.adb (Analyze_Assignment): Delete code that was
incorrectly implementing a preference rule.

gcc/ada/sem_ch5.adb

index 4db3a1a26ee30d7e7b70cd3dca276b2b0529a158..d44a12d1dd14c516fed4c78ba9d625b020c4fdd8 100644 (file)
@@ -437,14 +437,6 @@ package body Sem_Ch5 is
                then
                   null;
 
-               --  This may be a call to a parameterless function through an
-               --  implicit dereference, so discard interpretation as well.
-
-               elsif Is_Entity_Name (Lhs)
-                 and then Has_Implicit_Dereference (It.Typ)
-               then
-                  null;
-
                elsif Has_Compatible_Type (Rhs, It.Typ) then
                   if T1 = Any_Type then
                      T1 := It.Typ;