diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2022-04-21 00:03:59 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-05-30 08:29:01 +0000 |
commit | fabf93dc1ae8268c416c1f2b77425922a6de046f (patch) | |
tree | b22d0f62dc7d1cccced5ca7b529d1345f8ab8baa /gcc/c | |
parent | 3e93d2926aeefcffc978005b7964481f351dd494 (diff) | |
download | gcc-fabf93dc1ae8268c416c1f2b77425922a6de046f.zip gcc-fabf93dc1ae8268c416c1f2b77425922a6de046f.tar.gz gcc-fabf93dc1ae8268c416c1f2b77425922a6de046f.tar.bz2 |
[Ada] Restore hiding of predefined "=" operator through class-wide type
The previous change introduced a backward incompatibility in the handling
of a user-defined "=" operator for a class-wide type of a tagged type: it
would previously hide the predefined "=" operator of the tagged type in
the private case, but it no longer does in this case, while it still does
in the nonprivate case.
This hiding is a non-portability, but is fundamentally what the compiler
implements, instead of the RM rule which requires homographs. The reason
lies in the implementation of the "=" operator in GNAT: internally, there
is not a "=" predefined operator for every nonlimited type, but instead
there is a single, universal "=" predefined operator for all the nonlimited
types. The consequence is that the hiding rule implemented in GNAT for "="
is effectively that a user-declared symmetrical "=" operator returning
boolean hides the predefined "=" operator of any type that is covered by
the user-declared operator.
Whether it is desirable to implement the exact RM rule in GNAT is to be
discussed, but existing code relies on the non-portability and would thus
need to be changed.
gcc/ada/
* sem_ch6.adb (New_Overloaded_Entity): Deal specifically with the
overriding of the "=" operator for tagged types.
Diffstat (limited to 'gcc/c')
0 files changed, 0 insertions, 0 deletions