]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Spurious warning on untagged record type equality
authorJavier Miranda <miranda@adacore.com>
Thu, 27 Nov 2025 17:56:08 +0000 (17:56 +0000)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Fri, 9 Jan 2026 10:57:13 +0000 (11:57 +0100)
The frontend reports a spurious warning when the type of some
component of an untagged record type is a private record type
that has an user-defined equality operator and the sources
are compiled enabling warnings for ignored equality operators
(that is, switch -gnatdw_q).

The warning is spurious because it must not be reported when
the full type declaration of the private type is a record type.

gcc/ada/ChangeLog:

* exp_ch3.adb (Build_Untagged_Record_Equality): Add missing
support for incomplete and private types.

gcc/ada/exp_ch3.adb

index 57d2ec399745904ed8e0e9b4bd68ba67c450088a..1b53199cb4e2293bfd9612bc7ec07c8b72af2094 100644 (file)
@@ -5180,7 +5180,7 @@ package body Exp_Ch3 is
 
          while Present (Comp) loop
             if Present (User_Defined_Eq (Etype (Comp)))
-              and then not Is_Record_Type (Etype (Comp))
+              and then not Is_Record_Type (Underlying_Type (Etype (Comp)))
               and then not Is_Intrinsic_Subprogram
                              (User_Defined_Eq (Etype (Comp)))
             then