[Ada] Fix problematic overloading of operator in Ada 95 mode
authorEric Botcazou <ebotcazou@adacore.com>
Mon, 3 Dec 2018 15:49:12 +0000 (15:49 +0000)
committerPierre-Marie de Rodat <pmderodat@gcc.gnu.org>
Mon, 3 Dec 2018 15:49:12 +0000 (15:49 +0000)
commit9f8483ca8f858ea19e3e0fcf567820e3195fe2de
tree66452a5079e3ab6a4a9e1bf0d4c9aaced7b77d29
parentc899d4bafcad17c7d493123cdf75ce4f54e0f8c1
[Ada] Fix problematic overloading of operator in Ada 95 mode

The change reverts the test deciding whether an initialization procedure
can be inherited from parent to derived type to the original
implementation, which allowed inheriting a null procedure.

This prevents the creation of another null initialization procedure for
the derived type, which in turn can avoid an artificial overloading
which can wreak havoc in the analysis of private declarations of a
package.

2018-12-03  Eric Botcazou  <ebotcazou@adacore.com>

gcc/ada/

* exp_ch3.adb (Build_Record_Init_Proc): Inherit an
initialization procedure if it is present, even if it is null.

gcc/testsuite/

* gnat.dg/overload2.adb, gnat.dg/overload2_p.adb,
gnat.dg/overload2_p.ads, gnat.dg/overload2_q.adb,
gnat.dg/overload2_q.ads: New testcase.

From-SVN: r266753
gcc/ada/ChangeLog
gcc/ada/exp_ch3.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/overload2.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/overload2_p.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/overload2_p.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/overload2_q.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/overload2_q.ads [new file with mode: 0644]