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] |
Inherited predefined operations on controlled types are handled in a non-standard way in the compiler, because in some cases they must remain callable by the generated code even if not directly visible. This results in confusing warning messages when user-defined control operations are not overriding and their declarations carry explicit overriding indicators. This patch removes the warnings when indicators are present, and sets the visibility of hidden inherited operations correctly. Compiling derived.ads below must yield: derived.ads:6:18: subprogram "Initialize" is not overriding --- private with Ada.Finalization; package Root is type T is tagged private; private type T is new Ada.Finalization.Controlled with null record; overriding procedure Initialize (Ob: in out T) is null; overriding procedure Adjust (Ob: in out T) is null; overriding procedure Finalize (Ob: in out T) is null; end Root; --- with Root; package Derived is type D is new Root.T with null record; overriding procedure Initialize (Ob: in out D); -- wrong not overriding procedure Adjust (Ob: in out D); -- OK end Derived; Tested on x86_64-pc-linux-gnu, committed on trunk 2009-11-30 Ed Schonberg <schonberg@adacore.com> * sem_ch3.adb (Derive_Subprogram): Indicate that an inherited predefined control operation is hidden if the parent type is not visibly controlled. * sem_ch6.adb (Check_Overriding_Indicator): Do not report error if overridden operation is not visible, as may be the case with predefined control operations. * sem_disp.adb (Check_Dispatching_Operation): Do not emit warning on non-overriding control operation when type is not visibly controlled, if the subprogram has an explicit overriding indicator. * sem_util.ads, sem_util.adb (Is_Visibly_Controlled): Moved here from sem_disp.adb.
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] |