This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Tested on i686-linux, committed on trunk.
An operation that overrides an inherited operation must be subtype conformant
with it. In Ada 95 this check is performed when the derived type is analyzed.
In Ada2005 a given primitive operation may override several operation that are
inherited from various interface progenitors, and subtype conformance must be
checked against each of them. This check was simply missing for progenitors.
Compilation of t_pkg.ads below must produce:
t_pkg.ads:5:29: not subtype conformant with operation inherited at line 4
t_pkg.ads:5:29: type of "N" does not match
t_pkg.ads:8:29: not subtype conformant with operation inherited at line 7
t_pkg.ads:8:29: type of "N" does not match
with I1_Pkg, I2_Pkg;
package T_Pkg is
type T1 is new I1_Pkg.I1 and I2_Pkg.I2 with null record;
procedure P( Item : T1; N : Natural);
type T2 is new I2_Pkg.I2 and I1_Pkg.I1 with null record;
procedure P( Item : T2; N : Natural);
end T_Pkg;
package I1_Pkg is
type I1 is interface;
procedure P(I : I1; N : Natural) is abstract;
end I1_Pkg;
package I2_Pkg is
type I2 is interface;
procedure P(I : I2; N : Integer) is abstract;
end I2_Pkg;
2007-08-16 Ed Schonberg <schonberg@adacore.com>
* sem_disp.adb (Check_Dispatching_Operation): If the operation
implements an operation inherited from a progenitor interface, verify
that they are subtype-conformant.
Attachment:
difs
Description: Text document
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |