#248166 Illegal program not detected, ambiguous call to "="

Package:
gnat-12
Source:
gcc-12
Description:
GNU Ada compiler
Submitter:
Date:
2022-04-04 05:33:18 UTC
Severity:
normal
Tags:
#248166#5
Date:
2004-05-09 17:07:46 UTC
From:
To:
procedure Test_82 is
   package pak1 is
      type T1 is tagged null record;
   end pak1;

   package body pak1 is
      -- type T1 is tagged null record;  -- line 7

      function "=" (x, y : T1'class) return boolean is -- line 9
      begin
         return true;
      end "=";

      procedure proc (x, y : T1'class) is
         b : boolean;
      begin
         b := x = y;     --ERROR: ambiguous "="
      end proc;

   end pak1;

begin
   null;
end Test_82;


The compiler says nothing.  When the declaration of T1 is moved to
line 7, we get the expected error message:


test_82.adb:17:17: ambiguous expression (cannot resolve ""="")
test_82.adb:17:17: possible interpretation at line 9
test_82.adb:17:17: possible interpretation at line 3
gnatmake: "test_82.adb" compilation error

#248166#20
Date:
2008-12-29 15:18:54 UTC
From:
To:
teg@burken:~/test/ada/bugs$ gnat -v
GNAT 4.3.2

teg@burken:~/test/ada/bugs$ gnatmake -gnata test_82.adb
gcc-4.3 -c -gnata test_82.adb
gnatbind -x test_82.ali
gnatlink test_82.ali

#248166#31
Date:
2009-08-06 14:52:46 UTC
From:
To:
found 248166 4.4.1-1
thanks