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] |
An object declaration of a class-wide object with a tag-indeterminate initial value is rewritten as a renaming of a dereference. The renaming must preserve the kind of the object (constant or variable). Previous to this patch, the compiler failed to reject a call to a primitive operation with an in-out controlling formal, when the actual was a constant class-wide object. Compiling main.adb in -gnat05 mode must yield: main.adb:16:04: actual for "I" must be a variable --- with Element; use Element; procedure Main is Object : constant Element.I_Interface'Class := Element.T_Class'(null record); begin Object.Add; end Main; --- package Element is type I_Interface is interface; procedure Add (I : in out I_Interface) is abstract; function Create return I_Interface'Class; type T_Class is new I_Interface with null record; overriding procedure Add (I : in out T_Class) is null; end Element; Tested on x86_64-pc-linux-gnu, committed on trunk 2012-03-15 Ed Schonberg <schonberg@adacore.com> * exp_ch3.adb (Expand_N_Object_Declaration): When rewriting the declaration of a class-wide object, retain the Ekind to prevent subsequent misuse of constants.
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] |