]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/ada/ChangeLog
[Ada] Equality for nonabstract type derived from interface treated as abstract
authorpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Aug 2019 09:52:10 +0000 (09:52 +0000)
committerpmderodat <pmderodat@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 14 Aug 2019 09:52:10 +0000 (09:52 +0000)
commit00f6ddf1e5fee0be9160943f273fbfb0d1b66e2b
treeff7dd89b26672c86524992e4fe81aee5f6de6164
parentb1c6096753e9defc5d72a02efd446cc29e5f2f0d
[Ada] Equality for nonabstract type derived from interface treated as abstract

The compiler was creating an abstract function for the equality
operation of a (nonlimited) interface type, and that could result in
errors on generic instantiations that are passed nonabstract types
derived from the interface type along with the derived type's inherited
equality operation (complaining about an abstract subprogram being
passed to a nonabstract formal). The "=" operation of an interface is
supposed to be nonabstract (a direct consequence of the rule in RM
4.5.2(6-7)), so we now create an expression function rather than an
abstract function. The function returns False, but the result is
unimportant since a function of an abstract type can never actually be
invoked (its arguments must generally be class-wide, since there can be
no objects of the type, and calling it will dispatch).

2019-08-14  Gary Dismukes  <dismukes@adacore.com>

gcc/ada/

* exp_ch3.adb (Predef_Spec_Or_Body): For an equality operation
of an interface type, create an expression function (that
returns False) rather than declaring an abstract function.
* freeze.adb (Check_Inherited_Conditions): Set Needs_Wrapper to
False unconditionally at the start of the loop creating wrappers
for inherited operations.

gcc/testsuite/

* gnat.dg/equal11.adb, gnat.dg/equal11_interface.ads,
gnat.dg/equal11_record.adb, gnat.dg/equal11_record.ads: New
testcase.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@274464 138bc75d-0d04-0410-961f-82ee72b054a4
gcc/ada/ChangeLog
gcc/ada/exp_ch3.adb
gcc/ada/freeze.adb
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/equal11.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/equal11_interface.ads [new file with mode: 0644]
gcc/testsuite/gnat.dg/equal11_record.adb [new file with mode: 0644]
gcc/testsuite/gnat.dg/equal11_record.ads [new file with mode: 0644]